@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2-variations'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --page: #020817; --card: #0e1829; --border: #1e2a3f; --input: #030818; --text: #ffffff; --muted: #94a3b8; --label: #cbd5e1;
  --accent: #3b82f6; --accent-fill: #2563eb; --agent-fill: #15803d; --agent-border: #22c55e; --on-accent: #ffffff; --success: #34d399; --warning: #fbbf24; --danger: #f87171; --hover: #14213a; --row-unread: #0b1f45;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --nav-w: 232px; --rail-w: 72px; --header-h: 60px; --bottom-h: 64px;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--page); color: var(--text); line-height: 1.5; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html { font-size: 93.75%; } body { font-size: 1rem; }
body { min-height: 100dvh; overflow-x: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; } .nowrap { white-space: nowrap; } .grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.tight { gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack.tight { gap: 6px; } .stack.loose { gap: 20px; }
.hidden { display: none !important; }
.danger-text { color: var(--danger); } .success-text { color: var(--success); } .warn-text { color: var(--warning); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent); font-weight: 650; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); background: var(--accent-fill); }
.btn.danger { border-color: #7f1d1d; color: var(--danger); } .btn.danger.solid { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .85rem; } .btn.icon { padding: 0; width: 44px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; } .field[hidden] { display: none; }
.field > label, .field > .label { color: var(--label); font-size: .85rem; font-weight: 550; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 12px; background: var(--input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); }
textarea.input { min-height: 96px; resize: vertical; }
.input::placeholder { color: #64748b; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, .25); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field .hint { color: var(--muted); font-size: .8rem; } .field .err { color: var(--danger); font-size: .8rem; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.inline-error { background: rgba(248, 113, 113, .1); border: 1px solid #7f1d1d; color: #fecaca; padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; }
.notice { background: rgba(251, 191, 36, .08); border: 1px solid #78561a; color: #fde68a; padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; }
.notice.info { background: rgba(59, 130, 246, .08); border-color: #0e5568; color: #bae6fd; }
.notice.ok { background: rgba(52, 211, 153, .08); border-color: #14633f; color: #a7f3d0; }

/* ---------- cards, badges ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card h2, .card h3 { margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.grid { display: grid; gap: 14px; } .grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } .grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stat { display: block; color: inherit; text-decoration: none; } a.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-size: 1.7rem; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .85rem; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: .75rem; font-weight: 650; border: 1px solid var(--border); background: #0b1424; color: var(--label); white-space: nowrap; }
.badge.accent { background: rgba(59, 130, 246, .15); border-color: #0e5568; color: #7dd8f0; }
.badge.success { background: rgba(52, 211, 153, .12); border-color: #14633f; color: var(--success); }
.badge.warn { background: rgba(251, 191, 36, .12); border-color: #78561a; color: var(--warning); }
.badge.danger { background: rgba(248, 113, 113, .12); border-color: #7f1d1d; color: var(--danger); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-fill); color: var(--on-accent); font-size: .72rem; font-weight: 700; }
.count.danger { background: var(--danger); color: #1c0606; }
.progress { height: 10px; border-radius: 999px; background: #0b1424; border: 1px solid var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent-fill); } .progress.warn > span { background: var(--warning); } .progress.over > span { background: var(--danger); }
.skeleton { background: linear-gradient(90deg, #0b1424 25%, #14213a 37%, #0b1424 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; min-height: 18px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.empty { text-align: center; padding: 40px 16px; } .empty h3 { margin-bottom: 6px; } .empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 14px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.t { width: 100%; border-collapse: collapse; min-width: 640px; }
table.t th, table.t td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; white-space: nowrap; background: #0b1424; position: sticky; top: 0; }
table.t th.sortable { cursor: pointer; user-select: none; } table.t th.sortable:hover { color: var(--text); }
table.t tr.clickable { cursor: pointer; } table.t tbody tr:hover { background: var(--hover); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t td:first-child a { white-space: nowrap; }
table.t tr.flag td { box-shadow: inset 3px 0 0 var(--danger); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input { width: auto; min-width: 150px; flex: 1 1 160px; max-width: 320px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--border); }

/* ---------- tabs, modal, toast ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tab { min-height: 44px; padding: 0 16px; background: none; border: none; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); } .tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
dialog.modal { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: 90dvh; box-shadow: var(--shadow); }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal.wide { width: min(980px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(2, 8, 23, .75); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); gap: 10px; }
.modal-body { padding: 16px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.bottom-nav-on .toasts { bottom: calc(var(--bottom-h) + 12px); }
.toast { background: #12203a; border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; min-width: 240px; }
.toast.error { border-left-color: var(--danger); } .toast.success { border-left-color: var(--success); }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(900px 400px at 50% -10%, rgba(59, 130, 246, .12), transparent); }
.auth-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; margin-bottom: 18px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-fill); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; }
.auth-card.wide { width: min(760px, 100%); }
.mode-fieldset { border: none; padding: 0; margin: 0; } .mode-fieldset .label { color: var(--label); font-size: .85rem; font-weight: 550; margin-bottom: 8px; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card { position: relative; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; background: var(--input); }
.mode-card input { position: absolute; opacity: 0; }
.mode-card:has(input:checked) { border-color: var(--accent); background: rgba(59, 130, 246, .08); box-shadow: 0 0 0 1px var(--accent); }
.mode-card:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.mode-card-head { display: flex; justify-content: space-between; align-items: center; } .mode-card-head strong { font-size: 1.05rem; }
.mode-check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); } .mode-card:has(input:checked) .mode-check { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, transparent 50%); }
.mode-desc { color: var(--label); font-size: .85rem; }
.mode-bullets { margin: 0; padding-left: 18px; color: var(--muted); font-size: .8rem; display: grid; gap: 5px; } .mode-bullets b { color: var(--text, #fff); font-weight: 600; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 10px; padding: 3px; margin: 4px 0 14px; }
.auth-tab { text-align: center; padding: 9px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 550; } .auth-tab.on { background: var(--accent-fill); color: #ffffff; }
@media (max-width: 640px) { .mode-pick { grid-template-columns: 1fr; } }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 18px 0; } .divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- shell ---------- */
/* HEIGHT RULE (do not break): the shell is the only thing that knows the viewport height. It is min-height:100dvh and its
   main row is minmax(0, 1fr); .main is a flex column. A screen that should fill the window (agent chats) puts class
   "fill" on its root: .shell:has(.main > .fill) becomes exactly 100dvh and the .fill child takes the leftover space with
   flex:1 1 0 + min-height:0, then lays out its own panels the same way. NEVER write calc(100vh - <header/banner px>) or
   a fixed/clamped height on a screen: a banner or header change then leaves an empty band. Scrolling screens just flow. */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: var(--header-h) minmax(0, 1fr); min-height: 100dvh; }
.header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--page); position: sticky; top: 0; z-index: 20; }
.header .brand { margin: 0; font-size: 1rem; }
.header .ws { font-weight: 650; max-width: 28ch; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header { min-width: 0; }
.nav { border-right: 1px solid var(--border); padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; align-self: start; max-height: 100dvh; overflow-y: auto; }
.nav a, .nav button.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--label); font-weight: 550; text-decoration: none; background: none; border: none; cursor: pointer; width: 100%; text-align: left; }
.nav a:hover, .nav button.nav-link:hover { background: var(--hover); text-decoration: none; }
.nav a[aria-current="page"] { background: rgba(59, 130, 246, .12); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .label-text { flex: 1; } .nav svg, .bottom-nav svg, .icon-svg { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 4px; }
.main { padding: 20px; min-width: 0; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); }
/* a customer, vendor or product name with one very long word wraps inside the page instead of pushing it sideways */
.page-head > div { min-width: 0; max-width: 100%; } .page-head h1, .page-head .sub { overflow-wrap: anywhere; }
#view :is(li, p, dd, dt, h1, h2, h3, h4, strong, td, th, .callout, .notice, .card, .kv) { overflow-wrap: anywhere; min-width: 0; }
.bottom-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom-h); background: #0a1322; border-top: 1px solid var(--border); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .68rem; font-weight: 600; color: var(--muted); background: none; border: none; text-decoration: none; min-height: 44px; position: relative; cursor: pointer; }
.bottom-nav a[aria-current="page"] { color: var(--accent); }
.bottom-nav .count { position: absolute; top: 4px; left: 54%; }
.bell { position: relative; } .bell .count { position: absolute; top: 2px; right: 0; }
.menu { position: relative; } .menu-pop { position: absolute; right: 0; top: 50px; min-width: 220px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; box-shadow: var(--shadow); z-index: 40; }
.menu-pop button, .menu-pop a { display: flex; width: 100%; min-height: 44px; align-items: center; padding: 0 12px; background: none; border: none; color: var(--text); border-radius: 6px; cursor: pointer; text-align: left; text-decoration: none; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--hover); text-decoration: none; }
.drawer-scrim { position: fixed; inset: 0; background: rgba(2, 8, 23, .7); z-index: 50; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); background: #0a1322; border-right: 1px solid var(--border); z-index: 60; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.drawer.bottom-sheet { top: auto; left: 0; right: 0; width: 100%; border-right: none; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.drawer a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--label); font-weight: 550; text-decoration: none; }
.drawer a:hover { background: var(--hover); } .drawer a[aria-current="page"] { background: rgba(59, 130, 246, .12); color: #fff; }
.menu-btn { display: none; }

@media (max-width: 1099px) {
  :root { --nav-w: var(--rail-w); }
  .nav .label-text, .nav .count { display: none; }
  .nav a, .nav button.nav-link { justify-content: center; padding: 0; position: relative; }
  .nav a .dot { display: block; position: absolute; top: 8px; right: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-fill); }
  .menu-btn { display: inline-flex; }
}
@media (min-width: 1100px) { .nav .dot { display: none; } }
@media (max-width: 767px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px)); }
  .nav { display: none; } .bottom-nav { display: flex; } .menu-btn { display: none; }
  .main { padding: 14px 12px; } .header { padding: 0 12px; } .header .mode-label, .header .brand-text { display: none; }
  h1 { font-size: 1.3rem; }
  .stat .value { font-size: 1.45rem; }
  dialog.modal { width: calc(100vw - 16px); }
}


