@font-face { font-family: "Perfectly Nineties"; src: url("fonts/pn-semibold.otf") format("opentype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Perfectly Nineties"; src: url("fonts/pn-semibold-italic.otf") format("opentype"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Mentor Sans"; src: url("fonts/mentor-regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mentor Sans"; src: url("fonts/mentor-light.otf") format("opentype"); font-weight: 300; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #eeebe3;          /* Brand Ivory */
  --surface: #f7f5ef;
  --sunken: #e5e1d6;
  --ink: #192e2c;         /* Logo Green */
  --ink-2: #605b54;       /* Body Brown */
  --label: #6f735f;       /* Label Green, a touch darker for contrast on ivory */
  --line: rgba(25, 46, 44, 0.14);
  --line-strong: rgba(25, 46, 44, 0.28);
  --accent: #e9af76;      /* Accent Tan */
  --accent-ink: #8a5a26;
  --good: #2e7453;
  --bad: #b24a33;
  --warn: #9a6a14;
  --in: #3f7a5e;
  --lr-in: #2a6fb0;   /* long-range chart: cash in (validated for colour blindness with --lr-out) */
  --lr-out: #d0652a;
  --out: #c07a5a;
  --mute-bar: rgba(25, 46, 44, 0.22);
  --mute-bar-2: rgba(25, 46, 44, 0.12);
  --svc-photo: #2e7453; --svc-arch: #7f9a6b; --svc-video: #b8663f; --svc-editorial: #c49a3a;
  --svc-design: #4f6b8a; --svc-social: #8a5b7e; --svc-unsplit: rgba(25, 46, 44, 0.22);
  --heat0: #e6c9bd; --heat1: #ecd7b0; --heat2: #d9d4a6; --heat3: #a9c7a4; --heat4: #2e7453;
  --display: "Perfectly Nineties", Georgia, serif;
  --body: "Mentor Sans", "Gill Sans", Calibri, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #152120;        /* Brand Green */
    --surface: #1b2a28;
    --sunken: #111b1a;
    --ink: #e2dad3;       /* Editorial White */
    --ink-2: #a0a19a;     /* Green Grey */
    --label: #8a8e7b;
    --line: rgba(226, 218, 211, 0.12);
    --line-strong: rgba(226, 218, 211, 0.26);
    --accent: #e5c496;    /* Duoco Tan */
    --accent-ink: #e5c496;
    --good: #86c39b;
    --bad: #e3907a;
    --warn: #e5c496;
    --in: #7fb896;
    --lr-in: #4f8fd0;
    --lr-out: #cf6c33;
    --out: #d9937a;
    --mute-bar: rgba(226, 218, 211, 0.26);
    --mute-bar-2: rgba(226, 218, 211, 0.12);
    --svc-photo: #7fb896; --svc-arch: #b3c79a; --svc-video: #e0926c; --svc-editorial: #e5c496;
    --heat0: #5a3a33; --heat1: #5d5033; --heat2: #4b5638; --heat3: #3f6a4f; --heat4: #7fb896;
    --svc-design: #8fa9c6; --svc-social: #c79ab9; --svc-unsplit: rgba(226, 218, 211, 0.26);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 24px 64px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td, .fig { font-variant-numeric: tabular-nums lining-nums; }

/* Header */
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.wordmark { height: 26px; width: auto; color: var(--ink); }
@media (prefers-color-scheme: dark) { .wordmark { color: var(--accent); } }
.brand-label, .eyebrow, th, .lbl {
  font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--label);
}
.top-meta { display: flex; align-items: center; gap: 12px; color: var(--ink-2); }
.today-label { font-size: 14px; }

.chip, .pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; line-height: 1.5; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--ink-2);
}
.pill.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.pill.bad  { color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 45%, transparent);  background: color-mix(in srgb, var(--bad) 10%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }

