/* Dealtrail application */
.app-body { --bar: 40px; }
.app-body .demo-bar { position: sticky; top: 0; z-index: 15; height: var(--bar); flex-wrap: nowrap; white-space: nowrap; }
.shell { --side: 232px; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - var(--bar)); }
.sidebar { position: sticky; top: var(--bar); align-self: start; display: flex; flex-direction: column; gap: 22px; height: calc(100vh - var(--bar)); padding: 18px 12px; background: var(--navy); color: #dbe3e6; overflow-y: auto; }
.sidebar .brand { padding: 0 8px; color: #fff; }
.sidebar nav ul { display: grid; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 10px; border-radius: var(--radius); color: #c5d0d5; font-weight: 500; text-decoration: none; }
.sidebar nav a:hover { background: #2c3f48; color: #fff; }
.sidebar nav a.is-active { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar nav a .pill { margin-left: auto; }
.sidebar-foot { display: grid; gap: 8px; margin-top: auto; }
.sidebar-foot .field > span { color: #a3b1b8; }
.sidebar-foot .field select { background: #2c3f48; border-color: #3d525c; color: #fff; }
.whoami { display: flex; align-items: center; gap: 10px; padding: 12px 4px 4px; border-top: 1px solid #3d525c; line-height: 1.3; }
.whoami strong { display: block; color: #fff; font-size: 14px; }
.whoami span:not(.avatar) { font-size: 12.5px; color: #a3b1b8; }
.side-btn { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: #c5d0d5; font-size: 13.5px; cursor: pointer; text-align: left; }
.side-btn:hover { background: #2c3f48; color: #fff; }
.scrim { display: none; }
.workspace { min-width: 0; }
.topbar { position: sticky; top: var(--bar); z-index: 10; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 26px; background: var(--surface); border-bottom: 1px solid var(--line); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg); }
.menu-btn { display: none; }
.global-search { position: relative; flex: 1; max-width: 420px; }
.global-search > .icon { position: absolute; left: 12px; top: 11px; color: var(--ink-2); }
.global-search input { width: 100%; height: 40px; padding: 0 12px 0 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.results, .popover { position: absolute; z-index: 20; top: 46px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 14px 32px -12px rgba(31, 48, 56, .35); }
.results { left: 0; right: 0; padding: 6px; }
.results a, .popover li a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.results a:hover, .popover li a:hover { background: var(--accent-tint); }
.results span, .popover li span { display: block; font-size: 12.5px; color: var(--ink-2); }
.results .none { padding: 8px 10px; color: var(--ink-2); }
.bell-wrap { position: relative; margin-left: auto; }
.popover { right: 0; width: min(310px, calc(100vw - 28px)); padding: 12px; }
.popover h2 { font-size: 14px; padding: 0 10px 6px; }
.popover p { padding: 0 10px 8px; }
.popover-all { display: block; padding: 8px 10px 2px; font-weight: 600; font-size: 13.5px; }
.dot { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 19px; }

.content { max-width: 1320px; padding: 24px 26px 64px; }
.content > * + * { margin-top: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head h1 { font: 700 27px/1.15 "Urbanist", system-ui, sans-serif; letter-spacing: -.018em; outline: none; }
.page-head p { color: var(--ink-2); margin-top: 3px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-weight: 600; text-decoration: none; font-size: 14px; }

.card { min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card h2, .card-head h2 { font-size: 15.5px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head a { font-size: 13.5px; font-weight: 600; }
.stack-col { display: grid; gap: 16px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-2.dash { align-items: stretch; }
.dash > .stack-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash > .stack-col > :last-child { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; padding: 16px 18px; color: var(--ink); text-decoration: none; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
a.stat:hover { background: var(--accent-tint); }
.stat-name { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 750; letter-spacing: -.02em; line-height: 1.25; }
.stat-sub { font-size: 13px; color: var(--ink-2); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; line-height: 1.55; white-space: nowrap; }
.stage-new { background: #eef1f2; color: #3c4b53; }
.stage-contacted { background: #dcedef; color: #095b65; }
.stage-proposal { background: #bfe0e3; color: #07474f; }
.stage-negotiation { background: var(--accent); color: #fff; }
.stage-won, .tone-ok { background: var(--ok-tint); color: var(--ok); }
.stage-lost, .tone-neutral { background: #e5eaec; color: #3c4b53; }
.tone-warn { background: var(--warn-tint); color: var(--warn); }
.tone-danger { background: var(--danger-tint); color: var(--danger); }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 2px; border: 1.5px solid #5d6b72; }
.prio-high { font-weight: 700; }
.prio-high::before { background: #c2410c; border-color: #c2410c; }
.prio-medium::before { background: linear-gradient(to top, #5d6b72 50%, transparent 50%); }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: #e5eaec; color: var(--ink); font-size: 11.5px; font-weight: 700; line-height: 19px; text-align: center; }
.pill-danger { background: var(--danger); color: #fff; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-dark); font-size: 12px; font-weight: 700; flex: none; }
.muted { color: var(--ink-2); }
.late { color: var(--danger); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.banner { padding: 11px 15px; border-radius: var(--radius); font-weight: 600; }

.empty { padding: 28px 16px; text-align: center; }
.empty h3 { font-size: 15px; }
.empty p { color: var(--ink-2); margin: 2px 0 12px; }

.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 400; }
.field input, .field select, .field textarea, .facts select { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.field textarea { resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.error { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.error:empty { display: none; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.inline select { width: auto; }
.grow { flex: 1 1 220px; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.count { margin: 14px 0 6px; font-size: 13.5px; color: var(--ink-2); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table thead th { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.table thead button { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0; border: 0; background: none; font-weight: inherit; cursor: pointer; }
.table thead .icon { width: 13px; height: 13px; opacity: .55; }
.table thead [aria-sort="ascending"] button, .table thead [aria-sort="descending"] button { color: var(--accent); }
.table tbody th a { display: block; font-weight: 700; color: var(--ink); text-decoration: none; }
.table tbody th span { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-2); }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr[data-href]:hover { background: #f2f8f9; }
.table .num { text-align: right; padding-right: 18px; white-space: nowrap; }

/* Follow-up rows. Wide lists use one aligned line per row; narrow cards move the time and buttons underneath. */
.fu-list { container-type: inline-size; }
.fu-list li.fu { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; grid-template-areas: "icon main main" ". meta actions"; gap: 10px 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.fu-list li:last-child { border-bottom: 0; }
.fu-list li.fu > .fu-icon { grid-area: icon; }
.fu-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--bg); color: var(--ink-2); }
.is-late .fu-icon { background: var(--danger-tint); color: var(--danger); }
.fu-main { grid-area: main; display: grid; line-height: 1.45; min-width: 0; }
.fu-lead { font-weight: 700; color: var(--ink); text-decoration: none; }
.fu-note, .fu-outcome { font-size: 13.5px; color: var(--ink-2); }
.fu-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--ink-2); }
.fu-time { white-space: nowrap; }
.is-late .fu-time { padding: 3px 10px; border-radius: 99px; background: var(--danger-tint); color: var(--danger); font-weight: 600; }
.fu-owner { display: inline-flex; align-items: center; gap: 7px; }
.fu-owner .avatar { width: 24px; height: 24px; font-size: 10px; }
.fu-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; justify-self: end; }
@container (min-width: 760px) {
  .fu-list li.fu { grid-template-columns: 38px minmax(0, 1fr) 290px 220px; grid-template-areas: "icon main meta actions"; }
  .fu-meta { flex-wrap: nowrap; justify-content: space-between; }
}
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: #ecf0f2; border-radius: 12px; }
.tab { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 13px; border: 0; border-radius: 9px; background: none; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.tab.is-active { background: var(--surface); box-shadow: 0 1px 3px rgba(31, 48, 56, .16); }

.rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows a { font-weight: 650; color: var(--ink); text-decoration: none; }
.feed li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed li div { display: grid; line-height: 1.4; }
.feed a { font-weight: 650; color: var(--ink); text-decoration: none; }
.feed div span { font-size: 13.5px; overflow-wrap: anywhere; }
.feed time { font-size: 12.5px; color: var(--ink-2); }

/* Charts: single hue, every value printed */
.as-table { margin-top: 10px; font-size: 13.5px; }
.as-table summary { cursor: pointer; font-weight: 600; min-height: 30px; }

/* Lead detail */
.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.stepper button { width: 100%; min-height: 40px; padding: 4px 8px; border: 0; border-radius: 8px; background: #e4eaec; font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer; }
.stepper button:hover:not(:disabled):not([aria-current]) { background: #d3dcdf; }
.stepper button:disabled { cursor: default; color: var(--ink-2); }
.stepper .reached button { background: #bfe0e3; color: #07474f; }
.stepper .current button { background: var(--accent); color: #fff; }
.note { font-size: 13.5px; color: var(--ink-2); }
.detail { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.detail-main > * + * { margin-top: 16px; }
.detail-main .card > h2 { margin-bottom: 10px; }
.facts { margin-top: 8px; }
.facts div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border-bottom: 0; }
.facts dt { font-size: 13px; color: var(--ink-2); }
.facts dd { overflow-wrap: anywhere; }
.log-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
.log-form > .btn { margin-top: 23px; }

/* Pipeline */
.board { position: relative; display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 10px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.column { min-height: 320px; padding: 10px; background: #ecf0f2; border-radius: var(--radius-lg); border: 2px solid transparent; }
.column-won { background: #e6f0e2; }
.column.drop-over { border-color: var(--accent); background: var(--accent-tint); }
.column header { padding: 2px 4px 10px; }
.column h2 { font-size: 14px; }
.column header p { font-size: 12.5px; color: var(--ink-2); }
.column ul { display: grid; gap: 8px; }
.column .deal { display: grid; gap: 6px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.column .deal[draggable="true"] { cursor: grab; }
.deal.dragging { opacity: .45; }
.deal > a { font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.3; }
.deal-interest { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.deal-line { display: flex; align-items: center; gap: 10px; }
.deal-line .avatar { width: 24px; height: 24px; font-size: 10px; margin-left: auto; }
.deal-next { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.deal-next .icon { width: 13px; height: 13px; }
.move { position: relative; display: block; }
.move select { width: 100%; min-height: 32px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 12.5px; }
.column-empty { padding: 20px 8px; text-align: center; font-size: 13px; color: var(--ink-2); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.board-foot { font-size: 13.5px; color: var(--ink-2); }

/* Properties and team */
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.unit { display: flex; flex-direction: column; gap: 3px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.unit-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.unit h2 { font-size: 17px; }
.unit-price { font-size: 21px; font-weight: 750; margin-top: 6px; }
.unit-holder { font-size: 13.5px; padding-top: 8px; border-top: 1px solid var(--line); }
.unit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; min-height: 42px; }
.team { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.member { display: flex; flex-direction: column; gap: 10px; }
.member-head { display: flex; gap: 12px; align-items: center; }
.member .facts div { grid-template-columns: minmax(0, 1fr) auto; }

/* Sign in */
.signin { max-width: 780px; margin: 0 auto; padding: 48px 20px 64px; text-align: center; }
.signin h1 { margin-top: 36px; font: 700 clamp(26px, 4vw, 36px)/1.15 "Urbanist", system-ui, sans-serif; letter-spacing: -.02em; outline: none; }
.signin-sub { margin-top: 6px; color: var(--ink-2); }
.segment { display: inline-flex; gap: 4px; margin-top: 26px; padding: 4px; background: #e6ecee; border-radius: 12px; }
.segment legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.segment input { position: absolute; opacity: 0; }
.segment span { display: block; min-height: 40px; padding: 8px 20px; border-radius: 9px; font-weight: 600; cursor: pointer; }
.segment input:checked + span { background: var(--surface); box-shadow: 0 1px 3px rgba(31, 48, 56, .18); }
.segment input:focus-visible + span { outline: 3px solid #f0a020; }
.roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; text-align: left; }
.role { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; height: 100%; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.role:hover { border-color: var(--accent); transform: translateY(-2px); }
.role-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--accent-tint); color: var(--accent); }
.role-icon .icon { width: 24px; height: 24px; }
.role-title { margin-top: 10px; font-size: 19px; font-weight: 750; }
.role-name { color: var(--accent); font-weight: 650; }
.role-points { display: grid; gap: 7px; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.role-points span { display: flex; gap: 8px; }
.role-points .icon { width: 16px; height: 16px; margin-top: 3px; color: var(--ok); }

/* Modal, toasts, loading */
dialog { width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 30px 70px -20px rgba(31, 48, 56, .5); }
dialog::backdrop { background: rgba(31, 48, 56, .55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.wide { grid-column: 1 / -1; }
.modal-note { color: var(--ink-2); }
.modal-note strong { color: var(--ink); }
.toasts { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 15px; border-radius: var(--radius); background: var(--navy); color: #fff; box-shadow: 0 12px 28px -12px rgba(31, 48, 56, .6); }
.toast .icon { margin-top: 2px; color: #8bd7de; }
.toast-warn .icon { color: #ffc35c; }
.skeleton { display: grid; gap: 16px; }
.skeleton > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sk { display: block; height: 92px; border-radius: var(--radius-lg); background: linear-gradient(90deg, #e6ecee 25%, #f2f5f6 50%, #e6ecee 75%); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
.sk-title { width: 240px; max-width: 70%; height: 34px; }
.sk-block { height: 280px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.noscript { padding: 40px; text-align: center; }

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .team { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 260px; height: 100dvh; visibility: hidden; transform: translateX(-100%); transition: transform .2s ease, visibility .2s; }
  .menu-open .sidebar { visibility: visible; transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; border: 0; background: rgba(31, 48, 56, .5); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 56px; }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail-side { order: 2; }
}
@media (max-width: 760px) {
  .table:not(.plain) thead, .table.stack thead { display: flex; flex-wrap: wrap; }
  .table:not(.plain) thead tr { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .table:not(.plain) thead th { border: 0; padding: 4px 0; }
  .table:not(.plain) thead th:not([aria-sort]) { display: none; }
  .table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table:not(.plain), .table:not(.plain) tbody, .table.stack, .table.stack tbody { display: block; }
  .table:not(.plain) tbody tr, .table.stack tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .table:not(.plain) tbody :is(th, td), .table.stack tbody :is(th, td) { display: block; border: 0; padding: 0; text-align: left; }
  .table:not(.plain) tbody th, .table.stack tbody th { grid-column: 1 / -1; }
  .table:not(.plain) tbody td::before, .table.stack tbody td::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
  .fu-list li.fu { grid-template-columns: 38px minmax(0, 1fr); grid-template-areas: "icon main" ". meta" ". actions"; }
  .fu-actions { justify-self: start; }
  .board { grid-template-columns: repeat(5, 82%); scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team, .roles { grid-template-columns: minmax(0, 1fr); }
  .stats-3 { grid-template-columns: minmax(0, 1fr); }
  .filters .field { flex: 1 1 140px; }
  .filters .grow { flex-basis: 100%; }
}
@media (max-width: 520px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 23px; }
  .card { padding: 14px; }
  .rows li { grid-template-columns: minmax(0, 1fr) auto; }
  .rows li > :last-child { grid-column: 1 / -1; justify-self: start; }
  .log-form > .field { flex: 1 1 100%; }
  .log-form > .btn { margin-top: 0; width: 100%; }
  .btn, .btn-small, .tab { min-height: 44px; }
}
.modal-cancel-fu { margin-top: 14px; }
.dash > .stack-col > :last-child:has(.empty) { display: flex; flex-direction: column; }
.dash > .stack-col > :last-child > .empty:last-child { margin-block: auto; }

/* Popups: the title and buttons stay in view while the fields scroll */
dialog { overflow: hidden; }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
dialog .modal-body { min-height: 0; overflow-y: auto; }
dialog .modal-head, dialog .modal-foot { flex: none; }

/* Phones: readable text, finger sized controls, nothing squeezed side by side */
@media (max-width: 760px) {
  .badge, .pill, .field > span, .field em, .field .error, .deal-interest, .deal-next, .column header p, .content time, .table.stack td, .table:not(.plain) td { font-size: 13.5px; }
  .pill { min-width: 22px; line-height: 21px; font-size: 13px; }
  .table:not(.plain) tbody td::before, .table.stack tbody td::before { font-size: 13px; }
  .table:not(.plain) thead th button { min-height: 40px; font-size: 14px; }
  .field input, .field select, .field textarea, .facts select, .move select { font-size: 16px; }
  .field input, .field select, .facts select, .move select { min-height: 44px; }
  .as-table summary { min-height: 44px; display: flex; align-items: center; gap: 6px; }
  .as-table summary::before { content: "+"; font-size: 18px; }
  .as-table[open] summary::before { content: "\2212"; }

  .page-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .page-actions > .btn { flex: 1 1 140px; justify-content: center; }
  .page-actions > .field { flex: 1 1 100%; }
  .page-actions > .field select { flex: 1; }

  .tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; box-sizing: border-box; }
  .tab { justify-content: center; min-height: 44px; font-size: 14.5px; }
  .toolbar > .tabs + .field { width: 100%; }
  .toolbar > .field.inline select { flex: 1; }

  .stepper li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stepper button { min-height: 44px; font-size: 14px; }
}
@media (max-width: 760px) {
  .table:not(.plain) thead tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
  .table:not(.plain) thead { width: 100%; }
  .table:not(.plain) thead th[aria-sort] button { width: 100%; justify-content: center; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; }
  .table:not(.plain) tbody th span, .table.stack tbody th span, .table.plain th, .table.plain td { font-size: 13.5px; }
}
@media (max-width: 760px) {
  .table:not(.plain) thead tr { display: flex; flex-wrap: wrap; }
  .table:not(.plain) thead th[aria-sort] { flex: 1 1 30%; }
  .table:not(.plain) thead th[aria-sort] button { white-space: nowrap; }
}

.role-short { display: none; }