/* ---------- misc ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; } @media (max-width: 899px) { .split { grid-template-columns: 1fr; } }
.preview-frame { width: 100%; min-height: 360px; height: 60dvh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
img.preview-img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.lowconf { border-color: var(--warning) !important; background: rgba(251, 191, 36, .06) !important; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.kv dd.kv-lines { white-space: pre-line; overflow-wrap: anywhere; }
.diff-bad { background: rgba(248, 113, 113, .15); color: #fecaca; border-radius: 4px; padding: 0 4px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); list-style: none; } .checklist { padding: 0; margin: 0; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); background: var(--input); }
.dropzone.over { border-color: var(--accent); background: rgba(59, 130, 246, .08); color: var(--text); }
.print-doc { background: #fff; color: #111; padding: 28px; border-radius: 8px; font-size: 13px; }
.print-doc h1, .print-doc h2, .print-doc h3 { color: #111; } .print-doc table { width: 100%; border-collapse: collapse; } .print-doc th, .print-doc td { border: 1px solid #bbb; padding: 6px 8px; text-align: left; } .print-doc th { background: #eee; }
.draft-banner { background: #fff3cd; color: #664d03; border: 1px solid #ffda6a; padding: 8px 12px; border-radius: 6px; font-weight: 650; margin-bottom: 12px; }
canvas.sig { width: 100%; height: 150px; background: var(--input); border: 1px solid var(--border); border-radius: var(--radius-sm); touch-action: none; }
.timeline-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.clock { font-variant-numeric: tabular-nums; font-weight: 650; } .clock.late { color: var(--danger); } .clock.soon { color: var(--warning); }
kbd { background: #0b1424; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: .78rem; }

@media print {
  body { background: #fff; color: #000; }
  .header, .nav, .bottom-nav, .no-print, .toasts, .page-head .actions, .tabs, .toolbar { display: none !important; }
  .shell { display: block; padding: 0; } .main { padding: 0; max-width: none; }
  .card { border: none; background: #fff; color: #000; padding: 0; }
  .print-doc { padding: 0; }
}
.skeleton.tall { height: 120px; } .skeleton.line { height: 16px; margin: 8px 0; }
.auth-card .form-grid { grid-template-columns: 1fr 1fr; } .auth-card .form-grid .full { grid-column: 1 / -1; }
.auth-card .form-actions { display: block; } .auth-card .form-actions .btn.primary { width: 100%; min-height: 46px; }
@media (max-width: 520px) { .auth-card .form-grid { grid-template-columns: 1fr; } }

/* ---------- sidebar v2: gradient, grouped, collapsible (brand green) ---------- */
:root { --nav-gap: 10px; --nav-w: 264px; --nav-grad: linear-gradient(180deg, #60a5fa 0%, #2563eb 22%, #1e40af 58%, #0b1d52 100%); }
.shell { grid-template-rows: var(--header-h) 1fr; }
.shell > .header { grid-column: 2; }
.shell > .nav { grid-column: 1; grid-row: 1 / span 2; top: 0; margin: var(--nav-gap) 0 var(--nav-gap) var(--nav-gap); height: calc(100dvh - 2 * var(--nav-gap)); border: none; border-radius: 20px; background: var(--nav-grad); padding: 14px 10px; gap: 2px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); color: #eafff6; }
.shell > .main { grid-column: 2; }
.header .brand { display: none; }
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid rgba(255, 255, 255, .22); margin-bottom: 8px; text-decoration: none; color: #fff; }
.nav-brand:hover { text-decoration: none; }
.nav-brand .brand-mark { background: rgba(255, 255, 255, .92); color: #0b1d52; width: 38px; height: 38px; border-radius: 11px; font-size: 1.1rem; flex: none; }
.nav-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.nav-brand-text strong { font-size: 1rem; letter-spacing: .01em; } .nav-brand-os { font-size: .68rem; font-weight: 600; letter-spacing: .12em; opacity: .85; margin-left: 2px; }
.nav-brand-sub { font-size: .8rem; color: rgba(255, 255, 255, .78); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-head, .nav-group-label { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; color: rgba(255, 255, 255, .72); font: inherit; font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; padding: 14px 10px 6px; cursor: pointer; min-height: 0; }
.nav-group-head:hover { color: #fff; }
.nav-group-head svg { width: 14px; height: 14px; transition: transform .15s; } .nav-group-head[aria-expanded="false"] svg { transform: rotate(-90deg); }
.nav-group-items { display: flex; flex-direction: column; gap: 2px; } .nav-group-items[hidden] { display: none; }
.shell > .nav a { color: #effff8; border-radius: 10px; font-weight: 520; }
.shell > .nav a:hover { background: rgba(255, 255, 255, .14); }
.shell > .nav a[aria-current="page"] { background: rgba(255, 255, 255, .26); color: #fff; box-shadow: none; font-weight: 650; }
.shell > .nav a .count { background: #fff; color: #0b1d52; } .shell > .nav a .count.danger { background: #fecaca; color: #7f1d1d; }
.nav-user { display: flex !important; align-items: center; gap: 10px; border-top: 1px solid rgba(255, 255, 255, .22); border-radius: 0 !important; padding: 12px 8px 4px !important; margin-top: 8px; }
.nav-avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .24); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.nav-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; } .nav-user-text strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .nav-user-text span { font-size: .74rem; color: rgba(255, 255, 255, .75); }
.drawer .nav-group-label { color: var(--muted); padding: 12px 12px 4px; cursor: default; }
@media (max-width: 1099px) {
  :root { --nav-w: 84px; }
  .shell > .nav { margin: 8px 0 8px 8px; padding: 10px 6px; }
  .nav-brand { justify-content: center; padding: 4px 0 12px; } .nav-brand-text, .nav-user-text, .nav-group-head { display: none; }
  .nav-brand.stacked { align-items: center; } .brand-logo.nav, .brand-logo.nav.wide { --lh: 36px; --lw: 48px; }
  .nav-group { margin-top: 6px; } .nav-group-items[hidden] { display: flex; }
  .nav-user { justify-content: center; } .shell > .nav a { justify-content: center; }
  .nav-group + .nav-group { border-top: 1px solid rgba(255, 255, 255, .2); padding-top: 6px; }
}
@media (max-width: 767px) {
  .shell > .header { grid-column: 1; } .shell > .main { grid-column: 1; }
  .header .brand { display: flex; } .header .brand-text { display: none; }
}

/* ---------- integrations screen ---------- */
.int-hero { border-radius: 20px; padding: 26px; background: linear-gradient(135deg, #2563eb 0%, #1e40af 55%, #0b1d52 100%); color: #fff; box-shadow: var(--shadow); }
.int-hero h1 { font-size: 1.9rem; margin: 4px 0 8px; } .int-hero p { margin: 0 0 18px; color: rgba(255, 255, 255, .88); max-width: 70ch; }
.int-eyebrow { font-size: .72rem; letter-spacing: .16em; font-weight: 700; opacity: .85; }
.int-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.int-stat { background: rgba(0, 0, 0, .22); border: 1px solid rgba(255, 255, 255, .18); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; } .int-stat strong { font-size: 1.7rem; line-height: 1.1; } .int-stat span { font-size: .85rem; opacity: .85; }
.int-section { display: flex; flex-direction: column; gap: 6px; } .int-section > h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-top: 8px; }
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 6px; }
.int-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px; justify-content: space-between; }
.int-head { display: flex; gap: 12px; align-items: flex-start; } .int-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(59, 130, 246, .14); color: var(--accent); display: grid; place-items: center; flex: none; } .int-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.agent-card .agent-stats { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 600px) { .int-stats { grid-template-columns: 1fr; } .int-hero { padding: 18px; } }
.integrations .setting-card { max-width: none; }

/* ---------- minimal pass: calmer type, lighter chrome ---------- */
:root { --border: #172236; --card: #0b1424; --header-h: 54px; --nav-grad: linear-gradient(180deg, #3b82f6 0%, #2457d6 24%, #173b9e 60%, #0b1d52 100%); }
html { font-size: 87.5%; }
h1 { font-size: 1.3rem; font-weight: 620; } h2 { font-size: 1.02rem; font-weight: 620; } h3 { font-size: .95rem; }
.page-head .sub, .sub { font-size: .85rem; color: var(--muted); }
.card { border-radius: 12px; padding: 14px; box-shadow: none; }
.main { padding: 22px 26px; }
.page-head { margin-bottom: 4px; }
.btn { min-height: 38px; padding: 0 14px; font-size: .88rem; font-weight: 550; }
.btn.small { min-height: 32px; font-size: .8rem; }
.input, .field input, .field select, .field textarea { font-size: .9rem; }
.field label, .label { font-size: .78rem; font-weight: 550; color: var(--muted); }
.stat { padding: 14px 16px; }
.t th { font-size: .68rem; letter-spacing: .08em; font-weight: 600; } .t td { font-size: .85rem; }
.tab { font-size: .85rem; }
.badge { font-size: .68rem; }
.shell > .nav { padding: 12px 8px; box-shadow: none; }
.shell > .nav a { min-height: 38px; font-size: .88rem; gap: 10px; padding: 0 10px; font-weight: 500; }
.shell > .nav a[aria-current="page"] { font-weight: 600; background: rgba(255, 255, 255, .2); }
.nav svg, .bottom-nav svg, .icon-svg { width: 19px; height: 19px; stroke-width: 1.7; }
.nav-group-head, .nav-group-label { font-size: .64rem; padding: 12px 10px 4px; font-weight: 600; opacity: .8; }
.nav-brand { padding: 4px 6px 12px; } .nav-brand .brand-mark { width: 34px; height: 34px; } .nav-brand-text strong { font-size: .92rem; } .nav-brand-sub { font-size: .74rem; }
.nav-user-text strong { font-size: .84rem; } .nav-user-text span { font-size: .7rem; }
.int-hero { padding: 22px; } .int-hero h1 { font-size: 1.6rem; } .int-stat strong { font-size: 1.4rem; }
.mode-card { padding: 12px; } .mode-bullets { font-size: .76rem; } .mode-desc { font-size: .82rem; }
@media (max-width: 767px) {
  html { font-size: 90.625%; }
  .btn { min-height: 44px; } .btn.small { min-height: 38px; }
  .main { padding: 14px 12px; }
}

/* ---------- app logos + agent library ---------- */
.int-logo { border-radius: 10px; background: #fff; display: grid; place-items: center; flex: none; overflow: hidden; color: var(--accent); }
.int-logo svg { width: 20px; height: 20px; stroke: #1e40af; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.int-logo-img { width: 70%; height: 70%; object-fit: contain; }
.int-tms-row { display: flex; gap: 8px; align-items: center; } .int-tms-row .input { flex: 1; min-width: 0; } @media (max-width: 640px) { .int-tms-row { flex-direction: column; align-items: stretch; } }
.int-card .row.tight { flex-wrap: wrap; justify-content: flex-end; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin-top: 6px; }
.lib-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; }
.lib-tag { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin-left: 4px; font-weight: 600; }
@media (max-width: 600px) { .lib-grid { grid-template-columns: 1fr; } }


/* AI Agents: its own panel, visually apart from Operations and Systems */
.nav-agents { background: rgba(2, 44, 34, .55); border: 1px solid rgba(255, 255, 255, .22); border-radius: 16px; padding: 4px 6px 8px; margin: 14px 0 6px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
.nav-agents .nav-group-head { color: #fff; padding: 10px 6px 6px; letter-spacing: .12em; }
.nav-agents .nav-group-head > span:first-child::before { content: '\2726'; margin-right: 8px; color: #93c5fd; }
.nav-agents .nav-group-items { gap: 1px; }
@media (max-width: 1000px) { .nav-agents { background: none; border: none; box-shadow: none; padding: 0; margin: 0; border-radius: 0; } }

/* agent chat */
.chat-wrap { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; }
.chat-side, .chat-main { background: var(--card); border: 1px solid var(--border); border-radius: 18px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-side { padding: 14px; gap: 10px; }
.chat-new { width: 100%; justify-content: center; border-radius: 999px; min-height: 42px; gap: 8px; }
.chat-new svg { width: 16px; height: 16px; }
.chat-search { position: relative; } .chat-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); } .chat-search .input { padding-left: 36px; width: 100%; border-radius: 12px; }
.chat-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.chat-tab { background: none; border: none; color: var(--muted); font: inherit; font-weight: 600; font-size: .85rem; padding: 6px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; min-height: 0; }
.chat-tab[aria-current="true"] { background: rgba(59, 130, 246, .16); color: #93c5fd; } .chat-tab .n { font-size: .72rem; background: rgba(255, 255, 255, .08); border-radius: 999px; padding: 0 7px; }
.chat-list { overflow-y: auto; display: flex; flex-direction: column; gap: 0; flex: 1; min-height: 0; margin: 0 -6px; }
/* Like Messages: avatar, title and time, a two-line preview, and an inset divider between conversations. */
.chat-row { flex: 0 0 auto; position: relative; display: flex; gap: 12px; align-items: center; text-align: left; background: none; border: none; color: var(--text, #fff); font: inherit; padding: 11px 14px 11px 12px; border-radius: 14px; cursor: pointer; min-height: 0; width: 100%; }
.chat-row::after { content: ''; position: absolute; left: 70px; right: 14px; bottom: 0; height: 1px; background: rgba(148, 163, 184, .24); }
.chat-row:last-child::after, .chat-row[aria-current="true"]::after, .chat-row:hover::after, .chat-row:has(+ .chat-row[aria-current="true"])::after, .chat-row:has(+ .chat-row:hover)::after { display: none; }
.chat-row:hover { background: var(--hover); } .chat-row[aria-current="true"] { background: rgba(59, 130, 246, .16); }
.chat-avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #e0edff; background: linear-gradient(160deg, #60a5fa, #1d4ed8); } .chat-avatar svg { width: 21px; height: 21px; }
.chat-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-row-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.chat-row-title { font-weight: 650; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-time { color: var(--muted); font-size: .76rem; flex: none; }
.chat-row-preview { color: var(--muted); font-size: .84rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; min-height: 1.3em; }
.chat-row.unread .chat-row-title, .chat-row.unread .chat-row-time { color: var(--text, #fff); }
.chat-row.unread::before { content: ''; position: absolute; left: 1px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #3b9cff; }
.chat-empty-list { padding: 14px 8px; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-ico { width: 34px; height: 34px; border-radius: 50%; background: rgba(59, 130, 246, .16); color: #93c5fd; display: grid; place-items: center; flex: none; } .chat-ico svg { width: 18px; height: 18px; }
.chat-pill { font-size: .75rem; font-weight: 600; color: #93c5fd; background: rgba(59, 130, 246, .14); border-radius: 999px; padding: 4px 12px; }
.chat-back { display: none; background: none; border: none; color: var(--label); cursor: pointer; padding: 4px; min-height: 0; } .chat-back svg { width: 20px; height: 20px; }
.chat-stage { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; }
.chat-welcome { max-width: 620px; margin: 0 auto; text-align: center; padding: 12px 0; }
.chat-hero-ico { width: 64px; height: 64px; border-radius: 50%; background: rgba(59, 130, 246, .16); color: #93c5fd; display: inline-grid; place-items: center; } .chat-hero-ico svg { width: 30px; height: 30px; }
.chat-welcome h2 { margin: 14px 0 6px; font-size: 1.4rem; } .chat-welcome p { margin: 0 0 18px; }
.chat-does { list-style: none; margin: 0 auto 22px; padding: 0; display: inline-flex; flex-direction: column; gap: 10px; text-align: left; }
.chat-does li { display: flex; gap: 10px; align-items: center; font-size: .92rem; } .chat-does svg { width: 18px; height: 18px; color: #93c5fd; flex: none; }
.chat-starts-label { font-size: .7rem; letter-spacing: .14em; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-chip { display: inline-flex; gap: 8px; align-items: center; background: var(--bg, #0b1220); border: 1px solid var(--border); color: var(--text, #fff); font: inherit; font-size: .88rem; padding: 9px 16px; border-radius: 999px; cursor: pointer; min-height: 0; } .chat-chip:hover { border-color: var(--accent); } .chat-chip svg { width: 15px; height: 15px; color: #93c5fd; }
.chat-thread { display: flex; flex-direction: column; gap: 10px; max-width: 760px; margin: 0 auto; }
.bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; line-height: 1.5; font-size: .93rem; word-wrap: break-word; }
.bubble.user { align-self: flex-end; background: var(--accent-fill); color: var(--on-accent); border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: rgba(255, 255, 255, .06); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.typing { display: inline-flex; gap: 4px; align-items: center; } .bubble.typing .typing-label { font-style: normal; font-size: .85rem; color: var(--muted); margin-left: 6px; } .bubble.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: og-dot 1s infinite; } .bubble.typing span:nth-child(2) { animation-delay: .15s; } .bubble.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes og-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.chat-foot { padding: 12px 16px 10px; border-top: 1px solid var(--border); }
.chat-compose { display: flex; gap: 10px; align-items: flex-end; border: 1px solid var(--border); border-radius: 22px; padding: 6px 6px 6px 16px; background: var(--bg, #0b1220); }
.chat-input { flex: 1; background: none; border: none; outline: none; color: inherit; font: inherit; resize: none; padding: 8px 0; min-height: 40px; max-height: 140px; box-sizing: border-box; }
.chat-send { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--accent-fill); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; flex: none; min-height: 0; padding: 0; } .chat-send svg { width: 17px; height: 17px; } .chat-send:disabled { opacity: .5; }
.chat-note { text-align: center; margin-top: 6px; }
@media (max-width: 767px) {
  .chat-wrap { grid-template-columns: 1fr; }
  .chat-side { display: none; } .chat-wrap.show-list .chat-side { display: flex; } .chat-wrap.show-list .chat-main { display: none; }
  .chat-back { display: block; }
}


/* chat-first agent page: no header card, the chat uses the screen */
.chat-wrap { flex: 1 1 0; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.nav-group-head .head-count { margin-left: auto; margin-right: 8px; background: #fff; color: #065f46; border-radius: 999px; padding: 0 7px; font-size: .68rem; font-weight: 700; letter-spacing: 0; }

/* library banner + recommendations */
.lib-banner { display: flex; align-items: center; gap: 16px; padding: 18px 20px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; }
.lib-banner h3 { margin: 0 0 4px; font-size: 1.05rem; } .lib-banner p { margin: 0; font-size: .9rem; max-width: 70ch; }
.lib-banner .btn { flex: none; display: inline-flex; gap: 8px; align-items: center; border-radius: 999px; } .lib-banner .btn svg { width: 15px; height: 15px; transform: rotate(-90deg); }
.lib-why { margin: 0 0 12px; font-size: .85rem; color: #93c5fd; background: rgba(59, 130, 246, .1); border-radius: 10px; padding: 8px 10px; }
.lib-card .btn svg { width: 14px; height: 14px; margin-right: 4px; }
@media (max-width: 700px) { .lib-banner { flex-direction: column; align-items: flex-start; } .lib-banner .btn { width: 100%; justify-content: center; } }
.lib-tag-line { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 2px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--label); font-size: .85rem; text-decoration: none; align-self: flex-start; } .back-link svg { width: 16px; height: 16px; } .back-link:hover { color: #fff; }
.lib-activate { width: 100%; justify-content: center; display: inline-flex; gap: 8px; align-items: center; border-radius: 999px; min-height: 40px; } .lib-activate svg { width: 15px; height: 15px; }

/* ---------- first-run checklist ---------- */
.setup-card { border-color: rgba(59, 130, 246, .45); }
.setup-card h2 { margin: 0; }
.setup-card .progress { margin: 12px 0 6px; }
.setup-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.setup-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border: 1px solid var(--border, rgba(255,255,255,.08)); border-radius: 12px; }
.setup-steps li:hover { border-color: rgba(59, 130, 246, .6); background: rgba(59, 130, 246, .06); }
.setup-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.setup-actions { flex: none; display: flex; align-items: center; gap: 14px; }
.setup-cta { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; } .setup-cta svg { width: 15px; height: 15px; }
.setup-manual { color: var(--muted); text-decoration: none; white-space: nowrap; } .setup-manual:hover { color: inherit; text-decoration: underline; }
button.setup-manual { background: none; border: 0; padding: 0 4px; cursor: pointer; font: inherit; }
@media (max-width: 640px) { .setup-steps li { flex-wrap: wrap; } .setup-main { flex-basis: 100%; } .setup-actions { margin-left: 42px; } }
.setup-mark { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; border: 1.5px solid rgba(59, 130, 246, .7); color: #5fe3b4; }
.setup-mark svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.setup-steps li.done .setup-mark { background: #3b82f6; border-color: #3b82f6; color: #04122b; }
.setup-steps li.done strong { text-decoration: line-through; opacity: .6; }
.setup-text { display: grid; gap: 2px; flex: 1; min-width: 0; }

/* chat: day and time labels, links, attachments, drop zone */
.chat-stamp { align-self: center; color: var(--muted); font-size: .74rem; font-weight: 600; padding: 6px 0 2px; }
.chat-link { color: #93c5fd; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; word-break: break-word; }
.bubble.user .chat-link { color: inherit; }
.chat-link-host { font-weight: 400; opacity: .8; }
.bubble-files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; align-items: flex-start; max-width: 100%; } .bubble.media-only .bubble-files { margin-bottom: 0; }
.bubble.has-media { max-width: min(82%, 480px); } .bubble.media-only { padding: 6px; }
.bubble-imgs { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.thumb { display: block; padding: 0; border: 0; background: rgba(0, 0, 0, .18); border-radius: 12px; overflow: hidden; cursor: zoom-in; line-height: 0; min-height: 0; max-width: 100%; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb:focus-visible, .lb-close:focus-visible, .lb-open:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.thumb.bubble-img { width: auto; max-width: 100%; } .thumb.bubble-img img { width: auto; height: auto; max-width: 100%; max-height: 220px; min-width: 64px; min-height: 64px; object-fit: contain; border-radius: 12px; }
.file-tile { display: inline-flex; align-items: center; gap: 10px; padding: 7px 10px 7px 8px; border-radius: 12px; background: rgba(0, 0, 0, .18); color: inherit; text-decoration: none; font-size: .82rem; max-width: 100%; min-width: 0; box-sizing: border-box; line-height: 1.3; }
.file-tile-ico { position: relative; width: 38px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 8px; background: rgba(110, 231, 183, .14); color: #93c5fd; } .file-tile-ico svg { width: 22px; height: 22px; margin-top: -8px; } .file-tile-ico b { position: absolute; bottom: 3px; font-size: .52rem; letter-spacing: .04em; }
.file-tile-text { display: grid; min-width: 0; } .file-tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; font-weight: 600; } .file-tile-size { color: var(--muted); font-size: .76rem; } .bubble.user .file-tile-size { color: inherit; opacity: .75; }
.chat-file-size { color: var(--muted); }
.chat-file { border: 1px solid var(--border); background: var(--bg, #0b1220); } .chat-file.uploading { opacity: .75; } .chat-file.failed { border-color: #f87171; }
.chat-thumb { position: relative; width: 84px; height: 84px; flex: none; } .chat-thumb .thumb { width: 84px; height: 84px; border: 1px solid var(--border); border-radius: 14px; }
.chat-thumb .chat-file-x { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; background: #1f2937; color: #fff; border: 2px solid var(--bg, #0b1220); box-sizing: border-box; z-index: 2; } .chat-thumb .chat-file-x svg { width: 12px; height: 12px; }
.chat-thumb.uploading .thumb img { opacity: .55; } .chat-thumb.failed .thumb { border-color: #f87171; } .chat-thumb.failed .thumb img { opacity: .4; }
.tile-bar { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); overflow: hidden; } .tile-bar::after { content: ''; display: block; height: 100%; width: 40%; border-radius: 4px; background: #34d399; animation: tile-run 1s ease-in-out infinite; } @keyframes tile-run { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.tile-err { position: absolute; inset: auto 0 0 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; font-size: .7rem; font-weight: 700; color: #fecaca; z-index: 1; } .tile-err.inline { position: static; flex-direction: row; gap: 6px; padding: 0; }
.tile-retry { min-height: 0; padding: 2px 8px; border-radius: 8px; border: 1px solid #f87171; background: #1f2937; color: #fff; font-size: .7rem; cursor: pointer; }
body.lb-open-body { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: rgba(2, 6, 12, .92); }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #fff; } .lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .9rem; }
.lb-close, .lb-open { width: 44px; height: 44px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; cursor: pointer; } .lb-close svg, .lb-open svg { width: 20px; height: 20px; }
.lb-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 12px 16px; } .lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.chat-clip { width: 38px; height: 38px; border-radius: 50%; border: none; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none; min-height: 0; padding: 0; margin-left: -8px; } .chat-clip svg { width: 20px; height: 20px; } .chat-clip:hover:not(:disabled) { color: #93c5fd; background: var(--hover); } .chat-clip:disabled { opacity: .4; cursor: default; }
.chat-pending, .chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; } .chat-pending:empty, .chat-suggest:empty { display: none; } .chat-pending { margin-bottom: 8px; max-height: 120px; overflow: auto; padding: 8px 8px 0 0; } .chat-suggest { margin-bottom: 10px; }
.chat-file-x { width: 24px; height: 24px; min-height: 0; padding: 0; border: none; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; } .chat-file-x svg { width: 13px; height: 13px; color: inherit; } .chat-file-x:hover { background: var(--hover); color: inherit; }
.chat-main { position: relative; }
.chat-drop { display: none; position: absolute; inset: 0; z-index: 5; flex-direction: column; gap: 6px; align-items: center; justify-content: center; border: 2px dashed #34d399; border-radius: 18px; background: rgba(8, 20, 16, .88); color: #d9fbec; pointer-events: none; } .chat-drop svg { width: 30px; height: 30px; color: #93c5fd; } .chat-drop span { color: var(--muted); font-size: .85rem; }
.chat-main.dropping .chat-drop { display: flex; }
.chat-file-input { display: none; }

/* chat: proposal card under an agent answer */
.bubble-group { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; max-width: 100%; }
.chat-card { align-self: flex-start; width: min(100%, 560px); border: 1px solid rgba(52, 211, 153, .45); border-radius: 14px; padding: 12px 14px; background: rgba(59, 130, 246, .07); display: flex; flex-direction: column; gap: 8px; }
.chat-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .chat-card-head strong { flex: 1; min-width: 0; }
.chat-card-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(59, 130, 246, .18); color: #93c5fd; flex: none; } .chat-card-ico svg { width: 16px; height: 16px; }
.chat-card-pill { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); } .chat-card-pill.wait { color: #fcd34d; background: rgba(245, 158, 11, .14); } .chat-card-pill.ok { color: #93c5fd; background: rgba(59, 130, 246, .18); } .chat-card-pill.no { color: var(--muted); }
.chat-card-sum { margin: 0; }
.chat-card-warn { display: grid; gap: 6px; padding: 8px 10px; border: 1px solid #78561a; border-radius: 10px; background: rgba(251, 191, 36, .1); color: #fde68a; font-size: .85rem; }
.chat-card-warn-row { display: flex; gap: 8px; align-items: flex-start; overflow-wrap: anywhere; } .chat-card-warn-row svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.chat-card-why { margin: 0; overflow-wrap: anywhere; }
.chat-card-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 0; font-size: .85rem; } .chat-card-kv dt { color: var(--muted); } .chat-card-kv dd { margin: 0; overflow-wrap: anywhere; }
.delivery-card .receipt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-card-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.chat-card-table { border-collapse: collapse; width: 100%; font-size: .8rem; } .chat-card-table th, .chat-card-table td { padding: 6px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); max-width: 220px; overflow: hidden; text-overflow: ellipsis; } .chat-card-table th { color: var(--muted); font-weight: 600; text-transform: capitalize; } .chat-card-table tr:last-child td { border-bottom: none; }
.ui-reason { margin: 4px 0 8px; font-size: 14px; line-height: 1.45; }
.rec-badge { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,.22); font-size: 11px; font-weight: 600; }
.chat-card-actions { display: flex; gap: 10px; flex-wrap: wrap; } .chat-card-actions .btn { display: inline-flex; align-items: center; gap: 6px; } .chat-card-actions svg { width: 14px; height: 14px; }

/* ---------- company logo and initials badge ---------- */
/* The logo sits on a white plate and keeps its own proportions (never stretched or cropped). With no logo, or a picture that fails to load, an initials badge takes its place. */
.brand-logo { --lh: 32px; --lw: 50px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 10px; padding: 3px; box-sizing: content-box; flex: none; overflow: hidden; line-height: 0; }
.brand-logo img { display: block; width: auto; height: auto; max-height: var(--lh); max-width: var(--lw); object-fit: contain; }
.brand-logo.nav { --lh: 32px; --lw: 50px; } .brand-logo.nav.wide { --lh: 36px; --lw: 170px; }
.brand-logo.bar { --lh: 24px; --lw: 40px; border-radius: 8px; } .brand-logo.bar.wide { --lh: 24px; --lw: 96px; }
.brand-logo.card { --lh: 80px; --lw: 220px; border: 1px solid var(--border); border-radius: 14px; padding: 8px; }
.brand-logo.page { --lh: 44px; --lw: 180px; border: 1px solid #e2e8f0; border-radius: 10px; padding: 5px; }
.brand-mark.brand-badge.bar { width: 30px; height: 30px; border-radius: 8px; font-size: .95rem; }
.brand-mark.brand-badge.card { width: 80px; height: 80px; border-radius: 18px; font-size: 2.2rem; }
.brand-mark.brand-badge.page { width: 48px; height: 48px; border-radius: 12px; font-size: 1.4rem; }
.nav-brand.stacked { flex-direction: column; align-items: flex-start; gap: 8px; }
.nav-brand.stacked .nav-brand-text { width: 100%; }
.nav-brand { flex: none; } .nav-brand.stacked { padding-bottom: 14px; margin-bottom: 8px; }
.drawer-brand { min-width: 0; } .drawer-brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-card { display: grid; grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); gap: 22px; align-items: start; }
.company-logo-box { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; max-width: 100%; }
.company-logo-pick { min-height: 96px; display: flex; align-items: center; max-width: 100%; }
.company-logo-pick .brand-logo, .company-logo-pick .brand-mark { max-width: 100%; }
.company-fields { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.company-readonly dt { color: var(--muted); font-size: .78rem; font-weight: 550; } .company-readonly dd { margin: 2px 0 10px; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 640px) { .company-card { grid-template-columns: minmax(0, 1fr); } }

.chat-doc { padding: 10px 12px; } .chat-doc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .chat-doc-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft, rgba(16,185,129,.15)); color: var(--accent); display: grid; place-items: center; flex: none; } .chat-doc-icon svg { width: 18px; height: 18px; }
.chat-doc-meta { display: flex; flex-direction: column; min-width: 0; flex: 1 1 140px; } .chat-doc-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.chat-doc-frame { margin-top: 10px; } .chat-doc-frame .preview-frame { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }

/* components the Operator shows in the chat */
.chat-ui { display: grid; gap: 10px; }
.ui-drop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 18px 14px; border: 2px dashed var(--border, #d4d4d8); border-radius: 14px; background: var(--surface-2, transparent); }
.ui-drop.over { border-color: var(--accent, #2563eb); background: color-mix(in srgb, var(--accent, #2563eb) 8%, transparent); }
.ui-drop-ico { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent); }
.app-find { display: grid; gap: 10px; }
.app-find-list { display: grid; gap: 8px; }
.app-find-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border, #e4e4e7); border-radius: 12px; }
.app-find-row .grow { min-width: 0; }
.app-find-logo { width: 36px; height: 36px; flex: none; }
.app-find-ok { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* a green pulse shows an agent is working */
.live-dot { display: none; width: 9px; height: 9px; margin-left: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); vertical-align: middle; animation: live-pulse 1.4s ease-out infinite; }
.chat-main.working .live-dot { display: inline-block; }
.chat-working { display: none; color: #22c55e; font-weight: 600; }
.chat-main.working .chat-working { display: inline; }
.chat-main.working .chat-sub { display: none; }
body[data-working="operator"] a[href="#/agent/operator"]::after,
body[data-working="ticket_reader"] a[href="#/agent/ticket_reader"]::after,
body[data-working="coder"] a[href="#/agent/coder"]::after,
body[data-working="matcher"] a[href="#/agent/matcher"]::after,
body[data-working="afe_watcher"] a[href="#/agent/afe_watcher"]::after,
body[data-working="partner_biller"] a[href="#/agent/partner_biller"]::after,
body[data-working="document_preparer"] a[href="#/agent/document_preparer"]::after,
body[data-working="biller"] a[href="#/agent/biller"]::after,
body[data-working="collector"] a[href="#/agent/collector"]::after { content: ''; display: inline-block; flex: none; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: #4ade80; animation: live-pulse 1.4s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); opacity: 1; } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); opacity: .75; } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .live-dot, body[data-working] a::after { animation: none; } }
.int-data > summary { cursor: pointer; padding: 12px 14px; border: 1px solid var(--border, #e4e4e7); border-radius: 12px; list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.int-data > summary::-webkit-details-marker { display: none; }
.int-data[open] > summary { margin-bottom: 12px; }

/* Quote link page (the customer's view) and the customer-answer line on the quote card */
.quote-public { width: min(560px, 100%); }
.quote-public h1 { margin: 0 0 4px; font-size: 22px; }
.quote-public .input { width: 100%; margin: 4px 0 12px; }
.quote-public-lines { border: 1px solid var(--border); border-radius: 12px; margin: 14px 0 0; }
.quote-public-line { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.quote-public-line:last-child { border-bottom: 0; }
.quote-public-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
.quote-public-total { display: flex; justify-content: space-between; padding: 14px 0; font-size: 17px; }
.quote-public-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quote-public-actions .btn { flex: 1 1 140px; min-height: 46px; }
.quote-public-done { text-align: center; padding: 18px 8px 6px; }
.quote-public-done h2 { margin: 0 0 6px; font-size: 18px; }
.quote-answer { margin: 6px 0; padding: 8px 10px; border-radius: 10px; font-size: 13px; background: rgba(59, 130, 246, .12); border: 1px solid rgba(59, 130, 246, .35); }
.quote-answer.declined { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .35); }

.quote-public-terms { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 4px 0 16px; font-size: 14px; }
.quote-public-terms dt { color: var(--muted); } .quote-public-terms dd { margin: 0; }

/* Delete a conversation, and the customer buttons on the first-quote card */
.chat-row { cursor: pointer; }
.chat-del { flex: none; align-self: center; display: inline-grid; place-items: center; width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; opacity: .7; }
.chat-del svg { width: 16px; height: 16px; }
.chat-del:hover, .chat-del:focus-visible { background: rgba(239, 68, 68, .14); color: #f87171; opacity: 1; }
@media (hover: hover) { .chat-row:not(:hover):not(:focus-within) .chat-del { opacity: 0; } }
.quote-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.terms-q .terms-why { margin: 2px 0 4px; }
.terms-q .chat-chip { max-width: 100%; white-space: normal; text-align: left; line-height: 1.25; min-height: 40px; }
.terms-q .chat-chip .chip-tag { font-size: .68rem; line-height: 1; padding: 3px 7px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); white-space: nowrap; font-weight: 600; }
.terms-q .terms-skip { border-style: dashed; color: var(--muted, #9ca3af); }
.terms-q.answered { opacity: .6; }
.chat-card.terms-q.terms-done { display: flex; flex-direction: row; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 12px; border-color: var(--border); border-radius: 12px; background: transparent; opacity: .85; width: fit-content; max-width: 100%; }
.terms-done-mark { display: inline-grid; place-items: center; width: 14px; height: 14px; color: #6ee7b7; flex: none; } .terms-done-mark svg { width: 14px; height: 14px; }
.terms-done-a { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.terms-free { display: flex; gap: 8px; align-items: center; margin-top: 4px; min-width: 0; max-width: 100%; } .terms-free[hidden] { display: none; }
.terms-free-input { flex: 1 1 0; min-width: 0; width: 0; } /* width 0: the box's own default width must not widen the row past the card on a phone */
.terms-contact { display: grid; gap: 8px; margin-top: 4px; }
.terms-using { overflow-wrap: anywhere; }
.terms-using .terms-change { color: var(--accent); background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; min-height: 24px; }
.terms-fields { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.terms-field { display: grid; gap: 3px; min-width: 0; } .terms-field[hidden] { display: none; }
.terms-field-input { width: 100%; min-width: 0; box-sizing: border-box; }
.terms-contact .terms-free { margin-top: 0; }
.terms-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--border); } .quote-edit.answered { opacity: .6; } .chat-card.replaced { opacity: .65; }

/* Billing: invoice page, send preview, order invoices card */
.pad { padding: 14px 16px; }
.email-preview { margin: 0; padding: 12px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(255, 255, 255, .03); }
.notice.warn { background: rgba(251, 191, 36, .1); }
.print-doc .invoice-seller { margin: 0 0 12px; } .print-doc .invoice-seller .muted { color: #555; }
.print-doc .invoice-terms { margin-top: 12px; font-size: 13px; }
.chain-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.chain-row:last-child { border-bottom: 0; }

/* ======================================================================
   Layout audit pass: responsive tables, tap targets, signup, checklist.
   Kept in one block; selectors are specific enough to win over operator.css / supplier.css.
   ====================================================================== */

/* ---------- Responsive tables: below 640px every data table stacks into label: value cards ---------- */
@media screen and (max-width: 640px) {
  .table-wrap, .chat-card-scroll, .pd-tablewrap { overflow-x: visible; }
  table.t:not(.tstack) { min-width: 0; }
  table.tstack, table.tstack tbody { display: block; width: 100%; min-width: 0; }
  table.tstack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.tstack tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.tstack tbody tr:last-child { border-bottom: none; }
  table.tstack td, table.tstack tbody th { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: auto; min-width: 0; padding: 6px 0; border: none; text-align: right; white-space: normal; max-width: none; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  table.tstack td[data-label]::before { content: attr(data-label); flex: 0 0 38%; max-width: 38%; text-align: left; color: var(--muted); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; overflow-wrap: normal; }
  table.tstack td:not([data-label]) { justify-content: flex-end; }
  table.tstack td:empty { display: none; }
  table.tstack td.num, table.tstack td.right { text-align: right; }
  table.tstack td .cell-v { text-align: right; min-width: 0; }
  table.tstack td > .input, table.tstack td > select, table.tstack td > input { flex: 1; min-width: 0; width: 100%; }
  table.tstack td > .btn { margin-left: auto; }
  table.tstack tr.flag { box-shadow: inset 3px 0 0 var(--danger); }
  table.tstack tr.flag td { box-shadow: none; }
  table.tstack.compact tr { padding: 8px 12px; }
  /* paper documents (export document preview, JIB statements) keep their white styling */
  .print-doc table.tstack tr { border-bottom: 1px solid #bbb; padding: 8px 0; }
  .print-doc table.tstack td, .print-doc table.tstack tbody th { border: none; padding: 3px 0; color: #111; text-align: right; font-size: 12.5px; }
  .print-doc table.tstack td[data-label]::before { color: #555; font-size: 10.5px; text-transform: uppercase; flex-basis: 40%; max-width: 40%; }
  .print-doc table.pd-lines td:first-child, .print-doc table.pd-lines .num, .print-doc table.pd-lines .small, .print-doc table.pd-lines .wide { white-space: normal; min-width: 0; }
  .print-doc table.tstack tr.total, .print-doc table.tstack tbody tr:last-child th:first-child { font-weight: 700; }
  /* proposal tables inside agent chat cards keep every column */
  .chat-card-table.tstack { font-size: .85rem; }
  .chat-card-table.tstack th, .chat-card-table.tstack td { max-width: none; white-space: normal; }
  .chat-card-table.tstack td[data-label]::before { text-transform: capitalize; font-size: .75rem; letter-spacing: 0; }
}
/* Tablet: tables with 7+ columns become a two-column card grid instead of scrolling sideways */
@media screen and (min-width: 641px) and (max-width: 900px) {
  table.tstack.twide, table.tstack.twide tbody { display: block; width: 100%; min-width: 0; }
  table.tstack.twide thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.tstack.twide tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  table.tstack.twide tbody tr:last-child { border-bottom: none; }
  table.tstack.twide td, table.tstack.twide tbody th { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: auto; min-width: 0; padding: 6px 0; border: none; text-align: right; white-space: normal; max-width: none; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  table.tstack.twide td[data-label]::before { content: attr(data-label); flex: 0 0 38%; max-width: 38%; text-align: left; color: var(--muted); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; overflow-wrap: normal; }
  table.tstack.twide td:not([data-label]) { justify-content: flex-end; }
  table.tstack.twide td:empty { display: none; }
  table.tstack.twide td.num, table.tstack.twide td.right { text-align: right; }
  table.tstack.twide td .cell-v { text-align: right; min-width: 0; }
  table.tstack.twide td > .input, table.tstack.twide td > select, table.tstack.twide td > input { flex: 1; min-width: 0; width: 100%; }
  table.tstack.twide td > .btn { margin-left: auto; }
  table.tstack.twide tr.flag { box-shadow: inset 3px 0 0 var(--danger); }
  table.tstack.twide tr.flag td { box-shadow: none; }
  table.tstack.twide.compact tr { padding: 8px 12px; }
  table.tstack.twide tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; }
  table.tstack.twide tr { border: 1px solid var(--border); border-radius: 10px; background: #0b1424; }
  table.tstack.twide tbody tr:last-child { border-bottom: 1px solid var(--border); }
}
/* Tablet and laptop: tables fit their column (cards can be narrower than the old 640px minimum) */
table.t { min-width: 0; }
@media (min-width: 641px) and (max-width: 900px) {
  table.t th, table.t td { padding: 9px 8px; }
  table.t th { white-space: normal; }
}

/* ---------- Tap targets on touch / narrow screens ---------- */
@media (pointer: coarse), (max-width: 640px) {
  .btn, .btn.small, .tab, .auth-tab { min-height: 40px; }
  .btn.icon, .btn.small.icon { min-width: 40px; width: 40px; padding: 0; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
  label.check { min-height: 40px; align-items: center; }
  .input, select.input { min-height: 44px; }
  table.tstack td a, .session-row a, .setup-manual, .card-head a, .afe-line a, .toolbar a { display: inline-flex; align-items: center; min-height: 40px; }
  table.tstack td a.btn, .card-head a.btn { justify-content: center; }
  table.tstack td .btn.ghost.icon { margin-left: auto; }
  .pager .btn { min-height: 40px; }
}

/* ---------- Signup, verify, auth ---------- */
.mode-note { margin: 0 0 8px; }
.verify-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.verify-actions .btn { width: 100%; }
.auth-card .notice, .auth-card p { overflow-wrap: anywhere; }
.auth-foot { margin: 12px 0 0; }
@media (min-width: 641px) { .verify-actions { flex-direction: row; flex-wrap: wrap; } .verify-actions .btn { width: auto; } }
@media (max-width: 640px) {
  .auth { align-items: flex-start; padding: 12px 12px 24px; }
  .auth-card, .auth-card.wide { padding: 20px 16px; }
  .auth-card h1 { font-size: 1.3rem; }
  .auth-intro { margin-bottom: 10px; font-size: .9rem; }
  .auth-tabs { margin-bottom: 10px; }
  .mode-pick { gap: 8px; }
  .mode-card { padding: 12px; gap: 6px; }
  .mode-bullets { display: grid; gap: 4px; font-size: .76rem; line-height: 1.35; padding-left: 16px; margin-top: 2px; }
  .mode-card:not(:has(input:checked)) .mode-bullets { display: none; }
  .mode-card:not(:has(input:checked))::after { content: "Tap to see what's inside"; font-size: .74rem; color: var(--accent); }
  .mode-desc { font-size: .8rem; }
  .auth-card .form-grid { gap: 10px; }
}

/* ---------- First-run checklist ---------- */
.setup-card { border-color: var(--border); }
.setup-main, .setup-main:hover, .setup-main:focus, .setup-manual, .setup-manual:hover { text-decoration: none; }
.setup-steps li:hover .setup-text strong { text-decoration: none; }
main:focus, .main:focus, a.stat:focus:not(:focus-visible) { outline: none; }

/* flag marker only on the first cell of a flagged row */
table.t tr.flag td { box-shadow: none; } table.t tr.flag td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
table.t.matrix th, table.t.matrix td { padding: 8px 6px; text-align: center; } table.t.matrix th:first-child, table.t.matrix td:first-child { text-align: left; }
@media (max-width: 640px) { table.t.matrix { font-size: .8rem; } table.t.matrix th { font-size: .66rem; letter-spacing: 0; } }

/* ---------- Document preview: a printed sheet on the dark app, used by proposal cards and the Proposals detail ---------- */
.docp-toggle { display: grid; gap: 8px; min-width: 0; } .docp-toggle > .btn { justify-self: start; } .docp-body[hidden] { display: none; }
.docp { container-type: inline-size; width: 100%; max-width: 760px; margin-inline: auto; box-sizing: border-box; background: #fbfaf7; color: #1b2230; border-radius: 6px; padding: clamp(14px, 4cqw, 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .45); font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.docp * { box-sizing: border-box; } .docp dl, .docp dd { margin: 0; }
.docp-head { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 2px solid #1b2230; }
.docp-seller { min-width: 0; flex: 1 1 200px; color: #444c5c; font-size: .8rem; } .docp-company { font-size: 1.05rem; font-weight: 750; color: #111827; }
.docp-logo { margin-bottom: 8px; }
.docp-title { text-align: right; flex: 0 1 auto; } .docp-kind { font-size: 1.4rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #111827; } .docp-num { font-weight: 650; }
.docp-parties { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 14px 0; } .docp-strong { font-weight: 700; }
.docp-k { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6b7280; margin-bottom: 2px; }
.docp-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; justify-content: end; align-content: start; } .docp-meta dt { color: #6b7280; } .docp-meta dd { text-align: right; font-weight: 600; }
.docp-lines { border-top: 1px solid #d5d8de; } .docp-l { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 6px; padding: 9px 0; border-bottom: 1px solid #e5e7eb; }
.docp-lh { display: none; } .docp-d { grid-column: 1 / -1; font-weight: 600; } .docp-q { color: #4b5563; text-align: left; } .docp-p { color: #4b5563; text-align: left; } .docp-a { font-weight: 700; text-align: right; } .docp-l.unpriced .docp-p, .docp-l.unpriced .docp-a { color: #b45309; }
.docp .docp-a { text-align: right; }
.docp-totals { display: grid; gap: 4px; justify-content: end; padding: 12px 0 4px; } .docp-totals > div { display: flex; gap: 24px; justify-content: space-between; } .docp-total { font-size: 1.05rem; border-top: 2px solid #1b2230; padding-top: 6px; margin-top: 2px; }
.docp-sec { margin-top: 14px; padding-top: 10px; border-top: 1px solid #e5e7eb; } .docp-terms { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; } .docp-terms dt { color: #6b7280; }
.docp-wrap { display: grid; gap: 10px; min-width: 0; } .docp-owner { margin: 0 auto; padding: 12px 14px; width: 100%; max-width: 760px; box-sizing: border-box; display: grid; gap: 8px; background: #0b1424; border: 1px solid var(--border); border-left: 3px solid #60a5fa; border-radius: var(--radius-sm, 8px); color: #e2e8f0; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; } .docp-owner p { margin: 0; } .docp-owner-k { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #93c5fd; } .terms-gated[hidden] { display: none !important; }
@container (min-width: 500px) {
  .docp-lh { display: grid; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6b7280; padding: 6px 0; }
  .docp-l { grid-template-columns: minmax(0, 1fr) 96px 100px 100px; gap: 2px 12px; align-items: baseline; } .docp-d { grid-column: auto; } .docp-q, .docp-p { text-align: right; } .docp-x { display: none; }
  .docp-lh > div.r { text-align: right; }
}
@container (max-width: 420px) { .docp-parties { grid-template-columns: minmax(0, 1fr); } .docp-meta { justify-content: start; } .docp-meta dd { text-align: left; } .docp-title { text-align: left; flex-basis: 100%; } .docp-totals { justify-content: stretch; } }
@media print { .docp { box-shadow: none; } }
/* Plain approvals: one sentence of why, one pair of buttons, one sentence of what happens next. */
.chat-card-kind { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #93c5fd; }
.chat-card-why, .why-line { margin: 0; font-size: 1rem; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.chat-card-result, .result-line { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }
.chat-card-actions .btn.primary { flex: 1 1 200px; } .chat-card-actions .btn:not(.small):not(.primary) { flex: 0 1 auto; min-width: 110px; }
.more-menu { position: relative; } .more-menu > summary { list-style: none; cursor: pointer; } .more-menu > summary::-webkit-details-marker { display: none; }
.more-menu[open] > summary { background: var(--hover); }
.more-pop { position: absolute; z-index: 20; bottom: calc(100% + 6px); left: 0; min-width: 190px; display: grid; gap: 2px; padding: 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.more-pop .btn { justify-content: flex-start; width: 100%; }
.actions-row { gap: 10px; flex-wrap: wrap; align-items: center; }
.wait-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .1); border-radius: 12px; font-weight: 600; } .wait-banner[hidden] { display: none; }
.wait-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warning); flex: none; }
.wait-open { font-weight: 700; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 640px) {
  .chat-card-actions { flex-direction: column; } .chat-card-actions .btn:not(.small) { width: 100%; min-height: 48px; }
  .actions-row > .btn.primary, .actions-row > .btn[data-action="reject"] { flex: 1 1 100%; min-height: 48px; }
  .more-menu, .more-menu > summary { width: 100%; } .more-pop { left: 0; right: 0; }
}

/* cards that arrive from other agents */
.chat-card.flash { animation: card-flash 2.4s ease-out 1; }
@keyframes card-flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(52, 211, 153, .65); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.chat-card-from { margin-top: -4px; }
.chat-card-link { align-self: center; margin-left: auto; color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }
.agent-page { min-width: 0; }
@media (max-width: 640px) { .chat-card-actions .btn.primary { flex: 0 0 auto; } .chat-card-link { align-self: flex-start; margin-left: 0; } }
/* Draft quote while the terms are missing: one quiet line and two small links, no buttons. */
.quote-quiet { display: flex; flex-direction: column; gap: 6px; }
.quote-quiet-links { display: flex; gap: 14px; flex-wrap: wrap; }
.quote-quiet-links a, .quote-quiet-links .linklike { color: var(--muted, #6b7280); text-decoration: underline; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; min-height: 24px; }
/* Live relative times (Instagram style): quiet, under the message or card. */
.rel-time { white-space: nowrap; }
.msg-time { display: block; margin-top: 4px; font-size: .7rem; line-height: 1.2; opacity: .6; }
.bubble.user .msg-time { text-align: right; }
.chat-card-time { margin-top: -2px; font-size: .72rem; }

/* shell height rule: see the HEIGHT RULE note at the top of the shell section */
.shell > .main { display: flex; flex-direction: column; min-height: 0; }
.shell > .main > * { flex: 0 0 auto; min-width: 0; }
.shell > .main > .fill { flex: 1 1 0; min-height: 0; }
.shell:has(> .main > .fill) { height: 100dvh; min-height: 0; overflow: hidden; }
.agent-page.fill { display: flex; flex-direction: column; gap: 12px; }
.agent-page.fill > .wait-banner { flex: 0 0 auto; }
.agent-page.fill > .chat-wrap { flex: 1 1 0; min-height: 0; }
.chat-main > .chat-foot { flex: 0 0 auto; }

/* Honest email status: what we know about an email, and the step that sends it */
.email-line { font-size: 13px; line-height: 1.4; margin: 2px 0; }
.email-line.bad { padding: 8px 10px; border-radius: 10px; background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35); }
.send-dialog .send-from { margin: 0; }
.send-actions { align-items: stretch; }
@media (max-width: 520px) { .send-actions { flex-direction: column-reverse; } .send-actions .btn { width: 100%; min-height: 46px; } }
.send-options { display: flex; flex-direction: column; gap: 8px; }
.send-options-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; } .send-options-main[hidden] { display: none; }
.send-options-main .input { width: 100%; min-width: 0; box-sizing: border-box; font-size: 16px; } /* 16px keeps phones from zooming the page on focus */
.send-options-keep { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; line-height: 1.35; cursor: pointer; }
.send-options-keep input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.send-options-primary .btn { width: 100%; justify-content: center; min-height: 44px; }
.send-options-more { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.send-options-more .linklike { color: var(--muted, #6b7280); text-decoration: underline; background: none; border: 0; padding: 6px 0; font: inherit; font-size: .84rem; cursor: pointer; min-height: 32px; text-align: left; }
.send-options-more .linklike:disabled { opacity: .5; cursor: default; }
@media (min-width: 640px) { .send-options { max-width: 460px; } .send-options-primary .btn { width: auto; } }
.pick-tag.undelivered { background: color-mix(in srgb, var(--danger, #ef4444) 18%, transparent); color: var(--danger, #ef4444); text-transform: none; letter-spacing: 0; }
.send-options.answered { opacity: .85; }
.quote-help { flex-basis: 100%; }

/* Where an email goes out from: the From line, or the plain "no email connected" choice with its four buttons. Wraps on a phone. */
.mail-notice { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mail-notice .send-from, .mail-notice p { margin: 0; overflow-wrap: anywhere; }
.mail-notice .quote-pick { margin: 0; }
.mail-notice .mail-connect { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border, #1e2a3f); border-radius: var(--radius-sm); min-width: 0; }
.mail-offer { display: flex; flex-direction: column; gap: 8px; }
.mail-offer[hidden], .mail-offer-finder[hidden] { display: none; }
.mail-offer-finder { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mail-offer.answered { opacity: .85; }
[data-page="email-settings"] select.input { max-width: 100%; }
.send-options-mail { display: flex; flex-direction: column; gap: 8px; min-width: 0; } .send-options-mail[hidden] { display: none; }
.send-options .quote-pick[hidden] { display: none; }
/* Answered cards: one quiet confirmation line, nothing to tap. */
.chat-card.resolved { display: block; padding: 10px 12px; }
.resolved-row { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.resolved-row .grow { min-width: 0; overflow-wrap: anywhere; }
.resolved-ico { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(52, 211, 153, .16); color: var(--success); }
.resolved-ico.later, .resolved-ico.replaced { background: var(--border); color: var(--muted); }
.resolved-ico .icon-svg { width: 14px; height: 14px; }
.connect-return-wrap { display: grid; place-items: start center; padding: 32px 16px; }
.connect-return { display: flex; align-items: flex-start; gap: 12px; width: min(100%, 420px); padding: 14px 16px; }

/* Which quote? and the quote shown in the chat to be checked. Both wrap on a phone; the quote paper scales with its card. */
.quote-pick-card, .quote-view { min-width: 0; }
.pick-list { display: grid; gap: 8px; min-width: 0; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(2, 8, 23, .35); cursor: pointer; min-width: 0; min-height: 48px; }
.pick-row:has(input:checked) { border-color: rgba(52, 211, 153, .75); background: rgba(59, 130, 246, .12); }
.pick-row input { flex: none; width: 18px; height: 18px; accent-color: #3b82f6; }
.pw-blocked { opacity: .7; }
.pw-file-asks { display: grid; gap: 10px; }
.pick-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; } .pick-main strong { font-size: 15px; } .pick-who { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.pick-side { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; flex: 0 1 auto; max-width: 48%; }
.pick-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.pick-tag, .pick-new { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--border); color: var(--muted); }
.pick-new { background: rgba(52, 211, 153, .18); color: var(--success); }
.quote-view-doc { min-width: 0; max-width: 100%; overflow-x: hidden; }
.quote-view-actions .btn.primary { flex: 0 0 auto; }
.quote-view-actions .btn { white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; max-width: 100%; }
@media (min-width: 641px) { .quote-view-actions .btn.primary { flex: 0 1 auto; } }
/* Quote preview buttons: row 1 is Looks right, Edit, Download; Cancel (red) is last on a row of its own. On a phone Looks right is full width, Edit and Download sit side by side. */
.quote-view-actions { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; align-items: stretch; gap: 10px; }
.quote-view-actions .btn { min-height: 44px; min-width: 0; }
.quote-view-actions [data-quote-view="cancel"] { grid-column: 1 / -1; justify-self: start; min-width: 110px; }
@media (max-width: 640px) {
  .quote-view-actions { grid-template-columns: 1fr 1fr; justify-content: stretch; }
  .quote-view-actions .btn.primary, .quote-view-actions [data-quote-view="cancel"] { grid-column: 1 / -1; justify-self: stretch; }
  .quote-view-actions .btn { min-height: 48px; }
}
/* Cancel and Not now in chat cards: red outline on a faint red fill. The word says what it does, so colour is never the only cue. */
.chat-card .btn.danger { background: rgba(248, 113, 113, .12); border-color: var(--danger); color: var(--danger); font-weight: 650; }
.chat-card .btn.danger:hover:not(:disabled) { background: rgba(248, 113, 113, .24); }
.chat-card .btn.danger:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }
.chat-chip.danger { border-color: var(--danger); color: var(--danger); }
.send-options-more .linklike.danger-text { color: var(--danger); }
/* A way out of the chat: a quiet text link under the card's buttons, never one of them. */
.page-link { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: underline; }
.page-link:hover { color: var(--text); }
.open-link .btn { text-decoration: none; }

/* Download quote / Download invoice: a plain link that looks like a button. At least 44px to tap, on every screen. */
a.btn.dl-quote { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; text-decoration: none; white-space: normal; text-align: center; line-height: 1.25; max-width: 100%; }
a.btn.dl-quote svg { width: 16px; height: 16px; flex: none; }
a.btn.icon.dl-quote { width: 44px; min-width: 44px; padding: 0; }
.resolved-row .resolved-dl { margin-top: 8px; }
.pdf-note { margin: 0; font-size: .85rem; line-height: 1.4; overflow-wrap: anywhere; }
td a.btn.icon.dl-quote { vertical-align: middle; }

/* ---- Order-to-cash pass ---- */
/* Phones zoom the page when a field under 16px takes focus, and then the layout is off. Every field is 16px on touch devices and narrow screens. */
@media (pointer: coarse), (max-width: 900px) {
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), html body select, html body textarea, html body .input, html body .chat-input { font-size: 16px; }
}
.quote-public-askbtn { margin-top: 10px; width: 100%; min-height: 44px; }
.quote-public-ask { margin-top: 8px; padding-top: 4px; }
.quote-public-ask .notice { margin: 8px 0; }
.demo-badge { background: rgba(251, 191, 36, .12); border-color: #78561a; color: #fde68a; white-space: nowrap; }

/* Jobs: one card per customer job with a four-step track (one row at every width). */
.job-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.job-count { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border, #d8dde3); border-radius: 8px; font-size: 13px; min-width: 0; }
.job-count strong { font-size: 20px; }
.job-count.muted-count { color: var(--muted, #6b7280); border-style: dashed; }
.job-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.job-state.job-paid { color: var(--success, #2da44e); font-weight: 600; }
.job-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; container-type: inline-size; }
.job-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.job-who { min-width: 0; overflow-wrap: anywhere; }
.job-num { font-weight: 600; }
.job-total { font-weight: 600; }
.job-track { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.job-track li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 11px; line-height: 1.2; color: var(--muted, #6b7280); min-width: 0; overflow-wrap: anywhere; }
.job-step { min-width: 0; padding-right: 2px; }
/* Four short labels (Draft, Quote, Papers, Invoice) fit one row at every width, so the bar never needs a second row. */
.job-dot { width: 100%; height: 6px; border-radius: 3px; background: var(--border, #d8dde3); }
.job-track li.done .job-dot, .job-track li.now .job-dot { background: var(--accent, #1f6feb); }
.job-track li.now { color: inherit; font-weight: 600; }
.job-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-state { min-width: 0; overflow-wrap: anywhere; }
.job-card[data-tone=muted] .job-track li.now .job-dot { background: var(--muted, #6b7280); opacity: .6; }
.job-card[data-tone=bad] .job-track li.now .job-dot { background: var(--danger); }
.job-card[data-tone=bad] .job-state { color: var(--danger); }
.job-card[data-tone=attention] .job-track li.now .job-dot { background: var(--warning, #fbbf24); }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.job-actions .btn { min-height: 44px; display: inline-flex; align-items: center; }
.job-done > summary { cursor: pointer; padding: 8px 0; min-height: 40px; }
@media (max-width: 640px) {
  .job-list { grid-template-columns: minmax(0, 1fr); }
  .job-actions { width: 100%; flex-direction: column; }
  .job-actions .btn { flex: 1 1 auto; justify-content: center; }
}
.chat-camera { margin-left: -6px; }

/* With the keyboard open the full-height chat ends above it (--vvh is the visible height, set by lib/keyboard.js). */
html.kbd-open .shell:has(> .main > .fill) { height: var(--vvh, 100dvh); }
html.kbd-open .bottom-nav { display: none; }
.chat-card-receipt { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; } .receipt-thumb { max-width: 160px; }
.chat-camera-input { display: none; }
.quote-public-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 12px auto; padding: 12px 14px; max-width: 420px; text-align: left; border: 1px solid var(--border); border-radius: 12px; font-size: .95rem; }
.quote-public-facts dt { color: var(--muted); } .quote-public-facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.quote-public-dl { min-height: 46px; width: 100%; max-width: 420px; justify-content: center; margin: 4px auto 0; }
.details-toggle { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; } .details-toggle .btn { min-height: 44px; }
.chat-card-actions .btn { min-height: 44px; }

/* Paperwork: the driver papers card, the Jobs paperwork list, the next-step line under an answered card */
.papers-card .papers-contents { margin: 0; padding-left: 18px; }
.papers-card .papers-sds { gap: 8px; padding: 6px 0; border-top: 1px solid var(--border, #d8dde3); }
.papers-card .row.wrap, .papers-card .row.actions { flex-wrap: wrap; }
.papers-card .row.actions .btn { min-height: 44px; }
.job-paper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; font-size: 12px; line-height: 1.3; }
.job-paper li { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; padding-left: 8px; border-left: 3px solid var(--border, #d8dde3); }
.job-paper li.done { border-left-color: var(--success, #2da44e); }
.job-paper li.warn { border-left-color: var(--warning, #fbbf24); }
@container (max-width: 520px) { .job-paper { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.job-why { margin: 0; }
.next-step { margin-top: 4px; overflow-wrap: anywhere; }
.chat-card .resolved-dl { display: flex; gap: 8px; flex-wrap: wrap; }

/* Next step first: on a phone the buttons stack with the green one on top */
@media (max-width: 640px) { .page-head .row.actions, .papers-card .row.actions { flex-direction: column; align-items: stretch; width: 100%; } .page-head .row.actions .btn, .papers-card .row.actions .btn { width: 100%; justify-content: center; } }

/* The paperwork list: tick, review, one confirmation box */
.paperwork .pw-title { display: block; margin-bottom: 6px; overflow-wrap: anywhere; }
.pw-row { align-items: flex-start; }
.pw-row input { margin-top: 3px; }
.pw-row .pick-who { overflow-wrap: anywhere; }
.pw-detail { font-size: 13px; }
.pw-note { width: 100%; min-height: 64px; resize: vertical; }
.pw-ask { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); display: grid; gap: 6px; min-width: 0; }
.pw-ask-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; }
.pw-ask-row .input { flex: 1 1 100%; min-width: 0; }
.pw-ask-row textarea.input { resize: vertical; min-height: 56px; line-height: 1.4; font: inherit; }
.pw-made .pw-downloads { margin-top: 8px; }
.pw-made .chat-doc-frame { margin-top: 8px; }
@media (max-width: 640px) { .pw-ask-row .btn, .pw-made .pw-downloads .btn { width: 100%; min-height: 44px; justify-content: center; } }
.job-reminders { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.job-reminders li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.reminder-text { font-weight: 600; }
.quote-public-brand { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; min-width: 0; } .quote-public-brand strong { font-size: 1.05rem; overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 1099px) { .brand-logo.nav, .brand-logo.nav.wide { --lh: 36px; --lw: 48px; } .nav-brand.stacked { align-items: center; } }

/* ---------- Agents and System lists (messages-style rows), Operations switcher, back link ---------- */
.al h1 { margin: 0 0 2px; } .al > .muted { margin: 0 0 14px; font-size: .9rem; }
.al-list { display: flex; flex-direction: column; }
.al-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 4px; color: inherit; text-decoration: none; min-height: 64px; }
.al-row::after { content: ''; position: absolute; left: 62px; right: 0; bottom: 0; height: 1px; background: rgba(148, 163, 184, .18); }
.al-row:last-child::after { display: none; }
.al-row:active { background: var(--hover); }
.al-avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(59, 130, 246, .16); color: var(--accent); }
.al-avatar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.al-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.al-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; } .al-top strong { font-size: 1rem; }
.al-time { font-size: .74rem; color: var(--muted); flex: none; }
.al-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; min-width: 0; }
.al-preview { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.al-line.waiting .al-preview { color: var(--accent); font-weight: 600; }
.al-line .count { position: static; flex: none; }
.al-library { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 4px; color: var(--muted); text-decoration: none; font-size: .9rem; }
.al-library svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; } .al-library svg:last-child { margin-left: auto; transform: rotate(-90deg); }
.ops-switch { display: none; }
.agent-back { display: none; }
@media (max-width: 767px) {
  .ops-switch { display: flex; align-items: center; gap: 10px; position: sticky; top: var(--header-h); z-index: 19; padding: 8px 12px; background: var(--page); border-bottom: 1px solid var(--border); }
  .ops-switch[hidden] { display: none; }
  .shell:has(.ops-switch:not([hidden])) { grid-template-rows: var(--header-h) auto minmax(0, 1fr); }
  .ops-switch-label { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; flex: none; }
  .ops-switch-pick { position: relative; flex: 1; min-width: 0; }
  .ops-switch-pick select { width: 100%; appearance: none; -webkit-appearance: none; background: var(--input); color: var(--text, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 10px 38px 10px 14px; font: inherit; font-weight: 600; font-size: .95rem; }
  .ops-switch-pick svg { position: absolute; right: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); pointer-events: none; stroke: var(--muted); fill: none; stroke-width: 2; }
  .agent-back { display: inline-flex; align-items: center; gap: 2px; padding: 6px 8px 6px 0; color: var(--accent); text-decoration: none; font-weight: 600; font-size: .95rem; }
  .agent-back svg { width: 20px; height: 20px; transform: rotate(90deg); stroke: currentColor; fill: none; stroke-width: 2.2; }
}

/* ---- Phone: the agent chat is a full-screen conversation (like iMessage/WhatsApp): no app bar, no bottom tabs, a slim "waiting" strip,
   the back arrow and conversations button live in the chat's own header, and the composer is never squeezed by the keyboard. ---- */
.chat-up { display: none; }
@media (max-width: 767px) {
  body.chat-on .header, body.chat-on .bottom-nav, body.chat-on .agent-back { display: none; }
  body.chat-on .shell { grid-template-rows: minmax(0, 1fr); padding-bottom: 0; }
  body.chat-on .shell > .main { padding: 0; grid-column: 1; grid-row: 1; }
  body.chat-on .agent-page.fill { gap: 0; }
  body.chat-on .chat-wrap { gap: 0; }
  body.chat-on .chat-main, body.chat-on .chat-side { border: 0; border-radius: 0; }
  body.chat-on .chat-side { padding: 12px; padding-top: calc(12px + env(safe-area-inset-top)); }
  body.chat-on .chat-head { padding: 8px 8px 8px 4px; padding-top: calc(8px + env(safe-area-inset-top)); gap: 8px; background: var(--card); }
  body.chat-on .chat-up { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; color: var(--accent); }
  body.chat-on .chat-up svg { width: 22px; height: 22px; transform: rotate(90deg); stroke: currentColor; fill: none; stroke-width: 2.4; }
  body.chat-on .chat-back { order: 9; width: 40px; height: 40px; display: grid; place-items: center; }
  body.chat-on .chat-pill { display: none; }
  body.chat-on .wait-banner { border-width: 0 0 1px; border-radius: 0; padding: 4px 12px; font-size: .85rem; gap: 8px; }
  body.chat-on .wait-banner .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  body.chat-on .wait-open { min-height: 36px; }
  body.chat-on .chat-stage { padding: 12px; }
  body.chat-on .chat-foot { padding: 8px 10px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  body.chat-on .chat-input { font-size: 16px; }
  body.chat-on .toasts { bottom: 84px; }
  .badge { font-size: .72rem; }
  .rel-time, .chat-card-kind, .chat-card-pill, .docp-k, .docp-owner-k, .chat-stamp, th { font-size: max(.72rem, 11.5px); }
  .chat-link, .chat-card a { padding: 6px 0; display: inline-block; }
}
.chat-side-back { display: none; }
@media (max-width: 767px) {
  body.chat-on .chat-side-back { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; min-height: 40px; color: var(--accent); text-decoration: none; font-weight: 600; }
  body.chat-on .chat-side-back svg { width: 20px; height: 20px; transform: rotate(90deg); stroke: currentColor; fill: none; stroke-width: 2.4; }
  body.chat-on .wait-banner { padding-top: calc(4px + env(safe-area-inset-top)); }
}
@media (max-width: 767px) {
  /* Lists: the search box gets its own full-width row, then the filter and CSV share the next one, so records start higher up the screen. */
  .toolbar { gap: 8px; padding: 10px 12px; }
  .toolbar .input[type="search"], .toolbar input.input:not([type="date"]):not([type="month"]) { flex: 1 1 100%; max-width: none; min-width: 0; }
  .toolbar select.input, .toolbar select { flex: 1 1 130px; min-width: 130px; }
  /* The red "needs a decision" bar sits in the card's edge instead of over its first label. */
  table.tstack tr.flag > :first-child, table.tstack.twide tr.flag > :first-child { padding-left: 14px; }
}
@media (max-width: 767px) {
  /* Record rows: number, who, status and amount; tap for the rest. */
  table.tstack tr.rowc { padding-bottom: 4px; }
  table.tstack tr.rowc:not(.open) > td:not([data-keep]) { display: none; }
  table.tstack tr.rowc td { padding: 4px 0; }
  table.tstack tr.rowc::after { display: block; content: 'Show details'; text-align: center; color: var(--muted); font-size: .78rem; font-weight: 600; padding: 6px 0 4px; }
  table.tstack tr.rowc.open::after { content: 'Hide details'; }
}
.field-error { color: var(--danger); font-weight: 600; margin: 8px 0 0; } .field-error[hidden] { display: none; }
@media (max-width: 767px) {
  /* A long card keeps its OK / Not yet buttons in reach while you read it. */
  .chat-card:has(.chat-card-actions) .chat-card-actions { position: sticky; bottom: -1px; z-index: 2; padding: 10px 0 2px; background: linear-gradient(180deg, transparent, var(--card, #0b1424) 22%); }
}
@media (max-width: 767px) {
  /* Command Center: what needs your OK first, then numbers two to a row. */
  .stack > .page-head { order: -4; } .stack > .setup-slot { order: -3; } .stack > .owner-wait { order: -2; } .stack.loose > .owner-wait { order: -1; }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.cols-4 > .stat { padding: 12px; min-width: 0; }
  .grid.cols-4 .stat .label { font-size: .72rem; letter-spacing: .03em; line-height: 1.25; }
  .grid.cols-4 .stat .value { font-size: 1.35rem; }
  .grid.cols-4 .stat .sub { font-size: .76rem; line-height: 1.3; }
}
@media (max-width: 767px) {
  /* A preview of several records reads as short lines (name first, then the details), not one tall form per record. */
  .chat-card-table.tstack { font-size: .85rem; }
  .chat-card-table.tstack tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 9px 0; }
  .chat-card-table.tstack td { display: inline-flex; gap: 5px; padding: 0; align-items: baseline; text-align: left; }
  .chat-card-table.tstack td[data-label]::before { flex: none; max-width: none; text-transform: none; letter-spacing: 0; font-size: .74rem; color: var(--muted); font-weight: 500; }
  .chat-card-table.tstack td[data-label]::before { content: attr(data-label); }
  .chat-card-table.tstack td:first-child { flex: 0 0 100%; font-weight: 650; }
  .chat-card-table.tstack td:first-child::before { display: none; }
}
.linklike { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 640px) {
  /* A record's actions: the main one full width, the rest two to a row, so the details start high on the screen. */
  .page-head .row.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .page-head .row.actions > .btn.primary, .page-head .row.actions > a.primary, .page-head .row.actions > .field { grid-column: 1 / -1; }
  .page-head .row.actions > .btn { padding-left: 10px; padding-right: 10px; min-width: 0; }
}
@media (max-width: 767px) {
  /* Line items on a quote or invoice read as: description, then quantity, unit, price and amount on one wrapped line. */
  .print-doc table.tstack tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 8px 0; }
  .print-doc table.tstack td { display: inline-flex; gap: 5px; padding: 0; text-align: left; }
  .print-doc table.tstack td[data-label]::before { flex: none; max-width: none; text-transform: none; letter-spacing: 0; font-size: .74rem; font-weight: 500; }
  .print-doc table.tstack td:first-child { flex: 0 0 100%; font-weight: 650; }
  .print-doc table.tstack td:first-child::before { display: none; }
  .print-doc table.tstack td:last-child { margin-left: auto; font-weight: 650; }
}
@media (max-width: 767px) {
  /* Coding a ticket: the field and its Apply tick on one line, what it is now underneath, the new value full width. */
  table.coding-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
  table.coding-table td { display: block; padding: 0; text-align: left; border: 0; }
  table.coding-table td:nth-child(1) { grid-column: 1; font-weight: 650; }
  table.coding-table td:nth-child(1)::before, table.coding-table td:nth-child(3)::before { display: none; }
  table.coding-table td:nth-child(4) { grid-column: 2; grid-row: 1; justify-self: end; }
  table.coding-table td:nth-child(2) { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; display: flex; gap: 6px; }
  table.coding-table td:nth-child(2)::before { flex: none; max-width: none; text-transform: none; letter-spacing: 0; font-size: .85rem; }
  table.coding-table td:nth-child(3) { grid-column: 1 / -1; }
  table.coding-table td:nth-child(3) .input, table.coding-table td:nth-child(3) select { width: 100%; }
}
@media (max-width: 767px) {
  table.coding-table td:nth-child(4)::before { display: none; }
  table.coding-table td:nth-child(4) .field > label:not(:has(input)), table.coding-table td:nth-child(3) .field > label:not(:has(input)) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (max-width: 767px) {
  /* Quote / order lines in a form: description on its own row, then quantity, unit and price side by side. */
  table.lines-ed tbody tr { display: grid; grid-template-columns: 0.8fr 0.8fr 1.2fr auto; gap: 6px 8px; padding: 10px 0; align-items: end; }
  table.lines-ed td { display: block; padding: 0; border: 0; }
  table.lines-ed td::before { display: block !important; max-width: none !important; margin-bottom: 3px; text-align: left; }
  table.lines-ed td:nth-child(1) { grid-column: 1 / -1; }
  table.lines-ed td:nth-child(5) { grid-column: 4; grid-row: 2; }
  table.lines-ed td:nth-child(5)::before { display: none !important; }
  table.lines-ed td .input { width: 100%; min-width: 0; }
}
.chat-back-label { display: none; }
@media (max-width: 767px) {
  body.chat-on .chat-back { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; border-radius: 999px; background: rgba(255, 255, 255, .06); font-weight: 600; font-size: .85rem; }
  body.chat-on .chat-back-label { display: inline; }
  body.chat-on .chat-back svg { width: 18px; height: 18px; }
}
.chat-side-title { display: none; }
@media (max-width: 767px) { body.chat-on .chat-side-title { display: flex; align-items: center; gap: 12px; padding: 2px 2px 4px; } body.chat-on .chat-side-title strong { font-size: 1.15rem; } }

/* File cards in chat: a peek at the first lines, then name, type and size (like a document attachment in a chat app). */
.file-card { position: relative; display: flex; flex-direction: column; width: 176px; max-width: 100%; border-radius: 14px; overflow: hidden; background: rgba(0, 0, 0, .22); border: 1px solid rgba(255, 255, 255, .1); color: inherit; text-decoration: none; box-sizing: border-box; flex: none; }
a.file-card:hover { border-color: rgba(110, 231, 183, .45); }
.file-card-peek { height: 96px; padding: 9px 10px; overflow: hidden; background: rgba(255, 255, 255, .04); display: grid; align-content: start; position: relative; }
.file-card-peek.has-text::after { content: ''; position: absolute; inset: auto 0 0 0; height: 34px; background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, .75)); }
.file-card-line { font: 500 .62rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.file-card-big { display: grid; place-items: center; height: 78px; color: #93c5fd; } .file-card-big svg { width: 34px; height: 34px; }
.file-card-foot { display: grid; gap: 1px; padding: 8px 10px 9px; border-top: 1px solid rgba(255, 255, 255, .08); min-width: 0; }
.file-card-name { font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card-meta { font-size: .72rem; color: var(--muted); } .file-card-meta b { color: #93c5fd; font-weight: 700; letter-spacing: .04em; } .bubble.user .file-card-meta { color: inherit; opacity: .8; } .bubble.user .file-card-meta b { color: inherit; }
.file-card .chat-file-x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; background: rgba(15, 23, 42, .85); color: #fff; z-index: 2; } .file-card .chat-file-x svg { width: 12px; height: 12px; }
.file-card-state { position: absolute; left: 10px; top: 8px; font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: rgba(15, 23, 42, .85); z-index: 2; }
.chat-file.file-card { border: 1px solid var(--border); } .chat-file.file-card.uploading { opacity: .8; } .chat-file.file-card.failed { border-color: #f87171; }
.file-card .tile-err.inline { position: absolute; left: 8px; top: 8px; z-index: 2; }
.bubble.has-media .bubble-files { align-items: flex-start; }
.chat-pending { max-height: none; overflow: visible; } .chat-file.file-card { width: 168px; } .chat-file.file-card .file-card-peek { height: 70px; padding: 7px 9px; } .chat-file.file-card .file-card-big { height: 54px; }
.chat-file.file-card .file-card-peek { padding-right: 32px; }
@media (max-width: 767px) {
  /* The pinned OK / Not yet bar is one slim row so it hides as little of the list as possible. */
  .chat-card:not(.chat-ui):has(.chat-card-actions) .chat-card-actions { flex-direction: row; flex-wrap: nowrap; align-items: stretch; gap: 8px; padding: 8px 0 4px; background: var(--card, #0b1424); border-top: 1px solid var(--border); }
  .chat-card:not(.chat-ui):has(.chat-card-actions) .chat-card-actions .btn:not(.small) { width: auto; min-height: 46px; justify-content: center; }
  .chat-card:not(.chat-ui):has(.chat-card-actions) .chat-card-actions .btn.primary { flex: 1 1 auto; } .chat-card:not(.chat-ui):has(.chat-card-actions) .chat-card-actions .btn:not(.small):not(.primary) { flex: 0 0 auto; min-width: 92px; }
}
@media (max-width: 767px) {
  /* Only a card still waiting for an answer pins its buttons; a confirmation (Undo) stays plain. */
  .chat-card:not(.chat-ui):has(.chat-card-actions):not(:has(.chat-card-actions .btn.primary)) .chat-card-actions { position: static; background: none; border-top: 0; padding: 8px 0 0; }
}
@media (max-width: 767px) { .chat-card:not(.chat-ui):has(.chat-card-actions .btn.primary) .chat-card-actions { background: color-mix(in srgb, #3b82f6 7%, #0b1424); margin: 0 -2px; padding-left: 2px; padding-right: 2px; } }
.chat-chip.on { border-color: #3b82f6; background: rgba(59, 130, 246, .16); color: #93c5fd; }
.qp-head { margin-top: 12px; } .qp-list { display: grid; gap: 6px; margin: 8px 0 12px; }
.qp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(0, 0, 0, .12); } .qp-row.on { border-color: rgba(59, 130, 246, .55); }
.qp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .9rem; } .qp-name small { color: var(--muted); font-weight: 400; }
.qp-step { display: inline-flex; align-items: center; gap: 4px; flex: none; } .qp-step b { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.qp-step button { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, .05); color: inherit; font-size: 1.15rem; cursor: pointer; } .qp-step button:disabled { opacity: .35; cursor: default; }
.chat-card.chat-ui { min-width: 0; } .chat-card.chat-ui .qp-list, .chat-card.chat-ui .quote-pick { min-width: 0; }
.qp-list { grid-template-columns: minmax(0, 1fr); } .qp-row { min-width: 0; box-sizing: border-box; }
.qp-name { white-space: normal; line-height: 1.25; }
/* A preview with a table of rows gets room to show every column on a laptop. */
@media (min-width: 768px) { .chat-card:has(table) { width: min(100%, 880px); } .chat-card table td, .chat-card table th { white-space: normal; vertical-align: top; } }
/* The quote start card keeps its buttons below the list, never pinned over it. */
.chat-card.chat-ui[data-ui="quote_request"] .chat-card-actions { position: static; background: none; border: 0; padding: 4px 0 0; flex-direction: row; flex-wrap: wrap; gap: 8px; }
.chat-card.chat-ui[data-ui="quote_request"] .chat-card-actions .btn { width: auto; min-height: 46px; justify-content: center; }
.chat-card.chat-ui[data-ui="quote_request"] .chat-card-actions .btn.primary { flex: 1 1 100%; } .chat-card.chat-ui[data-ui="quote_request"] .chat-card-actions .btn:not(.primary) { flex: 1 1 100%; }
.chat-card.chat-ui[data-ui="quote_request"] .chat-card-actions .btn.primary[disabled] { background: rgba(59, 130, 246, .25); color: rgba(255, 255, 255, .7); }
.qp-label { margin-top: 6px; } .qp-list { margin: 4px 0 8px; } .chat-card.chat-ui[data-ui="quote_request"] .quote-pick { margin: 2px 0 6px; }
.terms-batch { gap: 14px; } .terms-batch-title { font-size: 1.05rem; } .terms-batch-q { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .08); } .terms-batch-q > strong { font-size: .95rem; }
.terms-batch .chat-chip.on { border-color: #3b82f6; background: rgba(59, 130, 246, .16); color: #93c5fd; }
.terms-batch .chat-card-actions .btn { width: 100%; justify-content: center; }
.terms-batch input.input { width: 100%; box-sizing: border-box; min-height: 44px; }
/* The all-in-one question card is a form: its Continue button sits at the end instead of floating over the questions. */
.chat-card.terms-batch .chat-card-actions { position: static !important; background: none !important; border-top: 0 !important; padding: 4px 0 0 !important; margin: 0 !important; }
@media (max-width: 767px) { .terms-batch .terms-fields { grid-template-columns: minmax(0, 1fr) !important; } }

/* Saved quote card: Send is the one big button; Download and Cancel sit side by side below it. Nothing is pinned, so the card title is never covered. */
.chat-card.quote-card .chat-card-actions { position: static !important; background: none !important; border-top: 0 !important; margin: 0 !important; padding: 8px 0 0 !important; flex-direction: row !important; flex-wrap: wrap !important; gap: 8px !important; }
.chat-card.quote-card .chat-card-actions .btn { width: auto !important; min-height: 44px; justify-content: center; flex: 1 1 calc(50% - 4px) !important; min-width: 0 !important; }
.chat-card.quote-card .chat-card-actions .btn.primary { flex: 1 1 100% !important; min-height: 48px; }
.chat-card.quote-card .chat-card-actions .btn.danger { background: transparent; }

/* An approval with three buttons (Send this quote, Download quote, Not yet): Send takes the first row, the other two share the second, so nothing runs off a phone screen. */
@media (max-width: 767px) {
  .chat-card:not(.chat-ui):has(.chat-card-actions > :nth-child(3)) .chat-card-actions { flex-wrap: wrap; }
  .chat-card:not(.chat-ui):has(.chat-card-actions > :nth-child(3)) .chat-card-actions .btn.primary { flex: 1 1 100%; }
  .chat-card:not(.chat-ui):has(.chat-card-actions > :nth-child(3)) .chat-card-actions .btn:not(.small):not(.primary) { flex: 1 1 calc(50% - 4px); min-width: 0; }
}

/* Card header: what it is on the left and its status on the right, then the title gets the full width (no more title squeezed beside the badge on a phone). */
.chat-card-kindrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.chat-card-kindrow .chat-card-kind { min-width: 0; }
.chat-card-kindrow .chat-card-pill { flex: none; white-space: nowrap; }
.chat-card-head strong { font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }

/* The quote questions are a stepper: one question at a time in the one card, progress and Back on top, quiet links at the bottom. */
.terms-batch { gap: 10px; }
.terms-batch .terms-steprow { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.terms-batch .terms-steprow [hidden] { display: none; }
.terms-batch .terms-progress { margin-left: auto; white-space: nowrap; }
.terms-batch .terms-batch-q[hidden] { display: none; }
.terms-batch .terms-batch-q { border-top: 0; padding-top: 0; } .terms-batch .terms-batch-q > strong { font-size: 1.02rem; outline: none; }
.terms-batch .chat-chip, .terms-batch .terms-chips .chat-chip { min-height: 44px; touch-action: manipulation; }
.terms-batch .btn.terms-next { min-height: 48px; } .terms-batch .btn.terms-next[hidden] { display: none; }
.terms-batch .linklike { color: var(--muted, #6b7280); text-decoration: underline; background: none; border: 0; padding: 0 6px; font: inherit; font-size: .88rem; cursor: pointer; min-height: 44px; text-align: left; }
.terms-batch .linklike:disabled { opacity: .5; cursor: default; } .terms-batch .terms-back { color: var(--accent); text-decoration: none; font-weight: 600; margin-left: -6px; }
.terms-batch .terms-quiet { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; } .terms-batch .terms-quiet [hidden] { display: none; }
/* Invoice result card: ticket, contract and invoice side by side, then the choices. */
.dec-card { display: grid; gap: 10px; min-width: 0; }
.dec-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--border, #d4d4d8); border-radius: 10px; }
.dec-table { width: 100%; min-width: 520px; font-size: 13px; }
.dec-table td, .dec-table th { white-space: nowrap; }
.dec-table td:first-child, .dec-table th:first-child { white-space: normal; min-width: 110px; }
.dec-table .dec-bad { color: var(--danger); font-weight: 600; background: color-mix(in srgb, var(--danger) 12%, transparent); }
.dec-table tfoot th { border-top: 1px solid var(--border, #d4d4d8); }
.dec-choices { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dec-choices .btn, .dec-card .next-go .btn { min-height: 44px; justify-content: center; text-align: center; white-space: normal; }
@media (max-width: 640px) { .dec-choices { grid-template-columns: 1fr; } }
.next-go { margin-top: 8px; } .next-go .btn { width: 100%; min-height: 44px; justify-content: center; }

/* PO number: the "none sent" mark and the continue-or-wait card */
.po-none { color: var(--warn, #f59e0b); font-weight: 600; }
.chat-card.po-check { display: flex; flex-direction: column; gap: 10px; }
.chat-card.po-check .chat-card-actions { position: static !important; background: none !important; border-top: 0 !important; margin: 0 !important; padding: 0 !important; flex-direction: row !important; flex-wrap: wrap !important; gap: 8px; }
.chat-card.po-check .chat-card-actions .btn { width: auto !important; min-height: 46px; justify-content: center; flex: 1 1 calc(50% - 4px) !important; min-width: 0 !important; }
.chat-card.po-check .chat-card-actions .btn.primary { flex: 1 1 100% !important; }
.po-check-done { display: flex; gap: 6px; align-items: baseline; font-weight: 600; }

.mail-preview{border:1px solid var(--border,#2a3547);border-radius:12px;padding:10px 12px;margin:8px 0}
.mail-preview .chat-card-kv{margin:0 0 8px}
.mail-preview-body{white-space:pre-wrap;word-break:break-word;font-size:.92rem;line-height:1.45;border-top:1px solid var(--border,#2a3547);padding-top:8px}

.pw-made .pw-downloads{margin:10px 0 6px}
.pw-made .pw-more{margin-top:8px}
.pw-made .pw-more summary,.pw-made .pw-notes summary{cursor:pointer;padding:6px 0}
.pw-made .pw-notes{margin:10px 0;padding:8px 12px;border:1px solid var(--border,#2a3547);border-radius:10px}
.pw-made .pw-notes>*+*{margin-top:8px}
.pw-made .pw-ask{margin-top:12px}

/* Operator lists: the two filters each get their own row on a phone so "Open exceptions" is never cut off. */
@media (max-width: 480px) { .toolbar select.input, .toolbar select { flex: 1 1 100%; min-width: 0; } }
.chat-send.stop .icon-svg { fill: currentColor; stroke-linejoin: round; }

/* One card with a button at a time: a card that steps aside leaves one quiet line (see lib/one-card.js). */
.chat-card[data-queued="1"] { display: none; }
[data-next-hidden="1"] .next-go { display: none; }
.chat-queued { padding: 0.5rem 0.75rem; border: 1px dashed var(--line, rgba(255,255,255,0.14)); border-radius: 12px; }

/* ---------- accessibility and device quality ---------- */
/* Root size is a percentage (15px at the usual 16px) so the person's own text-size setting scales the whole app, and 200% still fits. */
a, button, input, select, textarea, label, summary, [role="button"], [role="tab"] { touch-action: manipulation; } /* no double-tap zoom delay */
.skip-link { position: fixed; left: 12px; top: -64px; z-index: 200; background: var(--accent-fill); color: var(--on-accent); font-weight: 700; padding: 10px 16px; border-radius: var(--radius-sm); text-decoration: none; }
.skip-link:focus, .skip-link:focus-visible { top: calc(8px + env(safe-area-inset-top, 0px)); text-decoration: none; }
h1.chat-name { margin: 0; font-size: inherit; font-weight: 700; letter-spacing: 0; line-height: inherit; display: block; }
/* A link inside a sentence must not rely on colour alone. */
p a, dd a, li a, .sub a, .hint a, .notice a, .small a:not(.btn):not(.chat-card-link) { text-decoration: underline; text-underline-offset: 2px; }
.bubble.user .msg-time { opacity: .85; }
.bubble.user .chat-link { text-decoration: underline; }
/* Windows high contrast and forced colours keep the focus ring and the tab marker visible. */
@media (forced-colors: active) { .tab[aria-selected="true"] { border-bottom-color: Highlight; } .input:focus { outline: 2px solid Highlight; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
/* Sticky header cells hide the first rows from a keyboard user scrolling into view. */
html { scroll-padding-top: calc(var(--header-h) + 12px); scroll-padding-bottom: calc(var(--bottom-h) + 12px); }
/* Long names (companies, vendors, files, emails) wrap inside their box instead of pushing the page sideways. */
.card, .page-head h1, .page-head .sub, .stat .value, .stat .sub, td, th, dd, .job-cust, .chat-card, .bubble { overflow-wrap: anywhere; }
.page-head a.small { display: inline-flex; align-items: center; min-height: 32px; }

/* Phones and touch screens: every control is at least 44 by 44. */
@media (pointer: coarse), (max-width: 767px) {
  .btn, .btn.small, .tab, .auth-tab, .pager .btn { min-height: 44px; }
  .btn.icon, .btn.small.icon, .header .btn.icon, .header .btn.ghost { min-width: 44px; min-height: 44px; }
  .btn.icon, .btn.small.icon, .header .btn.icon { width: 44px; }
  label.check, .pick-row { min-height: 44px; }
  table.tstack td a:not(.btn), .session-row a, .setup-manual, .card-head a, .afe-line a, .toolbar a, a.job-num, .page-head a.small, .linklike, .chat-link, .wait-open, .chat-card-link, .setup-steps a, .job-actions a, .quote-quiet-links a, .quote-quiet-links .linklike, .send-options-more .linklike { display: inline-flex; align-items: center; min-height: 44px; }
  .chat-link { display: inline; min-height: 0; padding: 0; } /* inside a sentence */
  .chat-clip, .chat-send { width: 44px; height: 44px; min-height: 44px; }
  .chat-input { min-height: 44px; }
  .chat-del, .chat-up, .chat-back, .lb-close, .lb-open { min-width: 44px; min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; }
  table.t th.sortable { height: 44px; }
  .ops-switch select, .ops-switch-pick select { min-height: 44px; }
  .menu-pop button, .menu-pop a { min-height: 48px; }
}
/* iPhone: the bars stay clear of the notch, the rounded corners and the home bar, also when the phone is turned sideways. */
@supports (padding: max(0px)) {
  :root { --header-h: calc(54px + env(safe-area-inset-top, 0px)); }
  .header { padding-top: env(safe-area-inset-top, 0px); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .bottom-nav { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .toasts { right: max(16px, env(safe-area-inset-right)); }
  dialog.modal { max-height: calc(90dvh - env(safe-area-inset-bottom, 0px)); }
}
.quote-public, .quote-public * { overflow-wrap: anywhere; }
.quote-public-line > div:first-child { min-width: 0; flex: 1 1 auto; }
.quote-public-terms { grid-template-columns: max-content minmax(0, 1fr); }
.quote-public-amt { flex: none; }
.quote-public .btn, .btn.wrap { white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; max-width: 100%; }
@media (pointer: coarse), (max-width: 767px) {
  body.chat-on .wait-open, .owner-wait a:not(.btn), .pad > a, .card > a.small, .job-head a.small, .card-head a.small { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (pointer: coarse), (max-width: 767px) {
  details > summary { display: flex; align-items: center; min-height: 44px; }
  .card > p + a, .card > a:not(.btn):not(.stat), .stack > a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; }
}
/* Bottom tab bar: labels wrap instead of pushing the bar wider than the screen, and stop growing past 12.5px so four tabs always fit at 200% text. */
.bottom-nav a, .bottom-nav button { min-width: 0; padding: 0 2px; text-align: center; line-height: 1.15; overflow-wrap: anywhere; font-size: min(.68rem, 12.5px); }
.tap-check { justify-content: center; }
.setup-steps { grid-template-columns: minmax(0, 1fr); } .setup-steps li { min-width: 0; } .setup-actions { flex-wrap: wrap; row-gap: 4px; } .setup-text { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 640px) { .setup-actions { flex: 1 1 100%; } }
/* ---------- offline notice ---------- */
.offline-bar { position: fixed; left: 0; right: 0; top: 0; z-index: 120; padding: 8px 16px; text-align: center; font-size: .85rem; background: #3b2f06; color: #fde68a; border-bottom: 1px solid #854d0e; }

/* Short links under the sign-in and sign-up forms and on the public quote page. */
.legal-links { text-align: center; margin: 14px 0 0; }
.legal-links a { display: inline-block; padding: 12px 6px; text-decoration: underline; text-underline-offset: 2px; }
.legal-agree { margin: 4px 0 0; }
.legal-agree a { text-decoration: underline; text-underline-offset: 2px; }

/* Codes and amounts in a card's table stay on one line: "$5,640.00" and "CFX200-55D" never break in the middle. */
.chat-card-table td.nw, .chat-card-table th { white-space: nowrap; overflow-wrap: normal; word-break: keep-all; }
.chat-card-table td:not(.nw) { min-width: 150px; }

.dec-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 2px; }
.dec-pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid transparent; }
.dec-pill.ok { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.dec-pill.warn { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.dec-pill.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.dec-why { font-size: 12px; font-weight: 500; margin-top: 2px; }
.dec-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; margin-top: 8px; border-radius: 8px; background: color-mix(in srgb, var(--text) 6%, transparent); font-size: 13px; }
.dec-sum strong.dec-bad { color: var(--danger); background: none; }

/* Settings > Plan and billing: the current plan stands out, each card's button sits at its foot, notices hold their own action. */
.plan .card { display: flex; flex-direction: column; gap: 8px; }
.plan .card > .row { justify-content: space-between; min-height: 28px; }
.plan .card > .row h2 { margin: 0; }
.plan .card > .btn { margin-top: 4px; align-self: flex-start; }
.plan .card > .plan-allow { margin: auto 0 0; padding-top: 10px; border-top: 1px solid var(--border); }
.plan .card > .plan-unlimited { font-weight: 700; color: var(--accent); }
.plan .card > .plan-unlimited::before { content: '\221E\00a0'; }
.plan .card.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan .notice p { margin: 0; }
.plan .notice p + p { margin-top: 10px; }
/* ---- Logistics OS screens ---- */
.chat-layout { grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .chat-layout { grid-template-columns: 280px minmax(0, 1fr); } }
.chat-thread { min-height: 120px; }
.chat-msg { display: flex; flex-direction: column; gap: 8px; }
.chat-msg.user { align-items: flex-end; }
.chat-msg.assistant { align-items: stretch; }
.chat-bubble { max-width: 92%; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.user .chat-bubble { background: var(--accent-bg, rgba(59, 130, 246, .18)); }
.chat-card { overflow-wrap: anywhere; }
.setup-steps .setup-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0; }
.setup-steps .setup-link { display: flex; align-items: flex-start; gap: 8px; flex: 1 1 280px; min-width: 0; text-decoration: none; color: inherit; }
.setup-steps .setup-link svg { flex: none; margin-top: 2px; }
.setup-steps .setup-row .btn { flex: none; }
.hidden { display: none !important; }

/* AI agent call-to-action buttons are blue like the rest of the app. */
.btn.agent { background: var(--agent-fill); border-color: var(--agent-fill); color: var(--on-accent); font-weight: 650; }
.btn.agent:hover:not(:disabled) { filter: brightness(1.08); }
.btn.agent svg { stroke: currentColor; }
.agent-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid rgba(34, 197, 94, .45); border-radius: 14px; background: rgba(34, 197, 94, .08); }
.agent-cta p { margin: 0; flex: 1; min-width: 180px; }
.chat-card { border-color: rgba(59, 130, 246, .45); }

/* Cards the agent shows in the chat: one question with tap choices, and the file box. */
.ask-card { display: grid; gap: 10px; }
.ask-card .chat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-card .ask-free { display: flex; gap: 8px; align-items: center; }
.ask-card .ask-free .input { flex: 1; min-width: 0; }
.pay-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 12px; }
.pay-fields label { gap: 4px; }
.upload-drop { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px; border: 1.5px dashed rgba(59, 130, 246, .55); border-radius: 12px; margin-top: 8px; }

/* Load cards on the Command Center: who and how much, the lifecycle bar, the next step. */
.job-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.job-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.job-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.job-who { min-width: 0; overflow-wrap: anywhere; }
.job-num { font-weight: 600; color: var(--success, #2da44e); }
.job-total { font-weight: 600; }
.job-track { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.job-track li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 11px; line-height: 1.2; color: var(--muted, #6b7280); min-width: 0; overflow-wrap: anywhere; }
.job-dot { width: 100%; height: 6px; border-radius: 3px; background: var(--border, #d8dde3); }
.job-track li.done .job-dot { background: var(--success, #2da44e); }
.job-track li.now .job-dot { background: var(--warning, #fbbf24); }
.job-track li.now { color: inherit; font-weight: 600; }
.job-note { border-left: 3px solid var(--warning, #fbbf24); padding-left: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.job-note.bad { border-left-color: var(--danger, #f85149); }
.job-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-foot .btn { min-height: 44px; }
.job-track.steps-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.job-track.steps-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 520px) { .job-track.steps-7 { gap: 4px; } .job-track.steps-7 li { font-size: 9.5px; overflow-wrap: normal; } }
.job-track.steps-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.job-notes { display: flex; flex-direction: column; gap: 8px; }
.job-notes .job-note:not(:first-child) { font-size: .92em; }
.job-note.ok { border-left-color: var(--success, #2da44e); }
.tick-row { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.tick-row input { width: 20px; height: 20px; flex: none; }

/* The load screen: one summary, the papers and the invoice up front, everything else folded. */
.load-section > summary, .load-add > summary, .load-more > summary { cursor: pointer; list-style: none; min-height: 40px; display: flex; align-items: center; }
.load-section > summary::-webkit-details-marker, .load-add > summary::-webkit-details-marker, .load-more > summary::-webkit-details-marker { display: none; }
.load-section[open] > summary { margin-bottom: 12px; }
.load-paper { display: flex; flex-direction: column; gap: 4px; }
.load-add { margin-top: 12px; }
.load-add[open] > summary { margin-bottom: 8px; }
.load-more { padding: 4px 4px 24px; }
.load-more[open] > summary { margin-bottom: 8px; }
.load-section > summary::after, .load-add > summary::after { content: '›'; margin-left: auto; font-size: 20px; line-height: 1; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
.load-section[open] > summary::after, .load-add[open] > summary::after { transform: rotate(-90deg); }
/* Free AI actions left, shown on the plan page while the company is on the free trial. */
.ai-meter { display: grid; gap: 6px; max-width: 520px; }
.ai-meter .progress { height: 6px; }
.ai-meter-note { margin: 0; color: var(--warning); }
.plan-work { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.plan-work li.plan-had { font-weight: 600; }
.plan-work li.plan-had + li.plan-new { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); list-style-position: outside; }
.plan-work li.plan-new { font-weight: 600; }

/* Command Center numbers when there are five cards: equal widths, never one card alone on a row at laptop width.
   Laptop: all five in one row. Tablet: rows of three. Phone: two to a row, the fifth card full width. */
.grid.cols-4.stats-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1200px) { .grid.cols-4.stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 767px) { .grid.cols-4.stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-4.stats-5 > .stat:last-child { grid-column: 1 / -1; } }

/* Six numbers (a Broker with carrier extras): rows of three, equal widths, two to a row on a phone. */
.grid.cols-4.stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 767px) { .grid.cols-4.stats-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* The first conversation has the whole width: the list, its search, tabs and the blue New chat button come back with the second one. A quiet New chat icon stays in the header. */
/* First-win card: one green button, a drop area, two quiet choices. */
.first-win-drop { display: grid; gap: 8px; justify-items: stretch; text-align: center; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; }
.first-win-drop.dropping { border-color: var(--agent-fill, #15803d); background: var(--hover); }
.first-win-drop .btn { min-height: 44px; justify-content: center; }
.first-win-quiet { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.first-win-quiet .btn { min-height: 44px; }
@media (max-width: 640px) { .first-win-quiet .btn { flex: 1 1 100%; } }
.bubble-with-note { display: grid; gap: 2px; justify-items: end; }
.bubble-with-note .attached-note { padding-right: 6px; }
/* Approve and Decline on an approval card are at least 44px tall at every width (they were 32px on a laptop). */
.chat-card .row > .btn.small { min-height: 44px; }
/* A card that was answered and replaced by its confirmation leaves nothing behind (the card style would otherwise override [hidden] and leave an empty outlined bar). */
.chat-card[hidden], .card[hidden] { display: none !important; }
.row[hidden], .btn[hidden], .ask-free[hidden] { display: none !important; } /* a hidden row or button really hides (their own display would override [hidden]) */
.ask-card .chat-chip, .ask-card .btn.small { min-height: 44px; }

/* Every button on an agent card is at least 44px tall, on a phone and on a laptop. */
.chat-card .btn { min-height: 44px; }

/* The email text is just text: a neutral box, never the yellow of a warning. */
.mail-preview { background: var(--hover, rgba(255, 255, 255, .04)); border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; overflow-wrap: anywhere; }
.mail-preview-body { white-space: pre-wrap; margin-top: 6px; }

/* A hovered (or just-tapped) agent button stays solid green: the plain .btn hover colour is more specific than .btn.agent and used to turn it into an outline. */
.btn.agent:hover:not(:disabled), .btn.agent:focus-visible, .btn.agent:active:not(:disabled) { background: var(--agent-fill); border-color: var(--agent-fill); color: var(--on-accent); }
/* Touch targets: the chat list tabs are at least 44px tall. */
.chat-tab { min-height: 44px; }
@media (max-width: 767px) { .tab, .chat-tab { min-height: 44px; } }

/* The AI agent chat: the green New chat button and every control in the list and the composer are at least 44px, at every width. */
.chat-new { min-height: 44px; }
.chat-clip, .chat-send, .chat-del { min-width: 44px; min-height: 44px; }
.chat-clip, .chat-send { width: 44px; height: 44px; }
.chat-send { background: var(--agent-fill); }