/* Tabs */
.tabs { display: flex; gap: 4px; margin: 18px 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  background: none; border: 0; padding: 10px 14px 12px; cursor: pointer; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 15px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--ink); }
/* Second row: the pages inside the chosen section */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: -10px 0 20px; }
.subtabs:empty { display: none; }
.subtabs button { font: inherit; font-size: 13.5px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2); cursor: pointer; }
.subtabs button[aria-selected="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.subtabs button:hover { color: var(--ink); }
.subtabs button[aria-selected="true"]:hover { color: var(--surface); }
/* GST tags on figures */
.gst { display: inline-block; font-size: 10.5px; letter-spacing: .02em; text-transform: none; padding: 0 5px; margin-left: 5px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--ink-2); vertical-align: 1px; font-weight: 500; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Banner */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 20px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
.banner p { margin: 0; max-width: 70ch; }

/* Type */
h2 { font: 600 28px/1.1 var(--display); margin: 0; text-wrap: balance; letter-spacing: -0.005em; }
h3 { font: 600 20px/1.2 var(--display); margin: 0; }
.em { font-style: italic; color: var(--accent-ink); }
.sub { color: var(--ink-2); margin: 4px 0 0; max-width: 68ch; }
.fig { font: 600 34px/1 var(--display); letter-spacing: -0.01em; }
.fig.lg { font-size: 46px; }
.fig.sm { font-size: 24px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }

/* Layout */
.stack { display: grid; gap: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.panel.hero { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }

/* Stat strip: plain row with dividers */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.strip > div { padding: 16px 18px 16px 0; display: grid; gap: 8px; align-content: start; }
.strip > div + div { padding-left: 18px; border-left: 1px solid var(--line); }
@media (max-width: 560px) { .strip { grid-template-columns: 1fr 1fr; column-gap: 16px; } .strip > div, .strip > div + div { border-left: 0; padding: 14px 0; border-top: 1px solid var(--line); } .strip > div:nth-child(-n+2) { border-top: 0; } }
.delta { font-size: 13px; color: var(--ink-2); }

/* Forms */
.form { display: grid; gap: 10px; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; }
.form .f { display: grid; gap: 4px; }
.form .f.w2 { grid-column: span 2; } .form .f.w3 { grid-column: span 3; } .form .f.w6 { grid-column: span 6; }
@media (max-width: 560px) { .form .f.w2, .form .f.w3 { grid-column: span 6; } .form .f { grid-column: span 3; } }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--bg); min-height: 40px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 0; border-color: transparent; }
.check { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 14px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.btn {
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg); border-radius: 8px;
  padding: 9px 16px; min-height: 40px; cursor: pointer; white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.small { padding: 5px 10px; min-height: 30px; font-size: 13.5px; }
.btn:hover { filter: brightness(1.08); }
.iconbtn { background: none; border: 0; cursor: pointer; color: var(--ink-2); padding: 4px 8px; border-radius: 6px; font-size: 18px; line-height: 1; }
.iconbtn:hover { color: var(--bad); background: var(--sunken); }

/* Entries */
.entries { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); }
.entries li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.entries .what { min-width: 0; }
.entries .what b { font-weight: 400; }
.entries .what span { display: block; color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.entries .amt { font-variant-numeric: tabular-nums; }
.empty { color: var(--ink-2); font-size: 14px; padding: 12px 0 0; }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }

/* Date nav */
.datenav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.datenav input { width: auto; }

/* Tables */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th { text-align: right; font-weight: 400; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
td { text-align: right; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr.total td { border-top: 1px solid var(--line-strong); border-bottom: 0; font-weight: 400; color: var(--ink); }
tr.current td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
td .d { display: block; font-size: 12px; color: var(--ink-2); }

/* Bars */
.bars { display: grid; gap: 14px; }
.barrow { display: grid; grid-template-columns: minmax(110px, 170px) 1fr auto; gap: 12px; align-items: center; }
@media (max-width: 560px) { .barrow { grid-template-columns: 1fr auto; } .barrow .track { grid-column: 1 / -1; order: 3; } }
.track { position: relative; height: 16px; background: var(--sunken); border-radius: 4px; overflow: hidden; display: flex; }
.track i { display: block; height: 100%; }
.seg-direct { background: var(--mute-bar); }
.seg-over { background: var(--mute-bar-2); }
.seg-profit { background: var(--good); }
.seg-loss { background: var(--bad); }
.seg-plain { background: var(--out); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--c); }

/* Chart */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--ink-2); font: 11px var(--body); }

/* Toggle group */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 7px 14px; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* Equation */
.eq-target { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font: 600 30px/1.2 var(--display); }
.eq-target input { width: 160px; font: 600 30px/1 var(--display); padding: 4px 10px; min-height: 0; }
.progress { height: 12px; background: var(--sunken); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--good); }
.mix td input { width: 90px; min-height: 34px; padding: 5px 8px; text-align: right; }
.card-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.card-list .panel { display: grid; gap: 6px; align-content: start; }

