/* Change Order Signal. FactualIQ palette on light: navy structure, one orange accent, work on white under a warm head band. */
:root {
  --orange: #e36d19; --orange-deep: #a8520e; --orange-tint: #fbe9dc; --orange-line: #f0c9a8;
  --navy: #163554; --navy-dark: #0e1a2b;
  --ink: #1d2733; --ink-2: #4c5866; --line: #d5dae3; --line-soft: #e6e9ef;
  --band: #f4efe6; --surface: #fff; --row: #f8f9fb; --inset: #f6f2ec;
  --good: #23633a; --good-tint: #e3f1e7;
  --blue: #1d4f91; --blue-tint: #e4edf9;
  --warn: #7a5300; --warn-tint: #fbf0d3;
  --bad: #9c2226; --bad-tint: #fbe6e6;
  --neutral: #3f4b59; --neutral-tint: #edf0f4;
  --radius: 6px;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--sans); color: var(--ink); background: var(--surface); }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }

/* Top bar */
.topbar { height: 52px; display: flex; align-items: center; gap: 28px; padding: 0 24px; background: var(--navy-dark); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; }
.topnav { display: flex; gap: 22px; }
.topnav a { color: #c9d3df; text-decoration: none; font-weight: 500; padding: 15px 0 13px; border-bottom: 3px solid transparent; }
.topnav a.on { color: #fff; border-bottom-color: var(--orange); }
.acct { position: relative; margin-left: auto; }
.acct-who { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; font-weight: 600; cursor: pointer; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 230px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: 0 8px 22px rgba(14,26,43,.14); display: grid; gap: 4px; }
.acct-label { margin: 0; color: var(--ink-2); text-transform: capitalize; font-size: 13px; }
.acct-mail { margin: 0 0 6px; font-weight: 500; }
.acct-item { color: var(--navy); text-decoration: none; font-weight: 500; padding: 4px 0; }
.acct-item:hover { text-decoration: underline; }

/* App mark: one periodic-table cell (oe-contract-manager AppTile), on a dark bar */

/* Head band */
.band { background: var(--band); padding: 18px 24px 0; }
.crumbs { display: flex; gap: 8px; color: var(--ink-2); margin-bottom: 6px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.head { display: flex; align-items: flex-start; gap: 18px; }
.head h1 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 26px; color: var(--navy-dark); line-height: 1.2; }
.head .grow { flex: 1; min-width: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 8px; color: var(--ink-2); }
.facts b { color: var(--ink); font-weight: 600; }
.facts a { font-weight: 600; text-decoration: none; }
.facts a:hover { text-decoration: underline; }
.actions { display: flex; gap: 8px; align-items: center; flex: none; }
.stats { display: flex; gap: 36px; margin: 18px 0 2px; }
.stat .n { font-size: 24px; font-weight: 600; color: var(--navy-dark); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { color: var(--ink-2); }

/* Tabs: a strip of separate underlines, orange on the active one */
.tabs { display: flex; gap: 24px; margin-top: 18px; }
.tab { border: 0; background: none; padding: 8px 0 9px; cursor: pointer; font-weight: 500; color: var(--ink-2); border-bottom: 3px solid #c5ccd6; display: inline-flex; gap: 8px; align-items: baseline; }
.tab.on { color: var(--navy-dark); font-weight: 600; border-bottom-color: var(--orange); }
.tab .ct { font-weight: 400; color: var(--ink); }

/* Buttons */
.btn { height: 34px; padding: 0 14px; border-radius: var(--radius); border: 0; background: var(--navy); color: #fff; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--navy-dark); }
.btn.accent { background: var(--orange-deep); }
.btn.accent:hover { background: #8e450b; }
.btn.ghost { background: var(--surface); color: var(--navy); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--navy); }
.btn.sm { height: 30px; padding: 0 11px; }
.btn:disabled { background: var(--line-soft); color: var(--ink-2); cursor: not-allowed; border: 0; }
.tip { position: relative; display: inline-flex; }
.tip > button:disabled { pointer-events: none; }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; background: var(--tipbg, var(--navy-dark)); color: var(--tipfg, #fff); border: 1px solid var(--tipline, transparent); font-weight: 500; padding: 6px 10px; border-radius: 5px; white-space: nowrap; }
.actions [data-tip]:hover::after { left: auto; right: 0; }
select.year { height: 34px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 10px; font-weight: 600; }

/* Page body */
.page { padding: 20px 24px 60px; }
.section + .section { margin-top: 30px; }
.section h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; color: var(--navy-dark); display: flex; gap: 10px; align-items: baseline; }
.section h2 .ct { color: var(--ink-2); font-weight: 500; }
.empty { color: var(--ink-2); padding: 14px 0; }

/* Tables: one size throughout, rule under the header only, faint banding */
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 8px 12px; border-bottom: 1.5px solid var(--navy); white-space: nowrap; }
.grid td { padding: 9px 12px; vertical-align: top; }
.grid tbody tr:nth-child(even of :not(.open-row)) td { background: var(--row); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .nm { font-weight: 600; color: var(--navy); }
.grid .mu { color: var(--ink-2); }
.grid tr.link { cursor: pointer; }
.grid tr.link:hover td { background: var(--orange-tint); }
.grid a.pg { text-decoration: none; font-weight: 500; white-space: nowrap; }
.grid a.pg:hover { text-decoration: underline; }
body.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--band); }
.login-panel { width: 380px; background: var(--surface); border-radius: 10px; padding: 34px 32px 30px; box-shadow: 0 10px 30px rgba(14,26,43,.10); }
.login-mark .mark { width: 34px; height: 40px; }
.login-panel h1 { margin: 18px 0 0; font-family: var(--serif); font-size: 24px; color: var(--navy-dark); }
.login-brand { margin: 6px 0 0; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; color: var(--orange-deep); font-size: 12px; }
.login-lede { margin: 20px auto 0; max-width: 31ch; color: var(--ink-2); }
.login-form { margin-top: 26px; display: grid; gap: 10px; text-align: left; }
.login-form input { height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; }
.login-form .btn { justify-content: center; height: 38px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.login-msg { color: var(--ink-2); margin: 0; min-height: 0; }
.login-msg:empty { display: none; }
.user-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.login-panel { text-align: left; }
.login-logo { display: block; margin: 0 0 0 -6px; } /* the mark's left edge on the headline's left edge */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; justify-items: end; }
.toast { background: var(--navy-dark); color: #fff; padding: 10px 14px; border-radius: 6px; max-width: 440px; }
.toast.err { background: var(--bad); }
.brand .mark { width: 24px; height: 28px; flex: none; }
input.f, select.f { height: 34px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 10px; }
textarea.f { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; width: 100%; min-height: 90px; font: 13px/1.4 ui-monospace, monospace; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row + .grid, .grid + .row { margin-top: 12px; }
.grid tfoot td { font-weight: 600; border-top: 1.5px solid var(--navy); }
.grid tr.sub td { background: var(--inset) !important; padding: 12px; }
.grid tr.sub table.grid td { background: none; }
.terms { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 20px; margin: 0; }
.terms dt { color: var(--ink-2); }
.terms dd { margin: 0; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: baseline; }
/* Invoice: the document beside its standing */
.inv-layout { display: grid; grid-template-columns: minmax(0, 820px) 300px; gap: 28px; align-items: start; }
.side { position: sticky; top: 12px; display: grid; gap: 22px; }
.side h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; color: var(--navy-dark); }
.side .btns { display: flex; flex-wrap: wrap; gap: 8px; }
.side dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.side dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.side dt { color: var(--ink-2); }
.paper { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 44px 56px 56px; font: 14px/1.45 Arial, Helvetica, sans-serif; color: #111; }
.paper .logo { width: 150px; height: auto; display: block; margin-bottom: 36px; }
.paper h1 { font-size: 26px; margin: 0 0 6px; }
.paper p { margin: 0 0 16px; }
.paper .two { display: flex; justify-content: space-between; gap: 20px; }
.paper table { width: 100%; border-collapse: collapse; margin: 6px 0 22px; }
.paper th, .paper td { border: 1px solid #111; padding: 7px 8px; text-align: left; }
.paper th { background: #d9d9d9; font-size: 12px; }
.paper .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper tr.tot td { font-weight: 700; }
.paper .stmt { margin-top: 36px; page-break-before: always; }
.paper .stmt h2 { font-size: 18px; margin: 0 0 10px; }
.paper .mu { color: #555; }
@media print {
  .topbar, .band, .side, .toasts, #notice { display: none !important; }
  .page { padding: 0; }
  .inv-layout { display: block; }
  .paper { border: 0; padding: 0; }
}
.chip { --tipbg: var(--neutral-tint); --tipfg: var(--neutral); display: inline-block; font-weight: 600; border-radius: 3px; padding: 1px 7px; white-space: nowrap; background: var(--neutral-tint); color: var(--neutral); }
.chip.good { background: var(--good-tint); color: var(--good); --tipbg: var(--good-tint); --tipfg: var(--good); }
.chip.blue { background: var(--blue-tint); color: var(--blue); --tipbg: var(--blue-tint); --tipfg: var(--blue); }
.chip.warn { background: var(--warn-tint); color: var(--warn); --tipbg: var(--warn-tint); --tipfg: var(--warn); }
.chip.bad { background: var(--bad-tint); color: var(--bad); --tipbg: var(--bad-tint); --tipfg: var(--bad); }
.chip.accent { background: var(--orange-tint); color: var(--orange-deep); --tipbg: var(--orange-tint); --tipfg: var(--orange-deep); }
.chip[data-tip]:hover::after { --tipline: currentColor; }
.topnav + .acct, .topbar .acct { margin-left: auto; }
.drop { border: 1.5px dashed var(--orange-line); background: #fffaf6; border-radius: 8px; padding: 22px; display: flex; align-items: center; gap: 18px; }
.drop.over { border-color: var(--orange); background: var(--orange-tint); }
.drop .grow { flex: 1; }
.drop .big { font-weight: 600; color: var(--navy-dark); font-size: 15px; }
.drop .mu { color: var(--ink-2); }
.f.sm { height: 30px; padding: 0 8px; }
input.amt { width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.bar { margin-bottom: 10px; }
.bar .mu { flex: 1; }
.stack { display: grid; gap: 8px; }
.stack h2 { margin: 0; }
.stack label { display: grid; gap: 4px; color: var(--ink-2); }
.side .x { border: 0; background: none; color: var(--ink-2); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; margin-left: 6px; }
.paper textarea.line { width: 100%; border: 1px dashed #bbb; padding: 3px 4px; font: inherit; line-height: 1.35; resize: vertical; display: block; }
.billview p { margin: 0 0 8px; }
.billto { display: grid; grid-template-columns: repeat(2, minmax(0, 360px)); gap: 10px 20px; }
.billto label { display: grid; gap: 4px; color: var(--ink-2); }
.billto textarea.f { min-height: 60px; font: inherit; }
.missing { margin: 0 0 10px; color: var(--ink-2); }
.billto { align-items: start; }
/* ---------- Editorial layer (from Change Order Signal / K-1 Signal) ----------
   Cool paper ground, camo ink for structure, Inter Tight display type at magazine scale, heavy rules over
   sections and figures, square controls. Orange marks where you are; camo marks what you act on. */
:root { --paper: #f2f5f3; --paper-line: #dbe3de; --ink-camo: #14251d; --camo: #1d382c; --camo-tint: #e8efea; --muted: #5b6862;
  --display: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif; }
body { background: var(--paper); }
#app { flex: 1; display: flex; flex-direction: column; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -0.03em; line-height: 1; }
.brand .mark { width: 28px; height: 32px; }
.topnav a { font-family: var(--display); font-weight: 700; font-size: 15px; }
/* Masthead: crumbs, one big headline, a quiet deck of facts, the figures on a heavy rule */
.band { background: var(--paper); border-bottom: 0; padding: 26px 40px 0; }
.band .crumbs { margin-bottom: 18px; font-size: 13.5px; }
.band .crumbs, .band .crumbs a { color: var(--muted); }
.band .head { align-items: center; }
.band .head h1 { font-family: var(--display); font-weight: 800; font-size: clamp(32px, 3.3vw, 48px); line-height: 1.02; letter-spacing: -0.03em; color: var(--ink-camo); max-width: 26ch; text-wrap: balance; }
.facts { margin-top: 14px; gap: 6px 28px; font-size: 15px; color: var(--muted); }
.facts b { color: var(--ink-camo); font-weight: 600; }
.stats { margin: 26px 0 0; padding-top: 16px; border-top: 3px solid var(--ink-camo); gap: 48px; flex-wrap: wrap; }
.stat .n { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 2.9vw, 42px); letter-spacing: -0.03em; line-height: 1; color: var(--ink-camo); }
.stat .l { margin-top: 8px; font-size: 13px; font-weight: 500; color: #4f5d56; }
.stat:first-child .n { color: var(--camo); }
/* Body continues the paper; sections are display headings on a heavy rule over unruled tables */
.page { background: var(--paper); padding: 30px 40px 72px; flex: 1; }
.section + .section { margin-top: 44px; }
.section h2 { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; color: var(--ink-camo); margin: 0 0 6px; padding-bottom: 10px; border-bottom: 3px solid var(--ink-camo); }
.section h2 .ct { font-family: var(--sans); font-weight: 500; font-size: 15px; color: var(--muted); }
table.grid { font-size: 14px; }
.grid th { font-size: 12.5px; font-weight: 600; color: var(--ink-camo); border-bottom: 0; padding: 12px 12px 6px; background: none; }
.grid td { padding: 9px 12px; border: 0; }
.grid th:first-child, .grid td:first-child { padding-left: 0; }
.grid th:last-child, .grid td:last-child { padding-right: 0; }
.grid tbody tr td, .grid tbody tr:nth-child(even of :not(.open-row)) td { background: none; }
.grid tr.link:hover td, .grid tr.link:focus-visible td { background: rgba(29,56,44,.05); }
.grid .nm { color: var(--ink-camo); font-weight: 700; }
.grid .mu, .mu { color: var(--muted); }
.grid tfoot td { border-top: 3px solid var(--ink-camo); padding-top: 12px; font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--ink-camo); }
.grid .chip, .chip { background: none; padding: 0; border-radius: 0; font-weight: 700; }
.chip.neutral, .chip:not(.good):not(.blue):not(.warn):not(.bad):not(.accent) { color: var(--muted); }
a.pg { color: var(--ink-camo); font-weight: 600; text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 3px; }
/* Controls: square, ink, bold */
.btn { border-radius: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.005em; height: 38px; padding: 0 16px; }
.btn, .btn:hover { background: var(--ink-camo); color: #fff; border: 2px solid var(--ink-camo); }
.btn:hover { background: var(--camo); border-color: var(--camo); }
.btn.accent, .btn.accent:hover { background: var(--camo); border-color: var(--camo); }
.btn.accent:hover { background: var(--ink-camo); border-color: var(--ink-camo); }
.btn.ghost { background: transparent; border: 2px solid var(--ink-camo); color: var(--ink-camo); }
.btn.ghost:hover { background: var(--ink-camo); color: #fff; }
.btn.sm { height: 32px; padding: 0 12px; border-width: 1.5px; }
.btn:disabled, .btn:disabled:hover { background: transparent; color: #9aa7a0; border: 2px solid var(--paper-line); cursor: not-allowed; }
input.f, select.f, textarea.f { border-radius: 0; border: 2px solid var(--paper-line); background: #fff; }
input.f:focus, select.f:focus, textarea.f:focus { outline: none; border-color: var(--ink-camo); }
input.f.sm { border-width: 1.5px; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--camo); }
/* Upload: a heavy dashed block on white */
.drop { background: #fff; border: 2px dashed var(--ink-camo); border-radius: 0; padding: 26px 28px; }
.drop.over { background: var(--camo-tint); border-color: var(--camo); }
.drop .big { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.025em; color: var(--ink-camo); }
/* Terms as a reference list on hairlines */
.terms { grid-template-columns: 200px minmax(0, 1fr); gap: 0; }
.terms dt, .terms dd { padding: 10px 0; border-bottom: 1px solid var(--paper-line); }
.terms dt { font-weight: 600; color: var(--ink-camo); }
.terms dd { line-height: 1.5; max-width: 90ch; }
/* Invoice: the white sheet on paper, the standing beside it set like the masthead */
.paper { border: 0; border-radius: 0; box-shadow: 0 14px 40px rgba(20,37,29,.10); border-top: 4px solid var(--ink-camo); }
.side h2 { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink-camo); padding-bottom: 8px; border-bottom: 3px solid var(--ink-camo); margin-bottom: 10px; }
.side dt { color: var(--muted); }
.side dd { color: var(--ink-camo); font-family: var(--display); font-weight: 700; font-size: 16px; }
.toast { border-radius: 0; background: var(--ink-camo); font-family: var(--display); font-weight: 700; }
/* Sign-in in the same voice */
body.login-page { background: var(--paper); }
.login-panel { width: min(400px, calc(100vw - 32px)); border-radius: 0; border-top: 4px solid var(--ink-camo); box-shadow: 0 14px 40px rgba(20,37,29,.10); padding: 30px 32px 32px; text-align: left; }
.login-panel h1 { margin: 26px 0 0; font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -0.035em; color: var(--ink-camo); }
.login-form { margin-top: 28px; gap: 12px; }
.login-form input { height: 44px; border: 2px solid var(--paper-line); border-radius: 0; padding: 0 12px; font-size: 15px; }
.login-form input:focus { outline: none; border-color: var(--ink-camo); }
.login-form .btn { height: 44px; font-size: 15px; }
@media (max-width: 760px) { .band { padding: 20px 16px 0; } .page { padding: 24px 16px 60px; } .inv-layout { grid-template-columns: 1fr; } .billto, .terms { grid-template-columns: 1fr; } }
/* Remove shows only on hover or keyboard focus of its row */
.grid .delRow { opacity: 0; transition: opacity .12s; } .grid tr:hover .delRow, .grid .delRow:focus-visible { opacity: 1; }
table.grid.fixed { table-layout: fixed; }
.filter { margin-bottom: 22px; gap: 16px; }
.filter label { display: inline-flex; align-items: center; gap: 8px; }
.grand thead { visibility: collapse; }
.grand table.grid tfoot td { border-top: 0; }
.grand { margin-top: 18px !important; border-top: 3px solid var(--ink-camo); }
/* Figures and invoice numbers in tabular digits, so every number sets at the same width; numbers and dates never break */
table.grid { font-variant-numeric: tabular-nums; }
.grid .nm, .grid .num, .grid td { white-space: nowrap; }
.grid td:nth-child(2) { white-space: normal; }
/* Narrow windows: the table scrolls inside its section instead of crushing its columns */
@media (max-width: 1100px) { table.grid.fixed { table-layout: auto; } .section { overflow-x: auto; } }
.matches { background: #fff; padding: 18px 22px 20px; border-left: 6px solid var(--orange); }
.matches .row { margin-top: 10px; }
.grid .delPipe { opacity: 0; transition: opacity .12s; } .grid tr:hover .delPipe, .grid .delPipe:focus-visible { opacity: 1; }
/* Reading: a pending contract line with an animated button until its data loads */
.grid tr.pending td { background: var(--camo-tint) !important; }
.btn.reading, .btn.reading:disabled { background: var(--camo); border-color: var(--camo); color: #fff; opacity: 1; cursor: progress; min-width: 104px; justify-content: flex-start; }
.btn.reading::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .btn.reading::after { animation: none; content: '...'; } }
input.f[data-date] { width: 124px; font-variant-numeric: tabular-nums; }
input.f.bad { border-color: var(--bad) !important; background: var(--bad-tint); }
/* Client cards: one per client, figures right-aligned on hairlines */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 14px; }
.ccard { display: flex; flex-direction: column; background: #fff; border-top: 4px solid var(--ink-camo); padding: 18px 20px 16px; color: var(--ink); text-decoration: none; box-shadow: 0 1px 0 var(--paper-line); }
.ccard:hover, .ccard:focus-visible { box-shadow: 0 10px 26px rgba(20,37,29,.10); }
.cc-head { display: flex; align-items: baseline; gap: 10px; min-height: 2.3em; }
.cc-head h3 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.1; letter-spacing: -0.02em; color: var(--ink-camo); }
.cc-contact { margin: 6px 0 14px; color: var(--muted); min-height: 1.4em; }
.ccard dl { display: grid; grid-template-columns: 1fr auto; margin: auto 0 0; }
.ccard dt, .ccard dd { padding: 8px 0; border-top: 1px solid var(--paper-line); }
.ccard dt { color: var(--muted); }
.ccard dd { margin: 0; text-align: right; font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--ink-camo); font-variant-numeric: tabular-nums; }
/* Contracts: the upload box sits at the top right of the masthead, a quarter of the page wide */
.head .actions:has(.drop.mini) { flex: 0 0 25%; align-self: flex-start; }
.drop.mini { width: 100%; padding: 14px 16px; gap: 12px; }
.drop.mini .big { font-size: 17px; }
.drop.mini .mu { font-size: 13px; }
/* Cards: names get two lines so contacts and figures line up across a row */
.cc-head { min-height: calc(2 * 1.1 * 22px); align-items: flex-start; }
.of + .of { margin-top: 26px; } .of .row { margin: 8px 0; } .of .row label { display: inline-flex; align-items: center; gap: 8px; } .of-actions { margin-top: 14px; } .of td { white-space: normal; } .grid .ofi-del { opacity: 0; } .grid tr:hover .ofi-del, .grid .ofi-del:focus-visible { opacity: 1; }
.section h2 .grow { flex: 1; } .section h2 .btn { font-size: 14px; }
#clientContracts.over { outline: 2px dashed var(--camo); outline-offset: 8px; background: var(--camo-tint); }
/* Client page: Bill To beside Company Contact, each one column, Save under the last field */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.pair .section + .section { margin-top: 0; }
form.billto { display: grid; grid-template-columns: minmax(0, 480px); gap: 12px; }
@media (max-width: 900px) { .pair { grid-template-columns: 1fr; } .pair .section + .section { margin-top: 44px; } }
.pair + .section { margin-top: 44px; }
/* Client cards: no top rule (the section heading carries the rule) and no hairlines between figures */
.ccard { border-top: 0; }
.ccard dt, .ccard dd { border-top: 0; padding: 5px 0; }
.section h2 .h-acts { display: inline-flex; align-items: center; gap: 10px; font-family: var(--sans); font-weight: 500; font-size: 14px; }
.section h2 .h-acts .f.sm { width: 124px; }
/* Contract page foot: when it was read, Read Again and Delete Contract, set apart from the sections above */
.page-foot { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--paper-line); gap: 12px; }
.page-foot .mu { flex: 1; }
/* Invoice preview logo: 15% smaller, the F of the wordmark on the text margin, closer to "Invoice" */
.paper .logo { width: 127.5px; margin: 0 0 22px -27.6px; }
.paper textarea.line { resize: none; overflow: hidden; min-height: 0; height: auto; padding: 2px 4px; }
.paper .inv-id { display: inline-block; min-width: 200px; }
.paper { border-top: 0; }
/* Order form items: tighter rows */
.of .grid td { padding-top: 3px; padding-bottom: 3px; }
.of .grid tbody tr:first-child td { padding-top: 6px; }
.of .grid select.f.sm { height: 30px; padding: 0 6px; }
.of-head { flex-wrap: wrap; }
.of-head .btn { margin-left: 4px; }
.details .row { margin-bottom: 10px; gap: 18px; } .details label { display: inline-flex; align-items: center; gap: 8px; }
/* Contract Details: labels above their fields, as on the client page */
.details .row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; margin-bottom: 16px; }
.details label { display: grid; gap: 4px; color: var(--ink-2); }
.details input.f { width: 200px; }
.details input.f[name="project"] { width: 280px; }
.details input.f[name="value"] { width: 160px; text-align: right; }
.details input.f[data-date] { width: 140px; }
.details { margin-top: 12px; }
/* Schedule: Select / Invoice toggle at the right; black when selected for the next invoice */
.btn.pick { min-width: 78px; justify-content: center; margin-left: 6px; }
.btn.pick.on, .btn.pick.on:hover { background: var(--ink-camo); border-color: var(--ink-camo); color: #fff; }
.schedsec .grid td:first-child { white-space: normal; }
/* Schedule buttons: fixed columns so nothing shifts; Remove keeps its space and shows on row hover, never while selected */
.schedsec td.act.rm { width: 92px; text-align: right; }
.schedsec td.act.sel { width: 96px; text-align: right; }
.schedsec .btn.pick { margin-left: 0; width: 86px; }
.schedsec .delRow { visibility: hidden; opacity: 1; }
.schedsec tr:hover .delRow:not([hidden-keep]), .schedsec .delRow:focus-visible { visibility: visible; }
/* Terms: no rules between entries */
.terms dt, .terms dd { border-bottom: 0; padding: 7px 0; }
input.money-in { text-align: right; font-variant-numeric: tabular-nums; }
.paper .two p:last-child { text-align: right; }
.paper th.num, .paper td.num { width: 1%; padding-left: 14px; }
/* Order form Remove: right edge, like every other row button */
#ofForm td.act { text-align: right; width: 96px; }
/* Heading counts: the heading's own face and size, in brand orange */
.section h2 .ct { font: inherit; letter-spacing: inherit; color: var(--orange); margin-left: 2px; }
input.f[readonly] { background: transparent; border-color: transparent; color: var(--ink); padding-left: 0; }
.details .notes { display: grid; max-width: 900px; } .details .notes textarea.f { min-height: 96px; font: inherit; line-height: 1.5; }
/* Notes: Markdown shown formatted; click to edit */
.details .notes { display: grid; gap: 4px; max-width: 900px; }
.details .notes .md { background: #fff; border: 2px solid var(--paper-line); padding: 10px 14px; min-height: 60px; cursor: text; line-height: 1.55; color: var(--ink); }
.details .notes .md:hover { border-color: var(--ink-camo); }
.details .notes .md.empty { color: var(--muted); }
.details .notes .md > :first-child { margin-top: 0; } .details .notes .md > :last-child { margin-bottom: 0; }
.details .notes .md h3, .details .notes .md h4, .details .notes .md h5 { font-family: var(--display); color: var(--ink-camo); margin: 12px 0 4px; }
.details .notes .md ul, .details .notes .md ol { margin: 6px 0; padding-left: 22px; }
.details .notes .md blockquote { margin: 6px 0; padding-left: 12px; border-left: 3px solid var(--paper-line); color: var(--ink-2); }
.details .notes .md code { background: var(--paper); padding: 1px 4px; font-size: 13px; }
.details .notes textarea.f { min-height: 140px; font: 13px/1.5 ui-monospace, monospace; }
/* Contracts: Signed pins to the top while its contracts scroll under it; Pipeline then takes its place */
#signedSec > h2, #pipeSec > h2 { position: sticky; top: 0; z-index: 5; background: var(--paper); padding-top: 14px; margin-top: -14px; }
#pipeSec { min-height: calc(100vh - 40px); }
/* Masthead figures spread across the full width */
.stats.wide { justify-content: space-between; gap: 24px; }
/* Users page: Add User dialog; roster actions spaced, shown on row hover */
dialog.modal { border: 0; border-top: 3px solid var(--ink-camo); padding: 28px 32px 26px; width: 440px; max-width: calc(100vw - 32px); background: var(--paper); color: inherit; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(14, 24, 40, .45); }
dialog.modal h2 { margin: 0 0 18px; padding: 0; border: 0; position: static; display: block; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--ink-camo); background: none; }
dialog.modal > form > p.mu { margin: -8px 0 16px; }
dialog.modal label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--muted, #555); }
dialog.modal .f { height: 40px; width: 100%; color: var(--ink, #111); font-size: 15px; }
dialog.modal .err { min-height: 18px; margin: 0 0 8px; color: var(--bad); font-size: 13px; }
/* Save comes first in the tab order; row-reverse keeps it at the right, after Cancel */
dialog.modal .btns { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 12px; }
#pageMsg:empty { display: none; }
#roster td.act { text-align: right; white-space: nowrap; width: 220px; }
#roster td.act .btn + .btn { margin-left: 14px; }
#roster td.act .btn { visibility: hidden; }
#roster tr:hover td.act .btn, #roster tr:focus-within td.act .btn { visibility: visible; }
@media (hover: none) { #roster td.act .btn { visibility: visible; } }
/* Viewer: fields read as plain values */
body.ro #app .f:disabled { border-color: transparent; background: transparent; padding-left: 0; color: inherit; opacity: 1; -webkit-appearance: none; appearance: none; cursor: default; }
body.ro #notesView { cursor: default; }
body.ro #app .f:disabled::placeholder { color: transparent; }
body.ro #app .md.empty { display: none; }
/* Users table role dropdown: same field as the Add User dialog */
#roster select.f.role { height: 32px; width: 160px; padding: 0 8px; }
.side h2 { display: flex; align-items: center; }
.side h2 .grow { flex: 1; }
.side h2 .btn { font-family: var(--sans); font-size: 14px; }
/* Contract PDF drawer: from the right, half the screen */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: max(50vw, 480px); max-width: 100vw; z-index: 70; background: var(--paper); box-shadow: -14px 0 40px rgba(14,26,43,.22); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease-out; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 3px solid var(--ink-camo); }
.drawer-head .dname { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-body { flex: 1; min-height: 0; overflow: auto; background: #e9edf2; padding: 4px 24px 40px; }
.drawer .pbox { position: relative; margin: 20px auto 0; background: #fff; box-shadow: 0 2px 10px rgba(14,26,43,.10); }
.drawer .pbox canvas { display: block; width: 100%; height: 100%; }
.drawer-head .zoom { display: inline-flex; align-items: center; gap: 6px; }
.drawer-head .zoom .btn { width: 32px; padding: 0; justify-content: center; font-size: 18px; line-height: 1; }
.drawer-head .zoom .mu { min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.drawer-body { overflow-x: auto; }
.band .head .btns { display: flex; gap: 12px; }
#renewals td.ren { text-align: right; white-space: nowrap; width: 150px; }
#renewals td.ren .btn + .btn { margin-left: 10px; }
.drawer .pbox .hl { position: absolute; z-index: 1; background: rgba(255, 196, 0, .38); mix-blend-mode: multiply; border-radius: 2px; pointer-events: none; }
button.lnk { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-camo); font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 3px; }

/* Responsive: iPad mini (744 portrait, 1133 landscape) and iPhone 15 (393) */
@media (max-width: 1200px) {
  .band { padding-left: 24px; padding-right: 24px; }
  .page { padding-left: 24px; padding-right: 24px; }
  .inv-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .paper { padding: 36px 40px 44px; }
}
@media (max-width: 900px) {
  .inv-layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .band .head { flex-wrap: wrap; }
  .head .actions:has(.drop.mini) { flex: 1 1 100%; }
}
@media (hover: none) {
  .grid .delRow, .grid .delPipe { opacity: 1; }
  .btn { height: 40px; }
  input.f, select.f { height: 40px; font-size: 16px; }
  textarea.f { font-size: 16px; }
  .f.sm { height: 36px; }
  .topnav a { padding-top: 17px; padding-bottom: 15px; }
}
@media (max-width: 600px) {
  .topbar { gap: 12px; padding: 0 12px; }
  .topnav { flex: 1; min-width: 0; gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { white-space: nowrap; }
  .band { padding: 18px 16px 0; }
  .page { padding: 20px 16px 56px; }
  .band .head { gap: 12px; }
  .band .head .grow { flex: 1 1 100%; }
  .band .head .btns { flex-wrap: wrap; width: 100%; }
  .band .head .btns .btn { flex: 1 1 auto; justify-content: center; }
  .stats, .stats.wide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; margin-top: 18px; }
  .stat .n { font-size: 26px; }
  .section { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .section h2, .section h2 .h-acts { flex-wrap: wrap; }
  .grid th, .grid td { padding-left: 8px; padding-right: 8px; }
  .row { gap: 8px; }
  .row.filter { align-items: stretch; }
  .paper { padding: 24px 28px 32px; }
  .paper .two { flex-wrap: wrap; }
  .paper .inv-id { min-width: 0; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .drop { flex-direction: column; align-items: flex-start; }
  .page-foot { flex-wrap: wrap; }
  dialog.modal { width: calc(100vw - 24px); padding: 22px 18px 20px; }
  dialog.modal .btns .btn { flex: 1; justify-content: center; }
}
@media (max-width: 430px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .brand-name { display: none; }
  .topnav { gap: 11px; font-size: 13.5px; }
  .grid:has(input.f, select.f) { min-width: 560px; }
}

/* Resizable columns */
table.grid.rs { table-layout: fixed; max-width: none; }
.grid.rs th { position: relative; }
.grid.rs th, .grid.rs td { overflow: hidden; text-overflow: ellipsis; }
.grid .rsz { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; touch-action: none; }
.grid .rsz::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: 3px; width: 1px; background: var(--ink-camo); opacity: 0; transition: opacity .12s; }
.grid th:hover .rsz::after, .grid .rsz.on::after { opacity: .6; }

/* Sortable columns */
.grid th.srt { cursor: pointer; user-select: none; }
.grid th.srt:hover { color: var(--ink); }
.grid th[data-sort]::after { content: " \25B2"; font-size: 9px; }
.grid th[data-sort="desc"]::after { content: " \25BC"; }

/* The rule under a section heading follows a table widened past the page */
.section > h2 { position: relative; }
.section > h2::after { content: ""; position: absolute; left: 0; bottom: -3px; height: 3px; width: max(100%, var(--tw, 0px)); background: var(--ink-camo); pointer-events: none; }

/* Buttons in a stacked form keep their own size */
.stack > .btn { justify-self: start; }
/* OKR Tracker */
.score-in { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
input.f.score-in.good { background: var(--good-tint); } input.f.score-in.blue { background: var(--blue-tint); } input.f.score-in.warn { background: var(--warn-tint); } input.f.score-in.bad { background: var(--bad-tint); }
.tab { text-decoration: none; }
.tabs { margin: 0 0 18px; }
.acct-menu select { width: 100%; }
.acct-mail { display: grid; gap: 4px; font-weight: 500; }
.grid td { white-space: normal; }
.grid td.num, .grid td.nm { white-space: nowrap; }
.row label, label.row { display: inline-flex; align-items: center; gap: 8px; }
