:root {
  --ink: #18212f; --muted: #5b6676; --line: #dde2ea; --bg: #f4f6f9; --card: #fff; --navy: #1b2a4a;
  --accent: #2563eb; --good: #15803d; --warn: #b45309; --bad: #b91c1c; --chip: #eef2ff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
input, select, textarea { max-width: 100%; }
body { margin: 0; font-size: 14px; line-height: 1.4; }
a { color: var(--accent); }
header.top { background: var(--navy); color: #fff; padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
header.top h1 { font-size: 17px; margin: 0; font-weight: 600; }
header.top .sub { color: #c7d2e6; font-size: 12.5px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.14); color: #fff; white-space: nowrap; }
.badge.mock { background: #fde68a; color: #4a3500; }
.badge.ok { background: #bbf7d0; color: #064e1b; }
.matter { margin-left: 8px; } .matter select { font: inherit; padding: 2px 4px; }
.qmail { margin-top: 10px; border-top: 1px solid #e5e9f0; padding-top: 10px; } .qmail #qBox { margin-top: 8px; } .ask label { cursor: pointer; }
.summarybar { background: #eef4ff; border-bottom: 1px solid #c7d7f5; color: #14325c; padding: 8px 20px; font-size: 14px; font-weight: 600; }
.summarybar.urgent { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.notice { background: #fff7ed; border-bottom: 1px solid #fed7aa; color: #7c2d12; padding: 6px 20px; font-size: 12.5px; font-weight: 600; }
main { padding: 16px 20px 40px; max-width: 1400px; margin: 0 auto; }
.bar { position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 6px rgba(0,0,0,.04); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.timer { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; }
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; grid-column: 1 / -1; }
.progress > div { height: 100%; background: var(--good); width: 0; transition: width .5s; }
.bar.warn .progress > div { background: var(--warn); } .bar.over .progress > div { background: var(--bad); }
.bar.warn .timer { color: var(--warn); } .bar.over .timer { color: var(--bad); }
.bar .meta { color: var(--muted); font-size: 12.5px; }
.bar .freelabel { grid-column: 1 / -1; margin-top: -6px; font-size: 11.5px; }
button { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
a.button { display: inline-block; font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; color: inherit; text-decoration: none; }
a.button[hidden] { display: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.paymsg { grid-column: 1 / -1; font-size: 12.5px; }
.paymsg.blocked, .paymsg.error { color: var(--bad); } .paymsg.sent, .paymsg.demo-sent { color: var(--good); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { background: var(--chip); color: #1e3a8a; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; }
.chip small { font-weight: 400; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.card h3 { font-size: 13.5px; margin: 10px 0 4px; }
.card ul { margin: 0; padding-left: 18px; } .card li { margin: 3px 0; }
.empty { color: var(--muted); font-style: italic; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { text-align: left; padding: 4px 6px; border-bottom: 1px solid #eef0f4; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.v { font-weight: 600; } .unconfirmed { color: var(--warn); font-weight: 400; font-size: 11.5px; }
.urg { font-size: 20px; font-weight: 700; } .urg.expired, .urg.urgent { color: var(--bad); } .urg.soon { color: var(--warn); } .urg.ok { color: var(--good); } .urg.unknown { color: var(--muted); font-size: 14px; }
.opt { border-left: 3px solid var(--accent); padding: 4px 0 4px 10px; margin: 8px 0; }
.opt .why { color: var(--ink); } .opt .checks { color: var(--muted); font-size: 12.5px; }
.flag { border-left: 3px solid var(--bad); padding: 4px 0 4px 10px; margin: 8px 0; }
.flag.pack { border-left-color: var(--warn); }
a.upd { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 1px 8px; text-decoration: none; white-space: nowrap; }
.src { font-size: 11.5px; color: var(--muted); }
.verify { color: var(--warn); font-weight: 600; }
.transcript { max-height: 320px; overflow: auto; font-size: 13px; }
.transcript p { margin: 4px 0; } .transcript b { color: var(--muted); font-weight: 600; }
.foot { margin-top: 16px; color: var(--muted); font-size: 12px; }
.err { background: #fef2f2; border: 1px solid #fecaca; color: var(--bad); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.start { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.start .card p { color: var(--muted); }
select, input, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.list a { display: block; padding: 6px 0; border-bottom: 1px solid #eef0f4; text-decoration: none; }
button.mini { padding: 1px 7px; font-size: 12px; border-radius: 6px; margin-left: 4px; color: var(--muted); }
button.mini.x { float: right; }
.tag { font-size: 11px; background: #e0f2fe; color: #075985; border-radius: 999px; padding: 1px 7px; font-weight: 600; }
.okc { color: var(--good); font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.newcall { background: #dcfce7; border-bottom: 1px solid #86efac; padding: 8px 20px; font-size: 14px; }
.newcall a { font-weight: 700; margin-left: 8px; }
ul.ask { list-style: none; padding: 0; } ul.ask li { padding: 6px 0; border-bottom: 1px solid #eef0f4; } ul.ask .row { margin: 4px 0 0; flex-wrap: nowrap; } ul.ask input { flex: 1; min-width: 0; max-width: 320px; }
.c-notes textarea { width: 100%; }
.crm { margin-top: 14px; }
.alerts { font-size: 12.5px; }
/* Phone: one column in the order a consultant needs mid-call; header and transcript shrink. */
@media (max-width: 700px) {
  main { padding: 10px 10px 32px; }
  header.top { padding: 8px 12px; } header.top h1 { font-size: 15px; } .notice { padding: 5px 12px; font-size: 11.5px; }
  .bar { grid-template-columns: 1fr; padding: 8px 10px; } .actions { justify-content: flex-start; }
  .actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .actions button { padding: 9px 6px; } #micControls:empty { display: none; }
  ul.ask .row { flex-wrap: nowrap; } ul.ask input { flex: 1; min-width: 0; }
  .timer { font-size: 20px; }
  .hint { display: none; }
  .grid { display: flex; flex-direction: column; gap: 10px; }
  .c-flags { order: 1; } .c-missing { order: 2; } .c-options { order: 3; } .c-money { order: 4; } .c-facts { order: 5; }
  .c-notes { order: 6; } .c-service { order: 7; } .c-docs { order: 8; } .c-topics { order: 9; }
  .transcript { max-height: 160px; }
  .card { padding: 10px 12px; }
  input, textarea, select { font-size: 16px; }
}
@media print { .bar, .actions, button, .newcall, .hint { display: none !important; } }

a.btnlink { display: inline-block; background: var(--accent); color: #fff; border-radius: 8px; padding: 7px 12px; font-weight: 600; text-decoration: none; }
.missedbar { background: #fee2e2; border-bottom: 1px solid #fca5a5; color: #7f1d1d; padding: 8px 20px; font-size: 14px; }
.missedbar .qa { margin: 6px 0 2px 18px; padding: 0; } .missedbar .qa li { margin-bottom: 4px; } .missedbar .qa span { color: #991b1b; }
/* Pathways card (2026-11-08) */
#pathways details { border-top: 1px solid var(--line, #e5e7eb); padding: 6px 0; }
#pathways summary { cursor: pointer; }
#pathways h3 { margin: 12px 0 4px; font-size: 15px; }
table.mini-t { border-collapse: collapse; width: 100%; font-size: 13px; margin: 6px 0; }
table.mini-t td, table.mini-t th { border-bottom: 1px solid var(--line, #e5e7eb); padding: 3px 6px; text-align: left; }
@media (max-width: 640px) { table.mini-t { display: block; overflow-x: auto; } }
#pathways select, #pathways input { max-width: 100%; }
/* Application package card (2026-11-08) */
#package details { border-top: 1px solid var(--line, #e5e7eb); padding: 6px 0; }
#package input, #package select { max-width: 100%; }
#package h3 { margin: 12px 0 4px; font-size: 15px; }

/* Main menu (2026-11-10), the same on every signed-in page and in the desk (built by auth-guard.js). */
.appnav { background: #111b30; display: flex; align-items: center; gap: 2px; padding: 5px 14px; overflow-x: auto; scrollbar-width: none; }
.appnav .links, .appnav .right { display: flex; gap: 2px; align-items: center; }
.appnav .right { margin-left: auto; padding-left: 12px; }
.appnav a { color: #c7d2e6; text-decoration: none; padding: 6px 11px; border-radius: 7px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.appnav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.appnav a.on { background: rgba(255,255,255,.18); color: #fff; }
.appnav .brand { color: #fff; font-weight: 800; padding-left: 0; margin-right: 10px; }
.appnav .phonebtn { background: #16a34a; color: #fff; }
.appnav .phonebtn:hover { background: #15803d; }
.appnav .signout { color: #94a3b8; font-weight: 500; }
/* Actions that belong to one page sit at the right of its title. */
.pageacts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pageacts a, .pageacts button { font-size: 13px; padding: 6px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; text-decoration: none; font-weight: 600; cursor: pointer; }
.pageacts a:hover, .pageacts button:hover { background: rgba(255,255,255,.12); }
@media (max-width: 700px) { .appnav { padding: 4px 8px; } .appnav a { padding: 6px 8px; font-size: 13.5px; } .appnav .brand { display: none; } }

/* Call page workspace (2026-11-10): three columns on wide screens, each scrolling on its own once the page header has
   scrolled away, so the AI guidance stays in view while the conversation runs. */
.ws { display: grid; grid-template-columns: minmax(280px, 26fr) minmax(380px, 42fr) minmax(320px, 32fr); gap: 14px; align-items: start; }
.ws > .col { position: sticky; top: calc(var(--barH, 0px) + 10px); max-height: calc(100vh - var(--barH, 0px) - 20px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 4px 12px 0; scrollbar-width: thin; min-width: 0; }
.ws > .col > * { flex-shrink: 0; }
.colhead { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 2px 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); border-bottom: 2px solid var(--line); }
.colhead span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); margin-left: 6px; }
.ws .hint { margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.ws .transcript { max-height: 56vh; }
.ws .col-ai .card { border-left: 3px solid var(--accent); }
.ws .c-summary h2 { color: var(--accent); }
main:has(> .ws) { max-width: none; }
.ws .card { min-width: 0; max-width: 100%; overflow-x: auto; overflow-wrap: anywhere; }
.ws label, .chips .matter { max-width: 100%; } .chips .matter select { max-width: calc(100vw - 100px); } .ws select { max-width: 100%; min-width: 0; }
@media (max-width: 1199px) {
  .ws { display: flex; flex-direction: column; gap: 12px; }
  .ws > .col { display: contents; }
  .colhead { display: none; }
  .ws .transcript { max-height: 220px; }
  /* Narrow screens: most important first. After the call, the CRM card moves first (body.ended). */
  .c-summary { order: 1; } .ws .hint { order: 2; } #dropLine { order: 2; } .c-missing { order: 3; } .c-flags { order: 4; } .c-options { order: 5; }
  .c-facts { order: 6; } .c-notes { order: 7; } .c-docs { order: 8; } .c-money { order: 9; } .c-service { order: 10; }
  #crmCard { order: 11; } #followCard { order: 12; } #nextCard { order: 13; } #packageCard { order: 14; } #pathwaysCard { order: 15; } .c-topics { order: 16; }
  body.ended #crmCard { order: 0; } body.ended #followCard { order: 0; } body.ended #nextCard { order: 0; }
}
