:root {
  --ink: #1c2430; --ink-2: #4a5568; --ink-3: #8a94a6;
  --paper: #f6f7f5; --panel: #ffffff; --rule: #d9dde3; --rule-2: #eceef1;
  --input: #fff6c8;        /* manual input (yellow) */
  --input-ink: #6b5300;
  --calc: #e7f0fb;         /* formula (blue) */
  --sum: #d5e4f7;          /* SUM (deeper blue) */
  --ok: #1f7a4d; --ok-bg: #dff3e6;
  --warn: #b7791f; --warn-bg: #fff2d6;
  --err: #b42318; --err-bg: #fde3e1;
  --partner: #6b3fa0; --partner-bg: #efe6fa;
  --firm: #0f5c3c; --firm-bg: #e2f2ea;
  --accent: #1f4e9c;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--sans); color: var(--ink); background: var(--paper); display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; margin: 26px 0 8px; }
h3 { font-size: 15px; font-weight: 700; margin: 16px 0 6px; }
.muted { color: var(--ink-3); } .sub { color: var(--ink-2); margin: 0 0 18px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--err); }

/* rail */
.rail { background: #172033; color: #c9d2e3; padding: 22px 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.rail a { color: #c9d2e3; padding: 9px 22px; display: block; border-left: 3px solid transparent; }
.rail a:hover { background: #202b45; text-decoration: none; }
.rail a.active { color: #fff; border-left-color: #f2c14e; background: #202b45; }
.rail .brand { font-size: 22px; font-weight: 700; line-height: 1.05; color: #fff; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid #2a3652; }
.rail .brand span { font-weight: 400; color: #f2c14e; }
.rail-foot { margin-top: auto; padding: 14px 22px; font-size: 12px; color: #6f7b95; }

main { padding: 30px 36px 60px; max-width: 1500px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* controls */
button, .btn { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--rule); background: #fff; color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--ink-3); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #17407f; }
button.ghost { background: transparent; border-color: transparent; color: var(--accent); padding: 6px 8px; }
button.danger { color: var(--err); border-color: var(--err-bg); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--rule); border-radius: 5px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid #f2c14e; outline-offset: 1px; }
input.in, select.in, textarea.in { background: var(--input); border-color: #e6d27a; }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input.pct { width: 78px; } input.money { width: 120px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
label.f > input, label.f > select, label.f > textarea { font-size: 15px; color: var(--ink); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; }
.fields .wide { grid-column: span 2; }

/* panels & tables */
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 16px 18px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 13px; padding: 7px 8px; border-bottom: 2px solid var(--rule); background: #fafbfc; vertical-align: bottom; }
td { padding: 6px 8px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
tr.total td { font-weight: 700; background: var(--sum); border-top: 2px solid var(--rule); }
tr.sub td { font-weight: 600; background: var(--calc); }
td.calc { background: var(--calc); } td.in { background: var(--input); }
td.partner, th.partner { background: var(--partner-bg); } td.firm, th.firm { background: var(--firm-bg); color: var(--firm); }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: #f3f5f8; }
.tight td, .tight th { padding: 4px 6px; }
.scroll { overflow-x: auto; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); } .badge.neutral { background: var(--rule-2); color: var(--ink-2); }
.badge.paid { background: #e2ebfa; color: #1f4e9c; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* event editor layout */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.summary { position: sticky; top: 22px; }
.ledger { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.ledger .head { padding: 12px 16px; background: #172033; color: #fff; display: flex; justify-content: space-between; align-items: center; }
.ledger .head .title { font-weight: 700; }
.ledger table td { padding: 6px 14px; }
.ledger tr.group td { background: var(--rule-2); font-weight: 600; font-size: 13px; color: var(--ink-2); }
.ledger .verify { padding: 12px 16px; font-weight: 700; text-align: center; }
.ledger .verify.ok { background: var(--ok-bg); color: var(--ok); } .ledger .verify.err { background: var(--err-bg); color: var(--err); }
.ledger .problems { padding: 8px 16px 12px; font-size: 13px; color: var(--err); }
.section { margin-top: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.section-head h2 { margin: 0; }
.hint { font-size: 13px; color: var(--ink-3); margin: 4px 0 0; }
.step { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--err); color: #fff; font-weight: 700; font-size: 13px; align-items: center; justify-content: center; margin-right: 8px; }
details.rates { margin-top: 18px; } details.rates summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.rates-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 10px; }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0 18px; }
.stat { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; } .stat .l { font-size: 13px; color: var(--ink-2); }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #172033; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
.empty { padding: 40px; text-align: center; color: var(--ink-2); background: var(--panel); border: 1px dashed var(--rule); border-radius: 8px; }
pre.log { background: #fff; border: 1px solid var(--rule); border-radius: 8px; padding: 12px; font-size: 13px; white-space: pre-wrap; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 14px; height: 14px; border: 1px solid var(--rule); vertical-align: -2px; margin-right: 5px; }
.legend .l-in::before { background: var(--input); } .legend .l-calc::before { background: var(--calc); } .legend .l-sum::before { background: var(--sum); }
.legend .l-partner::before { background: var(--partner-bg); } .legend .l-firm::before { background: var(--firm-bg); } .legend .l-err::before { background: var(--err-bg); }

@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } .summary { position: static; } }
@media (max-width: 760px) { body { grid-template-columns: 1fr; } .rail { position: static; height: auto; } main { padding: 18px; } }
@media print {
  body { grid-template-columns: 1fr; background: #fff; font-size: 12px; } .rail, .actions, .noprint, #toast { display: none !important; }
  main { padding: 0; max-width: none; } .panel, .ledger { border: none; } .editor { grid-template-columns: 1fr; } .summary { position: static; }
  @page { margin: 12mm; }
}

/* column widths */
#lines td:first-child { min-width: 260px; } #alloc td:first-child { min-width: 150px; }
td.client, th.client { min-width: 260px; } td.client .muted { display: block; max-width: 420px; }

/* Comp Summary table tools: sort, filter, rearrange, hide/show */
.tabletools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tabletools input[type=search] { width: 260px; }
.colmenu { margin-bottom: 10px; max-width: 720px; }
.colmenu-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.colmenu-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; }
.colmenu-list label { display: flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.dropto { box-shadow: inset 3px 0 0 var(--accent); }
tr.filters th { padding-top: 2px; padding-bottom: 4px; border-bottom: 2px solid var(--rule); }
tr.filters input { width: 100%; min-width: 60px; padding: 3px 6px; font-size: 12px; font-weight: 400; }
@media print { .tabletools, .colmenu, tr.filters { display: none; } }

/* Choice dialog (Excel / Print scope) */
dialog.choice { box-sizing: border-box; overflow: visible; border: 1px solid var(--rule); border-radius: 10px; padding: 20px 22px; width: min(460px, calc(100vw - 32px)); color: var(--ink); background: var(--panel); }
dialog.choice::backdrop { background: rgba(28, 36, 48, .35); }
dialog.choice h3 { margin: 0 0 14px; font-size: 18px; }
.choice-opts { display: grid; gap: 10px; }
.choice-opts button { box-sizing: border-box; width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 14px; }
.choice-opts button span { font-weight: 400; font-size: 13px; opacity: .85; }
.choice-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.print-only { display: none; }
@media print { .print-only { display: block; font-weight: 600; } }

/* On/off switch (e.g. "Hide partners with no comp") */
label.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; user-select: none; padding: 4px 6px; }
label.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.switch .track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--rule); transition: background .15s; flex: none; }
label.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
label.switch input:checked + .track { background: var(--accent); }
label.switch input:checked + .track::after { transform: translateX(16px); }
label.switch input:focus-visible + .track { outline: 2px solid #f2c14e; outline-offset: 2px; }
@media print { label.switch { display: none; } }

/* Deal terms on the event form */
h3.fields-head { font-size: 14px; color: var(--ink-2); margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--rule-2); }
output.calc-out { display: block; padding: 7px 9px; border: 1px solid var(--rule); border-radius: 5px; background: var(--calc); font-size: 15px; font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; min-width: 120px; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; }
.kpi .l { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .l i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 2px; }
.kpi .d { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi.hero { grid-column: span 2; }
.kpi.hero .v { font-size: 40px; line-height: 1.1; }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.viz-card { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 16px 18px; min-width: 0; }
.viz-card.wide { grid-column: 1 / -1; }
.viz-card h3 { margin: 0 0 2px; font-size: 16px; }
.viz-card > .hint { margin-bottom: 12px; }
.viz-empty { padding: 28px 12px; text-align: center; color: var(--ink-3); font-size: 14px; border: 1px dashed var(--rule); border-radius: 6px; }
.viz-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.hbars { display: grid; gap: 6px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr; align-items: center; gap: 10px; font-size: 13px; padding: 2px 0; border-radius: 4px; }
.hbar-row:hover { background: var(--rule-2); }
.hbar-row.clickable { cursor: pointer; }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.hbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbar, .hstack { height: 16px; border-radius: 0 4px 4px 0; flex: none; min-width: 2px; }
.hstack { display: flex; gap: 2px; overflow: hidden; }
.hstack .seg { height: 100%; }
.hbar-val { font-size: 12px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vcols { position: relative; height: 240px; margin: 4px 0 26px 52px; }
.vcols-grid { position: absolute; inset: 0; }
.vcols-grid .tick { position: absolute; left: 0; right: 0; border-top: 1px solid var(--rule-2); }
.vcols-grid .tick span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.vcols-plot { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-around; border-bottom: 1px solid var(--rule); }
.vcol { position: relative; height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; cursor: default; }
.vcol:hover { background: rgba(28, 36, 48, .04); }
.vstack { width: min(24px, 60%); display: flex; flex-direction: column-reverse; gap: 2px; min-height: 0; }
.vstack .seg { width: 100%; min-height: 1px; }
.vstack .seg:last-child { border-radius: 4px 4px 0 0; }
.vcol-label { position: absolute; top: calc(100% + 6px); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.viz-table { margin-top: 12px; font-size: 13px; }
.viz-table summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.viz-table table { margin-top: 8px; }
.viz-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.45; padding: 7px 10px; border-radius: 6px; white-space: pre-line; max-width: 320px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
@media (max-width: 700px) { .viz-grid { grid-template-columns: 1fr; } .kpi.hero { grid-column: auto; } }
@media print { .viz-card { break-inside: avoid; } .viz-table[open] summary { display: none; } .viz-tip { display: none; } }

/* Resizable columns (every table) */
th.rz-th { position: relative; }
.rz-handle { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; }
.rz-handle::after { content: ""; position: absolute; top: 20%; bottom: 20%; left: 3px; width: 2px; border-radius: 1px; background: transparent; }
th:hover > .rz-handle::after, .rz-handle:hover::after { background: var(--ink-3); }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }
td.rz input, td.rz select, td.rz textarea, th.rz input { max-width: 100%; min-width: 0; box-sizing: border-box; }
td.rz .badge { white-space: normal; }
@media print { .rz-handle { display: none; } }

/* Table standard: boxed column headings and a thin vertical line between every column, full height */
:root { --grid: #c4cad3; }
th { border: 1px solid var(--grid); border-bottom-width: 2px; background-color: #eef1f5; }
th.partner { background-color: var(--partner-bg); } th.firm { background-color: var(--firm-bg); }
tr.filters th { background-color: #f6f7f9; }
tr.filters th { border-top-width: 1px; }
td { border-left: 1px solid var(--grid); border-right: 1px solid var(--grid); }

/* Excel-style column filters */
th .th-in { display: inline-flex; align-items: flex-end; gap: 4px; }
th.num .th-in { justify-content: flex-end; }
.fbtn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; margin-left: 2px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--ink-3); cursor: pointer; }
.fbtn:hover { border-color: var(--grid); background: #fff; color: var(--ink); }
.fbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fpop { position: fixed; z-index: 60; width: 280px; background: var(--panel); border: 1px solid var(--grid); border-radius: 8px; box-shadow: 0 8px 28px rgba(28,36,48,.18); padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 400; color: var(--ink); }
.fpop-head { font-weight: 700; font-size: 14px; }
.fpop-cond { display: grid; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--rule-2); }
.fpop-ab { display: flex; align-items: center; gap: 6px; }
.fpop-ab input { flex: 1; min-width: 0; }
.fpop-ab[hidden], .fpop-ab [hidden] { display: none; }
.fpop-all { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.fpop-list { max-height: 240px; overflow: auto; border: 1px solid var(--rule-2); border-radius: 6px; padding: 4px 6px; }
.fpop-list label { display: flex; align-items: center; gap: 8px; padding: 3px 2px; border-radius: 4px; cursor: pointer; }
.fpop-list label:hover { background: var(--rule-2); }
.fpop-list label[hidden] { display: none; }
.fpop-list .fv { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fpop-list .fn { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.fpop-foot { display: flex; justify-content: space-between; align-items: center; }
.fpop-foot button { padding: 6px 12px; }
@media print { .fbtn, .fpop { display: none; } }

/* Chat */
.seg { display: inline-flex; border: 1px solid var(--grid); border-radius: 7px; overflow: hidden; }
.seg a { padding: 8px 14px; font-weight: 600; color: var(--ink-2); background: #fff; text-decoration: none; }
.seg a + a { border-left: 1px solid var(--grid); }
.seg a.on { background: var(--accent); color: #fff; }
.chat-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-wrap.intake { grid-template-columns: minmax(0, 1fr) 340px; }
.chat-main { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; display: flex; flex-direction: column; min-height: 60vh; }
.chat-log { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; min-height: 320px; max-height: max(420px, calc(100vh - 290px)); }
.chat-msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; line-height: 1.45; }
.chat-msg p { margin: 0 0 8px; } .chat-msg p:last-child { margin-bottom: 0; } .chat-msg ul, .chat-msg ol { margin: 4px 0 8px; padding-left: 20px; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant { align-self: flex-start; background: #f1f3f6; border-bottom-left-radius: 4px; }
.chat-msg.error { align-self: flex-start; background: var(--err-bg); color: var(--err); }
.chat-att { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; font-size: 13px; opacity: .9; }
.chat-display { margin-top: 10px; }
.chat-card { background: #fff; border: 1px solid var(--rule); border-radius: 8px; padding: 12px; }
.chat-card h4 { margin: 0 0 8px; font-size: 14px; }
.chat-card.proposal ul { margin: 6px 0 10px; padding-left: 18px; }
.ok-note { color: var(--ok); font-weight: 600; margin: 6px 0 0; }
.typing { display: inline-flex; gap: 4px; padding: 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--grid); background: #fff; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip button { border: 0; background: none; padding: 0 2px; cursor: pointer; font-size: 14px; }
.chat-compose { border-top: 1px solid var(--rule); padding: 10px 12px; display: grid; gap: 8px; }
.chat-compose.drag { outline: 2px dashed var(--accent); outline-offset: -4px; }
.chat-compose textarea { width: 100%; resize: vertical; min-height: 48px; font: inherit; }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; } .chat-files:empty { display: none; }
.chat-bar { display: flex; align-items: center; gap: 10px; } .chat-bar .hint { flex: 1; margin: 0; }
.chat-draft { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 14px; position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow: auto; }
.draft-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.chat-draft h5 { margin: 12px 0 6px; font-size: 13px; color: var(--ink-2); }
.draft-fields th { width: 42%; font-weight: 600; font-size: 12px; vertical-align: top; }
.draft-fields td { font-size: 13px; } .draft-fields .src { font-size: 11px; color: var(--ink-3); }
.draft-sum { font-weight: 600; margin: 10px 0 4px; }
.draft-files { margin: 0 0 10px; padding-left: 18px; font-size: 13px; }
.chat-draft #toForm { width: 100%; margin-top: 10px; }
.ask-bar { display: flex; gap: 8px; margin: 0 0 16px; } .ask-bar input { flex: 1; min-width: 0; }
.doc-list { margin: 0; padding-left: 18px; } .doc-list li { margin: 4px 0; }
@media (max-width: 900px) { .chat-wrap.intake { grid-template-columns: 1fr; } .chat-draft { position: static; max-height: none; } .chat-msg { max-width: 100%; } .ask-bar { flex-wrap: wrap; } }
.chat-md { background: #fff; margin: 6px 0 8px; } .chat-md th, .chat-md td { font-size: 13px; }

/* Issues panels */
.issues { background: #fff8ef; border: 1px solid #f0c9a3; border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.issues.none { background: var(--panel); border-color: var(--rule); }
.issues-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.issues-head .issues-actions { margin-left: auto; display: flex; gap: 6px; }
.issues-body { margin-top: 10px; }
.issues-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; margin-bottom: 8px; }
.issues .panel { background: #fff; }
.resolve { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.resolve button, .resolve .btn, .resolve select { padding: 4px 10px; font-size: 13px; }
.resolve .chatbtn { border-color: var(--accent); color: var(--accent); }
dialog.choice.wide { width: min(980px, calc(100vw - 32px)); }
a.kpi.link { color: inherit; text-decoration: none; display: block; } a.kpi.link:hover { border-color: var(--accent); }
.chat-card .handoff { margin-top: 8px; }
.issues-bulk[hidden] { display: none; }

/* Check-out bar (POC shared through Dropbox) */
.lockbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 8px 12px; border-radius: 8px; margin: 0 0 14px; font-size: 14px; border: 1px solid; }
.lockbar.edit { background: #eef8f1; border-color: #b9e0c6; }
.lockbar.held { background: #fff6e6; border-color: #f0c9a3; }
.lockbar.free { background: #eef4ff; border-color: #b9d3f5; }
.lockbar button { white-space: nowrap; }
.lock-warn { color: var(--err); font-weight: 600; }
.lock-full { max-width: 640px; margin: 80px auto; padding: 0 16px; }
@media print { #lockbar { display: none; } }

/* Sign-in (hosted) */
body.signin-page .rail { display: none; }
body.signin-page, body.signin-page.rail-mini { grid-template-columns: 1fr; }   /* the menu is hidden here, so the card gets the full width */
.signin { max-width: 440px; margin: 12vh auto; text-align: center; padding: 32px; border: 1px solid #ddd; border-radius: 10px; background: #fff; }
.signin h1 { margin-bottom: 12px; }
.signin button { margin: 16px 0; font-size: 1.05em; padding: 10px 22px; }
