/* Marketing Command Centre — Central Marketing Reporting Portal */

:root {
  --bg:        #f4f6f9;
  --panel:     #ffffff;
  --ink:       #1b2230;
  --ink-soft:  #5f6979;
  --ink-mute:  #8a93a3;
  --line:      #dde2ea;
  --line-soft: #eceff4;
  --accent:    #1d5fd0;
  --accent-sf: #eaf1fd;
  --green:     #1a7f44;
  --green-bg:  #e6f5ec;
  --amber:     #a76a00;
  --amber-bg:  #fdf3e0;
  --red:       #b3261e;
  --red-bg:    #fdecea;
  --grey-bg:   #eef0f4;
  /* Chart palette — validated with the data-viz palette validator against the
     #ffffff card surface (lightness band, chroma, CVD separation, contrast).
     Slot order is the colourblind-safety mechanism; do not re-order casually. */
  --s1: #2a78d6;  --s2: #eb6834;  --s3: #1baf7a;  --s4: #eda100;
  --s5: #e87ba4;  --s6: #008300;  --s7: #4a3aa7;  --s8: #e34948;
  --grid:     #e1e0d9;
  --axis:     #c3c2b7;
  --ink-axis: #898781;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--accent); }

/* ------------------------------------------------------------- chrome */

/* The top bar and the nav strip travel together and stay put, so the sheet
   you are on and the way out are always on screen however far you scroll. */
.apphead { position: sticky; top: 0; z-index: 50; }

.topbar {
  background: #16202f;
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar .brandmark { font-weight: 650; letter-spacing: .2px; font-size: 15px; }
.topbar .brandmark span { color: #8fb4f5; font-weight: 400; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12.5px; color: #9fabbd; }
.topbar a.btn-top {
  color: #dce6f5; text-decoration: none; font-size: 13px;
  border: 1px solid #33425a; border-radius: 6px; padding: 5px 11px;
}
.topbar a.btn-top:hover { background: #22304a; }
.topbar a.btn-top.danger { border-color: #5a3340; color: #f3c9c9; }
.topbar a.btn-top.danger:hover { background: #46212b; color: #fff; }

.navstrip {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
}
.navstrip a {
  padding: 11px 14px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.navstrip a:hover { color: var(--ink); background: var(--line-soft); }
.navstrip a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.navstrip a .ro { font-size: 10.5px; color: var(--ink-mute); margin-left: 5px; }

.wrap { padding: 20px; }
/* Reading width for a single column of prose or one short form. */
.wrap-narrow { max-width: 1000px; margin: 0 auto; padding: 24px 20px; }
/* The management screens — rosters and long forms. Wide enough that a nine
   column table is not squeezed into a third of a modern display, capped so the
   lines never run away on an ultrawide. */
.wrap-page { max-width: 1440px; margin: 0 auto; padding: 24px 20px; }
.wrap-page > .card,
.wrap-page > .block { width: 100%; }

.pagehead { margin-bottom: 16px; }
.pagehead h1 { margin: 0 0 3px; font-size: 19px; letter-spacing: .2px; }
.pagehead .sub { color: var(--ink-soft); font-size: 13px; }
.pagehead .note {
  margin-top: 8px; font-size: 12.5px; color: var(--ink-soft);
  background: var(--accent-sf); border: 1px solid #cfe0fa;
  border-radius: 6px; padding: 7px 11px; display: inline-block;
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-block; font: inherit; font-size: 13px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 6px; padding: 7px 13px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--line-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1a54b8; }
.btn-danger { color: var(--red); border-color: #e9c3c0; }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 4px 9px; font-size: 12px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.toolbar select, .toolbar input {
  font: inherit; font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink);
}

/* --------------------------------------------------------------- grid */

.gridbox {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: calc(100vh - 260px);
  /* Hug the table. A four-column sheet like Lists would otherwise sit in a
     full-width white box with most of it empty; a wide sheet still scrolls. */
  width: max-content;
  max-width: 100%;
}
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid th, table.grid td {
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 0;
  vertical-align: top;
}
table.grid thead th {
  position: sticky; top: 0; z-index: 3;
  background: #f0f3f8; color: var(--ink);
  font-weight: 600; font-size: 12px; text-align: left;
  padding: 8px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.grid tbody th.rowhead,
table.grid thead th.corner {
  position: sticky; left: 0; z-index: 2;
  background: #f7f9fc; font-weight: 600; text-align: left;
  padding: 0; white-space: nowrap;
  border-right: 1px solid var(--line);
}
table.grid thead th.corner { z-index: 4; background: #f0f3f8; }

table.grid td .cell, table.grid th.rowhead .cell {
  display: block; padding: 6px 10px; min-height: 30px;
  max-width: 360px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
table.grid td.num .cell { text-align: right; font-variant-numeric: tabular-nums; }

/* Column widths live on the cell, so a <select> or <input> fills them too and
   values like "Digital Marketing" are readable rather than clipped to "Digit". */
table.grid td            { min-width: 120px; }
table.grid td.t-select   { min-width: 160px; }
table.grid td.t-date     { min-width: 148px; }
table.grid td.t-text,
table.grid td.t-url      { min-width: 170px; }
table.grid td.wide       { min-width: 240px; }
table.grid td.t-int,
table.grid td.t-money,
table.grid td.t-dec      { min-width: 118px; }
table.grid td.idcell     { min-width: 104px; }
table.grid td.computed   { min-width: 112px; }

table.grid td input, table.grid td select, table.grid td textarea {
  font: inherit; font-size: 13px; width: 100%; border: 0; background: transparent;
  padding: 6px 10px; color: inherit; border-radius: 0; outline: none;
}
table.grid td input:focus, table.grid td select:focus, table.grid td textarea:focus {
  box-shadow: inset 0 0 0 2px var(--accent); background: #fff;
}
table.grid td.computed { background: #f8f9fb; color: var(--ink-mute); }
table.grid td.computed .cell { font-style: normal; }
table.grid td.idcell .cell { font-weight: 600; color: var(--ink-soft); }
table.grid tbody tr:hover td { background: #fbfcfe; }
table.grid tbody tr:hover td.computed { background: #f4f6f9; }

td.rag-red    .cell, .rag-red    { background: var(--red-bg);   color: var(--red);   font-weight: 600; }
td.rag-amber  .cell, .rag-amber  { background: var(--amber-bg); color: var(--amber); font-weight: 600; }
td.rag-green  .cell, .rag-green  { background: var(--green-bg); color: #1a7f44;      font-weight: 600; }
td.rag-done   .cell, .rag-done   { background: var(--grey-bg);  color: var(--ink-soft); }

.rowtools { display: flex; gap: 4px; align-items: center; padding: 4px 8px; }
.rowtools button {
  border: 0; background: transparent; cursor: pointer; color: var(--ink-mute);
  font-size: 13px; padding: 2px 5px; border-radius: 4px; line-height: 1;
}
.rowtools button:hover { background: var(--line-soft); color: var(--ink); }
.rowtools .rn { font-size: 11px; color: var(--ink-mute); min-width: 24px; }

/* ------------------------------------------------------------- status */

.savestate {
  font-size: 12.5px; padding: 4px 10px; border-radius: 20px;
  border: 1px solid transparent; visibility: hidden;
}
.savestate.on { visibility: visible; }
.savestate.saving { background: var(--amber-bg); color: var(--amber); border-color: #f0dcb4; }
.savestate.saved  { background: var(--green-bg); color: #1a7f44;      border-color: #c3e6d1; }
.savestate.error  { background: var(--red-bg);   color: var(--red);   border-color: #f0c8c8; }

/* ------------------------------------------------------- tiles/tables */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.tile .k { font-size: 11.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.tile .v { font-size: 21px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile.red   .v { color: var(--red); }
.tile.amber .v { color: var(--amber); }
.tile.green .v { color: #1a7f44; }

.block { margin-bottom: 26px; }
.block > h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--ink-soft); margin: 0 0 10px; font-weight: 650;
}

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

table.data {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 13px;
}
table.data th, table.data td { padding: 7px 11px; border-bottom: 1px solid var(--line-soft); text-align: left; }
table.data tbody td:first-child { white-space: nowrap; }
table.data thead th {
  background: #f0f3f8; font-size: 11.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .3px; color: var(--ink-soft); white-space: nowrap;
}
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fafbfd; }
.scrollx { overflow-x: auto; }

/* ------------------------------------------------------------- charts */

.chartgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
.chartcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.chartcard h3 { margin: 0 0 10px; font-size: 13px; font-weight: 650; color: var(--ink); }
.chartcard svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* -------------------------------------------------------------- forms */

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; }
.card > h2 { margin: 0 0 14px; font-size: 15px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 4px; font-weight: 600; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 13.5px; width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.field textarea { min-height: 70px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--ink-mute); margin-top: 3px; }
.fieldrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }

.pill { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
/* Status pills named by tone, so a module can colour a state without
   knowing which words the rest of the portal happens to use. */
.pill.green { background: var(--green-bg); color: #1a7f44; }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red   { background: var(--red-bg);   color: var(--red); }
.pill.grey  { background: var(--grey-bg);  color: var(--ink-soft); }

/* The strip that holds one desk's pages together (Finance: Overview,
   Invoices, Compliance, Expenses). Sits under the page title, not beside
   the main nav, so it never competes with it. */
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.subtabs a {
  padding: 8px 15px; font-size: 13.5px; font-weight: 550; color: var(--ink-soft);
  text-decoration: none; border: 1px solid transparent; border-bottom: 0;
  border-radius: 7px 7px 0 0; margin-bottom: -1px;
}
.subtabs a:hover { color: var(--ink); background: var(--panel); }
.subtabs a.on {
  color: var(--ink); background: #fff; border-color: var(--line);
  border-bottom: 1px solid #fff;
}
.pill.ok      { background: var(--green-bg); color: #1a7f44; }
.pill.expired { background: var(--amber-bg); color: var(--amber); }
.pill.revoked { background: var(--red-bg);   color: var(--red); }
.pill.view    { background: var(--grey-bg);  color: var(--ink-soft); }
.pill.edit    { background: var(--accent-sf);color: var(--accent); }

.tokenlink {
  font: 12.5px/1.5 ui-monospace, Consolas, monospace; background: #f4f6fa;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px;
  word-break: break-all; display: inline-block;
}

.flash { padding: 10px 14px; border-radius: 7px; margin-bottom: 14px; font-size: 13.5px; }
.flash.ok  { background: var(--green-bg); color: #1a6b3c; border: 1px solid #c3e6d1; }
.flash.err { background: var(--red-bg);   color: var(--red); border: 1px solid #f0c8c8; }

.empty { color: var(--ink-mute); font-size: 13px; padding: 18px; text-align: center; }

/* -------------------------------------------------------------- panel */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 92vw);
  background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -8px 0 28px rgba(20,28,44,.13); z-index: 50;
  display: none; flex-direction: column;
}
.drawer.on { display: flex; }
.drawer header {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.drawer header h3 { margin: 0; font-size: 14px; flex: 1; }
.drawer .body { padding: 14px 18px; overflow: auto; flex: 1; }
.drawer .entry { padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.drawer .entry .meta { font-size: 11.5px; color: var(--ink-mute); margin-bottom: 3px; }
.drawer .entry del { color: var(--red); text-decoration: line-through; }
.drawer .entry ins { color: #1a7f44; text-decoration: none; }

/* ------------------------------------------------------------- tones */
/* One tone per meaning, used everywhere: grid cells, pills, tiles, calendar.
   Tints are kept light so text stays legible; the left rule carries the tone. */

:root {
  --tone-good-ink:    #1a6b3c; --tone-good-bg:    #e9f6ee; --tone-good-line:    #a9dcbf;
  --tone-info-ink:    #1e4f9c; --tone-info-bg:    #eaf1fd; --tone-info-line:    #b4cdf5;
  --tone-warn-ink:    #8a5300; --tone-warn-bg:    #fff4e0; --tone-warn-line:    #f2d49a;
  --tone-risk-ink:    #9f1f1a; --tone-risk-bg:    #fdeceb; --tone-risk-line:    #f0b8b4;
  --tone-muted-ink:   #5f6979; --tone-muted-bg:   #f0f2f5; --tone-muted-line:   #d5dae2;
  --tone-neutral-ink: #1b2230; --tone-neutral-bg: transparent; --tone-neutral-line: transparent;
}

.pill.tone-good,    .tone-good    { background: var(--tone-good-bg);    color: var(--tone-good-ink); }
.pill.tone-info,    .tone-info    { background: var(--tone-info-bg);    color: var(--tone-info-ink); }
.pill.tone-warn,    .tone-warn    { background: var(--tone-warn-bg);    color: var(--tone-warn-ink); }
.pill.tone-risk,    .tone-risk    { background: var(--tone-risk-bg);    color: var(--tone-risk-ink); }
.pill.tone-muted,   .tone-muted   { background: var(--tone-muted-bg);   color: var(--tone-muted-ink); }
.pill.tone-neutral, .tone-neutral { background: var(--tone-neutral-bg); color: var(--tone-neutral-ink); }

/* A status dot beside the label, so tone is never colour-alone. */
.pill .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: currentColor; opacity: .85; vertical-align: 1px; }

/* Grid cells: tint the whole cell and give the <select> a matching ink. */
table.grid td.tone-good,  table.grid td.tone-good  select { background: var(--tone-good-bg);  color: var(--tone-good-ink);  font-weight: 600; }
table.grid td.tone-info,  table.grid td.tone-info  select { background: var(--tone-info-bg);  color: var(--tone-info-ink);  font-weight: 600; }
table.grid td.tone-warn,  table.grid td.tone-warn  select { background: var(--tone-warn-bg);  color: var(--tone-warn-ink);  font-weight: 600; }
table.grid td.tone-risk,  table.grid td.tone-risk  select { background: var(--tone-risk-bg);  color: var(--tone-risk-ink);  font-weight: 600; }
table.grid td.tone-muted, table.grid td.tone-muted select { background: var(--tone-muted-bg); color: var(--tone-muted-ink); }
table.grid td[class*="tone-"] { box-shadow: inset 3px 0 0 currentColor; }
table.grid td.tone-neutral { box-shadow: none; }
table.grid tbody tr:hover td[class*="tone-"] { filter: saturate(1.15); }

/* Dashboard table cells and readiness verdicts reuse the same tones. */
table.data td.tone-good, table.data td.tone-info, table.data td.tone-warn,
table.data td.tone-risk, table.data td.tone-muted { font-weight: 600; box-shadow: inset 3px 0 0 currentColor; }

/* Legend chips explaining the tones, shown once above a grid. */
.tonekey { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-soft); margin: 0 0 10px; }
.tonekey .pill { font-weight: 600; }

/* --------------------------------------------------------- workload */
.bar { position: relative; height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; min-width: 90px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--s1); }
.bar.warn > i { background: #eda100; } .bar.risk > i { background: #d03b3b; } .bar.muted > i { background: #b6bdc8; }
.balance { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }

/* --------------------------------------------------------- calendar */
.calhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.calhead h3 { margin: 0; font-size: 15px; min-width: 160px; }
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.calgrid .dow { background: #f0f3f8; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .3px; color: var(--ink-soft); padding: 6px 8px; }
.calgrid .day { background: var(--panel); min-height: 96px; padding: 5px 6px; font-size: 12px; }
.calgrid .day.other { background: #fafbfc; color: var(--ink-mute); }
.calgrid .day.today { background: #fffbeb; }
.calgrid .day .n { font-size: 11.5px; font-weight: 650; color: var(--ink-soft); margin-bottom: 4px; display: flex; justify-content: space-between; }
.calgrid .day.today .n { color: var(--amber); }
.chip { display: block; font-size: 11px; line-height: 1.35; padding: 2px 6px; border-radius: 4px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid transparent; }
.chip.src-event    { background: #eaf1fd; color: #1e4f9c; border-left-color: #2a78d6; }
.chip.src-festival { background: #fdeee7; color: #8a3a12; border-left-color: #eb6834; }
.chip.src-content  { background: #e6f6ef; color: #1a6b3c; border-left-color: #1baf7a; }
.chip.src-campaign { background: #fff6e0; color: #7a4b00; border-left-color: #eda100; }
.chip.src-design   { background: #f3eefb; color: #4a3aa7; border-left-color: #4a3aa7; }
.chip.src-creative { background: #fde9f1; color: #8a2a52; border-left-color: #e87ba4; }
.chip.more { background: transparent; color: var(--ink-mute); border-left-color: transparent; padding-left: 4px; }
.callegend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--ink-soft); margin-top: 10px; }
.callegend label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.callegend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ------------------------------------------------------- intake form */
.formwrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 60px; }
.formwrap .card { padding: 22px 24px; }
.formwrap h1 { font-size: 20px; margin: 0 0 4px; }
.formwrap .lead { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 18px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.formgrid .field.full { grid-column: 1 / -1; }
.req { color: var(--red); margin-left: 2px; }

/* Inline column tools (admin): click a header to rename, gear to edit options. */
table.grid thead th.renamable { cursor: text; }
table.grid thead th.renamable:hover .hlabel { text-decoration: underline dotted var(--ink-mute); text-underline-offset: 3px; }
table.grid thead th.renamable.renamed .hlabel::after { content: ' \2022'; color: var(--accent); }
table.grid thead th input.hedit {
  font: inherit; font-size: 12px; font-weight: 600; padding: 2px 6px; margin: -3px 0;
  border: 1px solid var(--accent); border-radius: 4px; background: #fff; color: var(--ink); min-width: 140px; outline: none;
}
.colgear { border: 0; background: transparent; cursor: pointer; color: var(--ink-mute); font-size: 12px; margin-left: 2px; padding: 0 3px; opacity: .55; line-height: 1; }
.colgear:hover { color: var(--accent); opacity: 1; }

/* options editor rows inside the drawer */
.optrow { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.optrow input.oval { font: inherit; font-size: 13px; flex: 1; padding: 5px 8px; border: 1px solid transparent; border-radius: 6px; min-width: 0; }
.optrow input.oval:focus { border-color: var(--line); outline: none; background: #fff; }
.optrow.hidden input.oval { color: var(--ink-mute); text-decoration: line-through; }
.optrow button { border: 1px solid var(--line); background: var(--panel); border-radius: 5px; cursor: pointer; font-size: 12px; padding: 3px 7px; color: var(--ink-soft); }
.optrow button:hover { background: var(--line-soft); color: var(--ink); }
.optrow button.danger:hover { background: var(--red-bg); color: var(--red); border-color: #e9c3c0; }
.optadd { display: flex; gap: 6px; margin: 4px 0 12px; }
.optadd input { font: inherit; font-size: 13px; flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; }
.optmsg { font-size: 12.5px; color: var(--ink-soft); min-height: 18px; margin-bottom: 6px; }

/* ------------------------------------------------- files & review */
.rowtools button b { font-size: 9.5px; font-weight: 700; margin-left: 2px; vertical-align: 2px; }
.js-files b { color: var(--accent); }

.filelist { display: flex; flex-direction: column; gap: 10px; }
.fileitem { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.fileitem .thumb { width: 52px; height: 52px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; background: #f4f6fa; flex: none; }
.fileitem .ficon { width: 52px; height: 52px; border-radius: 6px; border: 1px solid var(--line); background: #f4f6fa; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--ink-mute); flex: none; text-transform: uppercase; }
.fileitem .meta { flex: 1; min-width: 0; }
.fileitem .meta a { font-weight: 600; word-break: break-all; }
.fileitem .meta .sub { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }

.dropzone { border: 2px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center; color: var(--ink-soft); font-size: 13px; margin-bottom: 14px; cursor: pointer; background: #fbfcfe; }
.dropzone.over { border-color: var(--accent); background: var(--accent-sf); color: var(--accent); }
.dropzone input { display: none; }

.reviewnow { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }
.reviewnow .state { font-size: 15px; font-weight: 700; }
.reviewnow .who { font-size: 12px; opacity: .85; margin-top: 2px; }
.reviewnow .rem { margin-top: 8px; font-size: 13px; background: rgba(255,255,255,.65); border-radius: 6px; padding: 8px 10px; }
.reviewacts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.btn-approve { background: var(--tone-good-bg); border-color: var(--tone-good-line); color: var(--tone-good-ink); font-weight: 600; }
.btn-approve:hover { background: #d9efe3; }
.btn-reject { background: var(--tone-risk-bg); border-color: var(--tone-risk-line); color: var(--tone-risk-ink); font-weight: 600; }
.btn-reject:hover { background: #fadedb; }
.rejectbox { margin-top: 10px; }
.rejectbox textarea { font: inherit; font-size: 13px; width: 100%; min-height: 80px; padding: 8px 10px; border: 1px solid var(--tone-risk-line); border-radius: 6px; }
.rejectbox .warn { font-size: 12px; color: var(--tone-risk-ink); margin-top: 4px; }

/* ------------------------------------------------- people & access forms */

/* A long form reads as a few labelled sections rather than one wall. */
.formsec { margin: 22px 0 14px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.formsec:first-of-type { margin-top: 6px; padding-top: 0; border-top: 0; }
.formsec > h3 { margin: 0 0 2px; font-size: 12px; text-transform: uppercase;
                letter-spacing: .6px; color: var(--ink-soft); }
.formsec > .lead { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-mute); }

/* Fields line up on a real grid, so labels and inputs share a baseline. */
.fieldrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.fieldrow.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.field input, .field select, .field textarea { width: 100%; }

/* Sheet access on a creation form: name on the left, one select on the right,
   every row the same height however long the sheet name is. */
.sheetgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 18px; }
.sheetgrid .row { display: flex; align-items: center; gap: 10px; min-height: 40px;
                  padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.sheetgrid .row span.name { flex: 1; font-size: 13px; }
.sheetgrid .row select { width: 132px; flex: none; font: inherit; font-size: 12.5px;
                         padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
                         background: var(--panel); color: var(--ink); }

/* Rights are granted beside sheets, and read the same way. */
.permtable td { vertical-align: top; }
.permtable td .hint { margin-top: 3px; }
.permtable .permcol { width: 90px; text-align: center; vertical-align: middle; }
.permtable .permcol input { width: 16px; height: 16px; }
table.data.permtable th, table.data.permtable td { padding: 10px 12px; }

/* Sheet access as radio columns: the choices line up under their headings
   instead of hugging the left edge of a column sized by its label. */
table.data.accesstable { table-layout: fixed; }
table.data.accesstable th, table.data.accesstable td { padding: 9px 12px; }
table.data.accesstable thead th + th,
table.data.accesstable tbody td + td { width: 110px; text-align: center; }
table.data.accesstable tbody td + td { vertical-align: middle; }
table.data.accesstable tbody td:first-child { white-space: normal; }
table.data.accesstable input[type="radio"] { width: 16px; height: 16px; margin: 0; cursor: pointer; }
table.data.accesstable tbody tr:hover td { background: #fafbfd; }
.accesstable .pill { margin-left: 6px; }
@media (max-width: 620px) {
  table.data.accesstable thead th + th,
  table.data.accesstable tbody td + td { width: 64px; padding: 9px 4px; font-size: 11.5px; }
}

/* The buttons that end a form, always on their own line. */
.formfoot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
            margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.formfoot .note { font-size: 12.5px; color: var(--ink-mute); }

/* A creation form kept out of the way until it is wanted. <details> does the
   work, so it opens with no script and still opens for a keyboard. */
.addbox { margin-bottom: 16px; }
.addbox > summary {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 13.5px; font-weight: 600;
  background: var(--accent); border: 1px solid var(--accent); color: #fff;
  border-radius: 7px; padding: 9px 16px; cursor: pointer; list-style: none;
  user-select: none;
}
.addbox > summary::-webkit-details-marker { display: none; }
.addbox > summary::marker { content: ''; }
.addbox > summary:hover { background: #1a54b8; }
.addbox > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.addbox > summary .chev { font-size: 15px; line-height: 1; }
.addbox[open] > summary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.addbox[open] > summary:hover { background: var(--line-soft); }
.addbox[open] > summary .chev { transform: rotate(45deg); display: inline-block; }
.addbox > .card { margin-top: 12px; }

/* =========================================================== sign-in ===
   A two-panel entrance: the product on the left, the one thing you came to
   do on the right. On a phone the left panel folds away to a slim header. */

.authbody { margin: 0; background: var(--panel); }
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

/* ---- the brand panel ---- */
.authside {
  position: relative; overflow: hidden;
  background: linear-gradient(155deg, #16202f 0%, #1b2d4d 45%, #1d5fd0 140%);
  color: #fff; padding: 56px 56px 40px;
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
/* A soft wash so the flat gradient has some depth behind the text. */
.authside::after {
  content: ''; position: absolute; inset: auto -20% -45% -20%; height: 70%;
  background: radial-gradient(60% 100% at 50% 100%, rgba(42,120,214,.5), transparent 70%);
  pointer-events: none;
}
.authside > * { position: relative; z-index: 1; }
.authside h2 {
  margin: 0; font-size: 30px; line-height: 1.25; letter-spacing: -.4px; font-weight: 680;
  max-width: 15ch;
}
.authside p { margin: 0; max-width: 46ch; font-size: 15px; line-height: 1.65; color: #b9c9e4; }
.authpoints { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; }
.authpoints li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: #d7e3f5; }
.authpoints li::before {
  content: '✓'; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #8fc0ff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.authfoot {
  margin-top: auto; padding-top: 28px; font-size: 12.5px; color: #7f93b5;
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ---- the wordmark, in the panel and again above the form on mobile ---- */
.authbrand { display: flex; align-items: center; gap: 12px; }
.authbrand .mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 19px; font-weight: 800;
  background: #fff; color: #16202f; letter-spacing: -.5px;
}
.authbrand .name { font-size: 16px; font-weight: 680; letter-spacing: .2px; }
.authbrand.small { display: none; margin-bottom: 26px; color: var(--ink); }
.authbrand.small .mark { background: #16202f; color: #fff; width: 36px; height: 36px; font-size: 17px; }

/* ---- the form side ---- */
.authmain {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px 28px; background: var(--bg);
}
.authcard {
  width: 100%; max-width: 400px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 34px 34px 30px; box-shadow: 0 18px 44px rgba(22,32,47,.09);
}
.authcard h1 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.3px; }
.authcard .lead { margin: 0 0 22px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.6; }
.authcard .field { margin-bottom: 15px; }
.authcard .field label { font-size: 12.5px; font-weight: 650; color: var(--ink-soft); }
.authcard .field input {
  padding: 11px 13px; font-size: 14.5px; border-radius: 8px; border: 1px solid var(--line);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.authcard .field input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-sf);
}
.authcard .flash { margin-bottom: 18px; }
.authgo {
  width: 100%; padding: 12px; font-size: 14.5px; font-weight: 650; border-radius: 8px;
  margin-top: 6px;
}

/* the one-time code, spaced out so six digits are easy to read back */
.authcard input.otp {
  font: 600 26px/1.2 ui-monospace, Consolas, monospace;
  letter-spacing: 14px; text-indent: 14px; text-align: center; padding: 13px 10px;
}

.authalt { margin-top: 18px; text-align: center; font-size: 13px; }
.authalt a { color: var(--accent); text-decoration: none; font-weight: 600; }
.authalt a:hover { text-decoration: underline; }
.authnote {
  margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--ink-mute); line-height: 1.6; text-align: center;
}
.authresend {
  margin-top: 14px; text-align: center; font-size: 12.5px; color: var(--ink-mute);
}
.linkbtn {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 600;
  color: var(--accent); cursor: pointer; text-decoration: underline;
}
.authlegal { margin-top: 26px; font-size: 12px; color: var(--ink-mute); }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; min-height: 100dvh; }
  .authside { display: none; }
  .authbrand.small { display: flex; }
  .authmain { justify-content: flex-start; padding: 40px 18px 24px; background: var(--panel); }
  .authcard { border: 0; box-shadow: none; padding: 0; max-width: 420px; }
  .authcard h1 { font-size: 21px; }
}

/* the unread count beside Notifications */
.navstrip a .badge {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 6px;
  background: var(--red); color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 700; text-align: center; line-height: 16px;
}

/* ============================================================ invoices ===
   A document meant to be read, and to print onto one page cleanly. */

.invbody { background: var(--bg); margin: 0; padding: 0 0 40px; }
.invtools {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  max-width: 820px; margin: 0 auto; padding: 18px 20px 10px;
}
.invoice {
  max-width: 820px; margin: 0 auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 40px 44px;
  box-shadow: 0 10px 30px rgba(22,32,47,.06);
}
.invhead { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start;
           padding-bottom: 22px; border-bottom: 2px solid var(--ink); }
.invfrom { font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.invsub  { font-size: 12.5px; color: var(--ink-mute); margin-top: 2px; }
.invmeta { text-align: right; }
.invmeta h1 { margin: 0; font-size: 26px; letter-spacing: 2px; text-transform: uppercase;
              color: var(--ink-soft); font-weight: 650; }
.invmeta .num { font: 600 15px ui-monospace, Consolas, monospace; margin: 2px 0 6px; }

.invparties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0 28px; }
.invparties h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase;
                 letter-spacing: .7px; color: var(--ink-mute); }
.invparties .big { font-size: 15px; font-weight: 650; }
.invparties .muted, .invoice .muted { color: var(--ink-mute); }

table.data.invlines { border: 0; border-radius: 0; }
table.data.invlines thead th { background: transparent; border-bottom: 1px solid var(--ink); }
table.data.invlines td { border-bottom: 1px solid var(--line-soft); padding: 10px 11px; }

.invtotals { margin: 18px 0 0; margin-left: auto; width: 300px; font-size: 14px; }
.invtotals > div { display: flex; justify-content: space-between; padding: 7px 0; }
.invtotals .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 11px;
                    font-size: 17px; }
.invtotals .grand strong { font-weight: 700; }

.invaddr { font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; margin-top: 6px;
           white-space: pre-line; }
.invbank { margin-top: 28px; padding: 14px 16px; border: 1px solid var(--line);
           border-radius: 8px; background: var(--line-soft); }
.invbank h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase;
              letter-spacing: .7px; color: var(--ink-mute); }
.invbank pre { margin: 0; font: 13px/1.7 ui-monospace, Consolas, monospace;
               white-space: pre-wrap; color: var(--ink); }

.invnotes { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.invnotes h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase;
               letter-spacing: .7px; color: var(--ink-mute); }
.invnotes p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; }
.invfoot { margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line-soft);
           font-size: 12px; color: var(--ink-mute); text-align: center; }

/* an invoice's own screen: what it is, and where it is up to */
.invcard { padding-top: 24px; }
.invtop { display: flex; justify-content: space-between; align-items: flex-start;
          gap: 20px; flex-wrap: wrap; }
.invnum { font: 700 22px ui-monospace, Consolas, monospace; letter-spacing: -.5px; }
.invwho { font-size: 14px; color: var(--ink-soft); margin-top: 3px; }
.invamt { text-align: right; }
.invamt .k { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-mute); }
.invamt .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }

/* Draft -> Sent -> Paid, always in that order. */
.invsteps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr);
            gap: 10px; margin: 22px 0 0; padding: 0; }
.invsteps li { display: flex; gap: 11px; align-items: flex-start;
               padding: 13px 15px; border: 1px solid var(--line);
               border-radius: 9px; background: var(--panel); }
.invsteps .dot { flex: none; width: 26px; height: 26px; border-radius: 50%;
                 display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
                 background: var(--line-soft); color: var(--ink-mute); }
.invsteps .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.invsteps .txt strong { font-size: 13.5px; }
.invsteps .txt em { font-style: normal; font-size: 12px; color: var(--ink-mute); line-height: 1.45; }
.invsteps li.done { border-color: #bfe6c8; background: var(--green-bg); }
.invsteps li.done .dot { background: var(--green); color: #fff; }
.invsteps li.done .txt strong { color: #15663a; }
.invsteps li.now { border-color: var(--accent); background: var(--accent-sf);
                   box-shadow: 0 0 0 3px rgba(29,95,208,.08); }
.invsteps li.now .dot { background: var(--accent); color: #fff; }
.invsteps li.now .txt strong { color: var(--accent); }
.invsteps li.todo { opacity: .7; }
@media (max-width: 760px) { .invsteps { grid-template-columns: 1fr; } }

.invnext { margin-top: 16px; padding: 12px 15px; border-radius: 8px;
           background: var(--line-soft); font-size: 13.5px; line-height: 1.6; }
.invnext { display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
           justify-content: space-between; }
.invnext .say { flex: 1; min-width: 240px; }
.invnext .act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.invnext .act input {
  font: inherit; font-size: 13px; padding: 8px 11px; min-width: 200px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink);
}
.invnext em { font-style: normal; font-weight: 650; }
.rowacts { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.invnext .late { color: var(--red); font-weight: 650; }

/* the editable line table on the admin side */
table.data.invitems td { padding: 4px 6px; }
table.data.invitems input {
  font: inherit; font-size: 13px; width: 100%; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink);
}
table.data.invitems td.num input { text-align: right; }

@media print {
  .invtools { display: none; }
  .invbody  { background: #fff; }
  .invoice  { border: 0; box-shadow: none; max-width: none; margin: 0; padding: 0; }
}

/* the client picker that narrows a sheet to one client */
.toolbar #clientpick { min-width: 210px; font-weight: 600; }
.filternote { font-size: 12.5px; color: var(--ink-soft); }

/* asking for something to be deleted */
.delask { margin-top: 10px; }
.delask textarea {
  font: inherit; font-size: 13px; width: 100%; min-height: 62px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; margin: 8px 0;
}
.delask .row { display: flex; gap: 8px; flex-wrap: wrap; }
.delform { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delform input[name="note"] {
  font: inherit; font-size: 12.5px; padding: 5px 9px; min-width: 190px;
  border: 1px solid var(--line); border-radius: 6px;
}

/* the notification centre */
.inboxbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.inboxbar .spacer { flex: 1; }
.inboxbar form { display: flex; gap: 8px; flex-wrap: wrap; }
.inboxlist { padding: 0; }
.inboxlist .notice {
  display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.inboxlist .notice:last-child { border-bottom: 0; }
.inboxlist .notice.new { background: var(--accent-sf); }
.inboxlist .notice .body { flex: 1; min-width: 0; }
.inboxlist .notice .t { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.inboxlist .notice .t .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.inboxlist .notice .b { font-size: 13.5px; color: var(--ink-soft); margin-top: 4px; }
.inboxlist .notice .when { font-size: 11.5px; color: var(--ink-mute); margin-top: 6px; }
.inboxlist .notice .acts { display: flex; gap: 8px; align-items: center; flex: none; }
.inboxlist .notice .acts form { display: flex; gap: 6px; }

/* profile details, read as label / value pairs */
.proftable { display: grid; gap: 0; }
.proftable .prow {
  display: grid; grid-template-columns: 210px 1fr; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.proftable .prow:last-child { border-bottom: 0; }
.proftable .prow .k { font-size: 12.5px; font-weight: 650; color: var(--ink-soft); }
.proftable .prow .v { font-size: 13.5px; }
.proftable .prow .v .none { color: var(--ink-mute); }
@media (max-width: 560px) { .proftable .prow { grid-template-columns: 1fr; gap: 2px; } }

/* the approval history of a sheet, for the people who have to act on it */
.approvalblock > h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.approvalblock > h2 .pill { text-transform: none; letter-spacing: 0; font-weight: 600; }
table.data.approvaltable td { vertical-align: top; }
table.data.approvaltable tbody td:first-child { white-space: normal; max-width: 280px; }
.approvaltable .meta { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.approvaltable td.reason { white-space: normal; max-width: 320px; }
.approvaltable td.reason .asked { color: var(--ink-mute); font-style: italic; }
.approvaltable tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* what a save actually did, when it did more than store a value */
.gridnotice {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 16px);
  max-width: min(640px, calc(100vw - 32px));
  background: #16202f; color: #fff; font-size: 13.5px; line-height: 1.5;
  padding: 12px 18px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.28);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  z-index: 60; cursor: pointer;
}
.gridnotice.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* the column that sends a row, and the record of who it went to */
td[data-field="approval_to"] select { font-weight: 600; }
td[data-field="approval_requested"] .cell { white-space: normal; max-width: 260px; }

/* an approval request: why this row is in front of you */
.askedbox { border: 1px solid var(--tone-warn-line); background: var(--tone-warn-bg); color: var(--tone-warn-ink);
            border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.askedbox .note { margin-top: 6px; background: rgba(255,255,255,.6); border-radius: 6px; padding: 7px 9px; }
.askedbox .who { margin-top: 6px; font-size: 12px; opacity: .85; }

/* choosing who has to sign a row off */
.requestbox { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.requestbox h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin: 0 0 8px; }
.requestbox textarea { font: inherit; font-size: 13px; width: 100%; min-height: 62px; padding: 8px 10px;
                       border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.askhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.askhead input[type="search"] { flex: 1; min-width: 150px; font: inherit; font-size: 13px;
                                padding: 6px 10px; border: 1px solid var(--line);
                                border-radius: 6px; background: var(--panel); color: var(--ink); }
.askcount { width: 100%; font-size: 12px; color: var(--ink-mute); }
.askcount.on { color: var(--accent); font-weight: 600; }
.asklist { max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 6px;
           padding: 4px 10px; margin-bottom: 8px; }
.asklist label { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 0;
                 border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.asklist label:last-child { border-bottom: 0; }
.asklist label:hover { color: var(--accent); }
.asklist label input { flex: none; }
.sentlist { margin-bottom: 10px; }
.sentitem { display: flex; justify-content: space-between; align-items: center; gap: 10px;
            font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.sentitem .meta { font-size: 11.5px; color: var(--ink-mute); }
/* a row waiting on the person looking at it */
.rowtools .js-review.asked { background: var(--tone-warn-bg); color: var(--tone-warn-ink);
                             font-weight: 700; box-shadow: inset 0 0 0 1px var(--tone-warn-line); }

/* client / member image */
.avatar { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: #f4f6fa; }
.avatar.sm { width: 32px; height: 32px; border-radius: 7px; }
.avatar-ph { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--ink-mute); background: #eef1f6; }

/* portal notifications */
.notifybar { background: var(--accent-sf); border: 1px solid #cfe0fa; border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.notifybar h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); }
.notifybar .item { padding: 7px 0; border-top: 1px solid #dbe7fb; font-size: 13px; }
.notifybar .item:first-of-type { border-top: 0; }
.notifybar .item .when { font-size: 11.5px; color: var(--ink-mute); }

/* a row just added through an intake form */
@keyframes justadded { 0%,70% { background: #fff6da; } 100% { background: transparent; } }
table.grid tr.justadded td, table.grid tr.justadded th.rowhead { animation: justadded 6s ease-out; }
table.grid tr.justadded th.rowhead { box-shadow: inset 3px 0 0 var(--amber); }

/* ------------------------------------------------------- checklist */
.js-check b { font-size: 9.5px; font-weight: 700; margin-left: 2px; vertical-align: 2px; color: var(--accent); }
.ckprog { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ckprog .bar { flex: 1; }
.ckprog .n { font-size: 13px; font-weight: 700; min-width: 46px; text-align: right; }

.ckitem { border-bottom: 1px solid var(--line-soft); padding: 9px 0; }
.ckitem .top { display: flex; align-items: flex-start; gap: 9px; }
.ckitem input[type=checkbox] { margin-top: 3px; width: 16px; height: 16px; flex: none; cursor: pointer; }
.ckitem .lbl { flex: 1; font-size: 13.5px; cursor: pointer; }
.ckitem.on .lbl { color: var(--tone-good-ink); text-decoration: line-through; text-decoration-color: #a9dcbf; }
.ckitem .acts { display: flex; gap: 4px; flex: none; }
.ckitem .acts button { border: 1px solid var(--line); background: var(--panel); border-radius: 5px;
  cursor: pointer; font-size: 12px; padding: 2px 7px; color: var(--ink-mute); line-height: 1.5; }
.ckitem .acts button:hover { background: var(--line-soft); color: var(--ink); }
.ckitem .acts button.haseye { color: var(--accent); border-color: #cfe0fa; background: var(--accent-sf); }

.cknote { margin: 8px 0 0 25px; font-size: 13px; background: var(--accent-sf); border: 1px solid #cfe0fa;
  border-radius: 6px; padding: 9px 11px; white-space: pre-wrap; }
.cknote .who { font-size: 11.5px; color: var(--ink-mute); margin-top: 6px; }
.ckedit { margin: 8px 0 0 25px; }
.ckedit textarea { font: inherit; font-size: 13px; width: 100%; min-height: 76px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; }
.ckedit .row { display: flex; gap: 6px; margin-top: 6px; }

/* ------------------------------------------------- step-by-step form */
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.stepchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; text-decoration: none;
  color: var(--ink-soft); background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 5px 12px 5px 6px; }
.stepchip:hover { border-color: var(--accent); color: var(--accent); }
.stepchip .n { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px;
  border-radius: 50%; background: var(--line); color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.stepchip.now { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.stepchip.now .n { background: rgba(255,255,255,.28); color: #fff; }
.stepchip.filled { background: var(--tone-good-bg); border-color: var(--tone-good-line); color: var(--tone-good-ink); }
.stepchip.filled .n { background: var(--tone-good-ink); color: #fff; }
.stepnav { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* checklist: mandatory marker and the item editor */
.ckitem .lbl .req { margin-left: 4px; }
.ckmust { font-size: 12.5px; font-weight: 600; border-radius: 6px; padding: 7px 10px; margin-bottom: 10px; }
.ckmust.ok { background: var(--tone-good-bg); color: var(--tone-good-ink); }
.ckmust.no { background: var(--tone-warn-bg); color: var(--tone-warn-ink); }

.ckreq { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.ckrow { display: flex; align-items: center; gap: 5px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.ckrow.off { opacity: .55; }
.ckrow .ckname { font: inherit; font-size: 13px; flex: 1; min-width: 150px; padding: 5px 8px;
  border: 1px solid transparent; border-radius: 6px; }
.ckrow .ckname:focus { border-color: var(--line); outline: none; background: #fff; }
.ckrow button { border: 1px solid var(--line); background: var(--panel); border-radius: 5px; cursor: pointer;
  font-size: 11.5px; padding: 3px 7px; color: var(--ink-soft); }
.ckrow button:hover { background: var(--line-soft); color: var(--ink); }
.ckrow button.on { background: var(--tone-risk-bg); border-color: var(--tone-risk-line); color: var(--tone-risk-ink); font-weight: 600; }
.ckrow button.danger:hover { background: var(--red-bg); color: var(--red); border-color: #e9c3c0; }

/* ------------------------------------------------ sign-in details box */
.signinbox { background: var(--accent-sf); border: 1px solid #cfe0fa; border-radius: 8px;
  padding: 12px 14px; margin: 10px 0; }
.signinbox strong { display: block; font-size: 12.5px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--accent); margin-bottom: 8px; }
.signinbox .pair { display: flex; gap: 10px; align-items: baseline; font-size: 13px; padding: 2px 0; }
.signinbox .pair span { min-width: 74px; color: var(--ink-soft); }
.signinbox .pair code { font: 12.5px/1.6 ui-monospace, Consolas, monospace; background: #fff;
  border: 1px solid var(--line); border-radius: 5px; padding: 2px 8px; word-break: break-all; }


/* ------------------------------------------------------------------ *
 * The invoice register.
 *
 * A ledger, not a report: one line per invoice, the money hard right so
 * the columns of digits line up and can be read down, and the state as a
 * solid badge at the end. Deliberately denser than table.data.
 * ------------------------------------------------------------------ */
table.ledger { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ledger thead th {
  padding: 9px 12px; text-align: left; font-size: 11.5px; font-weight: 650;
  color: var(--ink-soft); text-transform: none; letter-spacing: .2px;
  background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.ledger td {
  padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle;
}
table.ledger tbody tr:hover td { background: #fafbfd; }
table.ledger tbody tr:last-child td { border-bottom: 0; }

/* Money, dates and anything counted reads right-aligned and tabular, so
   the decimal points sit under one another. */
table.ledger .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.ledger .tot { font-weight: 650; }
table.ledger .pick { width: 34px; text-align: center; }
table.ledger .ref  { font-weight: 650; white-space: nowrap; }
table.ledger .ref a, table.ledger .who a { text-decoration: none; }
table.ledger .who a:hover { text-decoration: underline; }
table.ledger .when { white-space: nowrap; color: var(--ink-soft); }

/* A due date that has gone by is the one thing on the row worth alarming
   about, so it is the only red on it. */
table.ledger .late { color: var(--red); font-weight: 600; white-space: nowrap; }

/* A cancelled invoice stays on the record but stops asking to be read. */
table.ledger tr.void td, table.ledger tr.void td a { color: var(--ink-mute); }

/* Solid state badges, as an accounts package prints them. */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 11px;
  font-weight: 650; letter-spacing: .2px; white-space: nowrap; color: #fff;
}
.tag.draft     { background: #2f9bbd; }
.tag.sent      { background: #8a93a3; }
.tag.paid      { background: #1a7f44; }
.tag.cancelled { background: #d64545; }
.tag.overdue   { background: #b8352f; }

/* The row of buttons that acts on the invoice, kept off the money. */
table.ledger .acts { white-space: nowrap; text-align: right; }
table.ledger .acts form { display: inline; }
table.ledger .acts .btn { margin-left: 4px; }

/* Appears only once something is ticked, so it never takes space idly. */
.bulkbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel);
}
.bulkbar[hidden] { display: none; }
.bulkbar .n { font-size: 13px; font-weight: 650; margin-right: 4px; }

/* A count carried on a tab, so what needs attention is visible before
   the tab is opened — the reason the other tabs were being missed. */
.subtabs a .c {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 700; background: var(--grey-bg); color: var(--ink-soft);
}
.subtabs a .c.warn { background: var(--amber-bg); color: var(--amber); }
.subtabs a .c.bad  { background: var(--red-bg);   color: var(--red); }

/* ------------------------------------------------------------------ *
 * The desk guide: one card per tab, saying plainly what lives there.
 * A module with four tabs needs to introduce itself once.
 * ------------------------------------------------------------------ */
.deskguide { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.deskguide a {
  display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; text-decoration: none; color: inherit;
}
.deskguide a:hover { border-color: var(--accent); background: var(--panel); }
.deskguide .t { font-size: 14px; font-weight: 650; margin-bottom: 3px; }
.deskguide .d { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.deskguide .s { margin-top: 9px; font-size: 12.5px; font-weight: 650; }
.deskguide .s.bad  { color: var(--red); }
.deskguide .s.warn { color: var(--amber); }
.deskguide .s.good { color: #1a7f44; }

/* A labelled band of tiles. Twelve tiles in a row say nothing; the same
   twelve under "Money in", "Money out" and "What is left" say it all. */
.band { margin-bottom: 20px; }
.band > h3 {
  margin: 0 0 9px; font-size: 12px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--ink-soft);
}
.band .tiles { margin-bottom: 0; }

/* The panel that opens when one filing is being updated. */
.editpanel { border-left: 3px solid var(--accent); }
.editpanel h2 { margin-top: 0; }

/* The bar that decides what the page is showing: which client, and over
   what period. One row, labels attached to their control. */
.filterbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 11px 16px; margin-bottom: 16px;
}
.filterbar .grp { display: flex; align-items: center; gap: 7px; }
.filterbar label { font-size: 12.5px; font-weight: 650; color: var(--ink-soft); }
.filterbar select { min-width: 150px; }
.filterbar .pill { font-weight: 500; }