/* Decisions */
.decisions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.decisions li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; }
.decisions .d { color: var(--label); font-size: 13px; padding-top: 2px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
@media (max-width: 560px) { .wrap { padding: 16px 16px 48px; } .fig.lg { font-size: 38px; } h2 { font-size: 24px; } }

/* v2: jobs, invoices, setup */
.form .f.w4 { grid-column: span 4; }
@media (max-width: 560px) { .form .f.w4 { grid-column: span 6; } }
.jobform { display: grid; gap: 12px; padding-bottom: 4px; }
.lines { display: grid; gap: 8px; padding: 12px; background: var(--sunken); border-radius: 10px; }
.line { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: end; }
.line .f { display: grid; gap: 4px; }
@media (max-width: 560px) { .line { grid-template-columns: 1fr 1fr auto; } .line .f:first-child { grid-column: 1 / -1; } }
.formfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rowbtns { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.entries li.jobrow { grid-template-columns: 1fr auto auto; align-items: start; padding: 12px 0; }
.entries .amt { display: grid; justify-items: end; gap: 2px; text-align: right; }
.inline { font-size: 13.5px; }
.chips { display: flex !important; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.iconbtn.armed { font-size: 13px; color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.iconbtn:disabled { opacity: .3; cursor: default; }
.ticklist { display: grid; max-height: 300px; overflow-y: auto; border-top: 1px solid var(--line); }
.ticklist.tall { max-height: 460px; }
.tick { display: flex; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tick input { width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.stackform { display: grid; gap: 14px; align-content: start; }
.stackform > label { display: grid; gap: 4px; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row input[type="text"] { flex: 1; }
.daychecks { display: flex; gap: 4px 14px; flex-wrap: wrap; }
.daychecks .check { min-height: 32px; }
.navlabel { min-width: 130px; text-align: center; }
td.wrapcell { white-space: normal; min-width: 180px; text-align: left; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 14px; padding: 4px 0; }
details[open] summary { margin-bottom: 10px; }
code { font-size: 0.9em; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
.splitlist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.chipbtn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.chipbtn:hover, .chipbtn.on { border-color: var(--ink); }
.warn-t { color: var(--warn); }
.line .inline-row input { min-width: 0; }
.payrun td input[type="number"] { width: 110px; min-height: 34px; padding: 5px 8px; text-align: right; }
.payrun td input[type="text"] { min-width: 140px; min-height: 34px; padding: 5px 8px; }
.rules { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; margin-top: 6px; }
.rules .inline-row input, #ruleAdd input { max-width: 220px; }
.rules select, #ruleAdd select { max-width: 240px; }
.linefrom { grid-column: 1 / -1; margin-top: -4px; }
.advisor { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.advice-text { white-space: pre-line; font-size: 16.5px; line-height: 1.55; max-width: 72ch; }
.svcline { display: grid; gap: 8px; padding-bottom: 10px; border-bottom: 1px dashed var(--line-strong); }
.svcline:last-of-type { border-bottom: 0; }
.svcline .line { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; }
.stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.stages .f { display: grid; gap: 4px; }
.stages select { min-height: 36px; padding: 6px 8px; font-size: 14px; }
.svcname { font-weight: 400; color: var(--ink); }
.pricelist input[type="text"] { min-width: 150px; min-height: 34px; padding: 5px 8px; }
.pricelist input[type="number"] { width: 90px; min-height: 34px; padding: 5px 8px; text-align: right; }
.pricelist select { min-height: 34px; padding: 5px 8px; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.alert .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--label); }
.alert.bad .dot { background: var(--bad); } .alert.warn .dot { background: var(--warn); }
.alert.bad { border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; margin-left: 4px; }
.track.tgt { overflow: visible; position: relative; }
.track.tgt b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.wkt td input[type="number"] { width: 120px; min-height: 34px; padding: 5px 8px; text-align: right; }
.wkt td input[type="text"] { min-width: 180px; min-height: 34px; padding: 5px 8px; }
.wkt td input[type="date"] { min-height: 34px; padding: 4px 6px; width: auto; }
.wkt tr.unconf td { color: var(--ink-2); }
.wkt td:first-child { white-space: normal; min-width: 220px; }
.strip.aged > div { padding-block: 10px; }
.checklist { display: grid; gap: 4px; }
.checklist .check { align-items: flex-start; min-height: 0; padding: 4px 0; color: var(--ink); }

.healthtop { display: flex; gap: 20px; flex-wrap: wrap; align-items: stretch; }
.panel.ring { display: flex; gap: 18px; align-items: center; }
.legend.vert { flex-direction: column; gap: 6px; }
.fixlist { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.hbars { display: grid; gap: 16px; }
.hbar { display: grid; gap: 6px; }
.hbar-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.track.big { height: 14px; }
.heat { display: grid; grid-auto-rows: 18px; gap: 4px; overflow-x: auto; padding-bottom: 4px; justify-content: start; }
.heat .cell { width: 18px; height: 18px; border-radius: 4px; cursor: pointer; }
.heat .cell.off { background: var(--sunken); opacity: .5; cursor: default; }
.heat .cell:hover { outline: 2px solid var(--ink); }
.heatlbl { font-size: 11px; color: var(--ink-2); padding-right: 8px; line-height: 18px; }
.stack > *, .grid2 > *, .grid3 > *, .panel { min-width: 0; }
.spark { display: block; }
tr.urgent td:first-child { box-shadow: inset 3px 0 0 var(--bad); padding-left: 8px; }

/* Long-range charts: hover tooltip */
.lrchart { position: relative; width: 100%; }
.lrchart svg text { font-size: 11px; fill: var(--muted, var(--ink-2)); }
.lrtip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.45; color: var(--ink); box-shadow: 0 6px 18px rgba(0,0,0,.12); white-space: nowrap; z-index: 3; display: none; }
.lrtip b { font-weight: 600; }
.lrtip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
/* Today: the three answers */
.answers .lbl, .answers .fig { display: block; }
.answers .fig.lg { font-size: 30px; line-height: 1.15; margin-top: 6px; }
.answers .grid3 > div { display: flex; flex-direction: column; }
/* This week's calls */
.calls td, .calls th { text-align: left; }
.calls td.num, .calls th.num { text-align: right; }
.calls td.invs { white-space: normal; min-width: 180px; max-width: 280px; }

/* Bank and Amex import review */
table.review td { vertical-align: top; padding: 6px 8px; } table.review td .d { display: block; font-size: 12px; color: var(--label); } table.review select { max-width: 230px; }
