:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --card: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --head: #f3f3f1;
  --accent: #1c5cab;
  --good: #006300;
  --warn-bg: #fff6e0;
  --warn-ink: #7a5200;
  --series-google: #2a78d6;
  --series-meta: #eb6834;
  --series-tiktok: #1baf7a;
  --budget-mark: #0b0b0b;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --card: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --head: #232322;
    --accent: #86b6ef;
    --good: #0ca30c;
    --warn-bg: #3a2c0a;
    --warn-ink: #f3cf7a;
    --series-google: #3987e5;
    --series-meta: #d95926;
    --series-tiktok: #199e70;
    --budget-mark: #f0efec;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --card: #1a1a19;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --head: #232322;
  --accent: #86b6ef;
  --good: #0ca30c;
  --warn-bg: #3a2c0a;
  --warn-ink: #f3cf7a;
  --series-google: #3987e5;
  --series-meta: #d95926;
  --series-tiktok: #199e70;
  --budget-mark: #f0efec;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.45; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }

/* header */
.top { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.top h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.top .sub { color: var(--ink-2); margin-top: 4px; }
.top .asof { text-align: right; color: var(--ink-2); font-size: 13px; }
.top .asof strong { color: var(--ink); display: block; font-size: 15px; }
.btn { font: inherit; border: 1px solid var(--border); background: var(--card); color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.btn:hover { background: var(--head); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .btn.primary { color: #0b0b0b; } }
:root[data-theme="dark"] .btn.primary { color: #0b0b0b; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--ink-2); font-size: 12px; }
.tile .value { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile .note { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 4px; }
.card .desc { color: var(--ink-2); margin: 0 0 14px; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.grid2 > .card { margin-bottom: 0; }
.stack { display: grid; gap: 16px; margin-bottom: 16px; }

/* tables */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th { background: var(--head); color: var(--ink-2); font-weight: 600; font-size: 12px; position: sticky; top: 0; }
th:first-child, td:first-child { text-align: left; }
td.text { text-align: left; white-space: normal; min-width: 180px; }
tr.total td { font-weight: 650; border-top: 1px solid var(--axis); border-bottom: none; }
tr.sub td { color: var(--ink-2); font-style: italic; }
tr.upcoming td { color: var(--muted); }
th.group { text-align: center; border-left: 2px solid var(--card); }
td.sep, th.sep { border-left: 1px solid var(--grid); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: -1px; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.closed { background: #d9efd9; color: #0b4d0b; }
.pill.in_progress { background: #d7e6f8; color: #123e73; }
.pill.upcoming { background: var(--head); color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .pill.closed { background: #173a17; color: #a8dda8; }
  :root:where(:not([data-theme="light"])) .pill.in_progress { background: #16304f; color: #b7d3f6; }
}
:root[data-theme="dark"] .pill.closed { background: #173a17; color: #a8dda8; }
:root[data-theme="dark"] .pill.in_progress { background: #16304f; color: #b7d3f6; }

/* segmented control */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 12px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 13px; border: 0; background: transparent; color: var(--ink-2); padding: 6px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--head); color: var(--ink); font-weight: 600; }

/* charts */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; }
.legend .ln { width: 14px; height: 0; border-top: 2px solid var(--budget-mark); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover, .chart .hit:focus { fill: var(--ink); fill-opacity: 0.04; outline: none; }
.tip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); min-width: 160px; z-index: 5; display: none; }
.tip .t { color: var(--ink-2); margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .r .n { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.tip .r .n i { display: inline-block; width: 12px; height: 0; border-top: 2px solid; }
.tip .r b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* notes */
.notes { color: var(--ink-2); font-size: 12.5px; }
.notes ul { margin: 6px 0 0; padding-left: 18px; }
.notes li { margin: 3px 0; }
.foot { color: var(--muted); font-size: 12px; margin-top: 20px; text-align: center; }

/* login */
.login { max-width: 380px; margin: 10vh auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.login h1 { font-size: 18px; margin: 0 0 4px; }
.login p { color: var(--ink-2); margin: 0 0 18px; font-size: 13px; }
.login label { display: block; font-size: 12px; color: var(--ink-2); margin: 12px 0 4px; }
.login input { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); }
.login .row { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 12px; }
.login .link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
.msg { margin-top: 14px; font-size: 13px; padding: 8px 10px; border-radius: 8px; display: none; }
.msg.err { display: block; background: #fde8e8; color: #8a1c1c; }
.msg.ok { display: block; background: #e3f3e3; color: #0b4d0b; }
.center { text-align: center; color: var(--ink-2); margin: 20vh auto; }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 16px; }

@media print {
  body { background: #fff; }
  .btn, .seg { display: none !important; }
  .card, .tile { break-inside: avoid; }
}
th.texth { text-align: left; }
.chart { min-height: 40px; }
.stack > *, .grid2 > * { min-width: 0; }
@media (max-width: 600px) {
  .wrap { padding: 16px 12px 40px; }
  .top .asof { text-align: left; }
  .tile .value { font-size: 20px; }
  .card { padding: 14px; }
}

/* ---------- app shell: sidebar + main ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 22px 14px 18px; background: var(--card); border-right: 1px solid var(--border); }
.brand { padding: 0 8px; }
.brand .b1 { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand .b2 { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.brand .b3 { color: var(--muted); font-size: 12px; margin-top: 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: block; padding: 9px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14px; min-height: 40px; }
.nav a:hover { background: var(--head); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--head); color: var(--ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
.nav a:focus-visible, .btn:focus-visible, .tabs button:focus-visible, .seg button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sidefoot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--grid); color: var(--ink-2); font-size: 12px; display: grid; gap: 4px; }
.sidefoot strong { color: var(--ink); font-weight: 600; }
.sidefoot .who { margin-top: 8px; display: grid; gap: 6px; }
.main { padding: 24px clamp(16px, 3vw, 36px) 56px; max-width: 1240px; width: 100%; }
.view > * { margin-bottom: 16px; }

.phead { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.phead h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; line-height: 1.15; }
.phead .lead { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; }
.phead .asof { text-align: right; color: var(--ink-2); font-size: 12.5px; }
.phead .asof strong { display: block; color: var(--ink); font-size: 14px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--ink-2); padding: 10px 12px; cursor: pointer; margin-bottom: -1px; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 650; }

/* forms & controls */
input[type="text"], input[type="email"], input[type="search"], select {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 40px; max-width: 100%;
}
select { padding-right: 28px; }
select.changed { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
select:disabled, .btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn { min-height: 38px; }
.btn.danger { background: #c62828; border-color: transparent; color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 10px; }
.toolbar .seg { margin-bottom: 0; }
.toolbar input[type="search"] { flex: 1 1 220px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.check input { width: 18px; height: 18px; }
.bulk { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px 12px; background: var(--head); border-radius: 8px; margin-bottom: 10px; font-size: 14px; }
.bulk label { color: var(--ink-2); }
.count { font-size: 12.5px; margin: 4px 0 8px; }
table.assign td { vertical-align: middle; }
table.assign select { width: 100%; min-width: 220px; }
.savebar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 0 2px; margin-top: 12px; background: var(--card); border-top: 1px solid var(--grid); font-size: 14px; color: var(--ink-2); }
.savebar .err { color: #b3261e; }
.bar-actions { display: flex; gap: 8px; }
.mform { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.mform .field { display: grid; gap: 4px; }
.mform label { font-size: 12.5px; color: var(--ink-2); }
.mform input, .mform select { width: 100%; }
.formmsg { grid-column: 1 / -1; font-size: 13px; }
.formmsg.err { color: #b3261e; }
.formmsg.ok { color: var(--good); }
.confirm { display: inline-flex; gap: 6px; }
.actions { display: flex; justify-content: flex-end; }

/* bits */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.fine { color: var(--ink-2); font-size: 12.5px; margin: 10px 0 0; }
.empty { text-align: center !important; color: var(--muted); padding: 20px; }
ul.notes { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
ul.notes li { margin: 4px 0; }
.keyed { display: inline-flex; align-items: center; white-space: nowrap; }
.pctm { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.meter { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
td.text.muted { color: var(--muted); }

@media (max-width: 860px) {
  .shell { display: block; }
  .side { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: column; gap: 8px; padding: 10px 12px 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 0 4px; }
  .brand .b3 { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 2px; padding-bottom: 6px; scrollbar-width: none; }
  .nav a { white-space: nowrap; flex: none; padding: 8px 10px; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidefoot { display: none; }
  .main { padding: 16px 12px 48px; }
  .phead .asof { text-align: left; }
  .phead h1 { font-size: 22px; }
}
.tile .value { font-size: clamp(18px, 1.7vw, 24px); }
table.alloc td.text:first-child { min-width: 150px; }
table.alloc .meter { width: 44px; }
@media (max-width: 700px) {
  table.assign thead { display: none; }
  table.assign tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 2px; border-bottom: 1px solid var(--grid); }
  table.assign td { border: 0; padding: 0; text-align: left; white-space: normal; min-width: 0; }
  table.assign td:nth-child(1) { grid-column: 1; grid-row: 1; font-size: 12px; color: var(--ink-2); }
  table.assign td:nth-child(2) { display: none; }
  table.assign td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  table.assign td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; }
  table.assign td:nth-child(5) { grid-column: 1 / -1; grid-row: 3; }
  table.assign select { min-width: 0; }
  .tscroll:has(table.assign) { overflow: visible; }
}
input[type="number"] { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; min-height: 36px; }
.splitcell { display: grid; gap: 8px; }
.spliteditor { display: grid; gap: 6px; padding: 10px 12px; background: var(--head); border-radius: 8px; }
.sprow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.sprow .check { white-space: normal; color: var(--ink); }
.pctwrap { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
.pctin { width: 84px; text-align: right; }
.seg.small { margin: 4px 0 0; }
.seg.small button { font-size: 12.5px; padding: 6px 10px; }
.splitprev { display: grid; gap: 2px; font-size: 12.5px; color: var(--ink-2); }
.splitprev .err { color: #b3261e; }
/* keyword rules */
.rules { display: grid; gap: 10px; margin-bottom: 10px; }
.rule { border: 1px solid var(--grid); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; }
.rulehead { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; align-items: flex-start; }
.order { display: flex; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--head); border: 1px solid var(--border); border-radius: 999px; padding: 2px 2px 2px 10px; font-size: 13px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--ink-2); font-size: 16px; line-height: 1; width: 26px; height: 26px; border-radius: 50%; }
.chip button:hover { background: var(--grid); color: var(--ink); }
.addrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.addrow input { flex: 1 1 200px; }
details.leftover summary { cursor: pointer; font-size: 13px; color: var(--accent); }
details.leftover ul { list-style: none; padding: 0; margin: 8px 0 0; columns: 2 260px; column-gap: 24px; font-size: 13px; }
details.leftover li { display: flex; justify-content: space-between; gap: 12px; break-inside: avoid; padding: 4px 0; border-bottom: 1px solid var(--grid); }
/* period picker + elapsed tick */
.periodbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-bottom: 16px; }
.periodbar .seg { margin-bottom: 0; }
.periodbar select { min-width: 240px; }
.meter { position: relative; overflow: visible; }
.meter i { overflow: hidden; }
.meter b.tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: 0.6; border-radius: 1px; }
/* ---------- content calendar & planner ---------- */
.pill.st-pending, .evt.st-pending { background: #ecebe7; color: #4a4945; }
.pill.st-ready, .evt.st-ready { background: #d7e6f8; color: #123e73; }
.pill.st-shot, .evt.st-shot { background: #d3f0ec; color: #0d4a43; }
.pill.st-progress, .evt.st-progress { background: #fde8c8; color: #6b3d00; }
.pill.st-review, .evt.st-review { background: #e9ddf7; color: #4a237a; }
.pill.st-scheduled, .evt.st-scheduled { background: #fbe0ec; color: #7a1f47; }
.pill.st-posted, .evt.st-posted { background: #d9efd9; color: #0b4d0b; }
.pill.st-other, .evt.st-other { background: var(--head); color: var(--ink-2); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .pill.st-pending, :root:where(:not([data-theme="light"])) .evt.st-pending { background: #2e2d2b; color: #d6d4cd; }
  :root:where(:not([data-theme="light"])) .pill.st-ready, :root:where(:not([data-theme="light"])) .evt.st-ready { background: #16304f; color: #b7d3f6; }
  :root:where(:not([data-theme="light"])) .pill.st-shot, :root:where(:not([data-theme="light"])) .evt.st-shot { background: #113a35; color: #a6e3da; }
  :root:where(:not([data-theme="light"])) .pill.st-progress, :root:where(:not([data-theme="light"])) .evt.st-progress { background: #3f2a0c; color: #f6cf94; }
  :root:where(:not([data-theme="light"])) .pill.st-review, :root:where(:not([data-theme="light"])) .evt.st-review { background: #31204a; color: #d6c0f2; }
  :root:where(:not([data-theme="light"])) .pill.st-scheduled, :root:where(:not([data-theme="light"])) .evt.st-scheduled { background: #45182c; color: #f4bfd6; }
  :root:where(:not([data-theme="light"])) .pill.st-posted, :root:where(:not([data-theme="light"])) .evt.st-posted { background: #173a17; color: #a8dda8; }
}
:root[data-theme="dark"] .pill.st-pending, :root[data-theme="dark"] .evt.st-pending { background: #2e2d2b; color: #d6d4cd; }
:root[data-theme="dark"] .pill.st-ready, :root[data-theme="dark"] .evt.st-ready { background: #16304f; color: #b7d3f6; }
:root[data-theme="dark"] .pill.st-shot, :root[data-theme="dark"] .evt.st-shot { background: #113a35; color: #a6e3da; }
:root[data-theme="dark"] .pill.st-progress, :root[data-theme="dark"] .evt.st-progress { background: #3f2a0c; color: #f6cf94; }
:root[data-theme="dark"] .pill.st-review, :root[data-theme="dark"] .evt.st-review { background: #31204a; color: #d6c0f2; }
:root[data-theme="dark"] .pill.st-scheduled, :root[data-theme="dark"] .evt.st-scheduled { background: #45182c; color: #f4bfd6; }
:root[data-theme="dark"] .pill.st-posted, :root[data-theme="dark"] .evt.st-posted { background: #173a17; color: #a8dda8; }

.statusbar { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px; }
.statcount { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.calbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.calbar .seg { margin-bottom: 0; }
.calnav { display: flex; align-items: center; gap: 8px; }
.calnav strong { min-width: 140px; text-align: center; font-size: 16px; }
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--grid); border-left: 1px solid var(--grid); }
.calgrid .dow { padding: 6px 8px; font-size: 12px; color: var(--ink-2); background: var(--head); border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); }
.calgrid .day { min-height: 104px; padding: 6px; border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.calgrid .day.pad { background: color-mix(in srgb, var(--head) 50%, transparent); }
.calgrid .day.today .dnum { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; align-self: flex-start; }
.dnum { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.evt { display: block; width: 100%; text-align: left; border: 0; border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12px; line-height: 1.3; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evt.is-post { box-shadow: inset 3px 0 0 currentColor; }
.evt:hover { filter: brightness(0.96); }
.evt:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.agenda { display: none; }
.agday { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.agdate { font-size: 13px; color: var(--ink-2); }
.agitems { display: grid; gap: 4px; }
.agitems .evt { white-space: normal; }
@media (max-width: 760px) { .calgrid { display: none; } .agenda { display: block; } }
ul.undated { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
ul.undated li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--grid); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.linkish:hover { color: var(--accent); text-decoration: underline; }
table.ctable td.ctitle { min-width: 260px; max-width: 420px; }
table.ctable select.stsel { min-width: 170px; border: 0; font-weight: 600; }
/* dialog */
.modalback { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); color: var(--ink); border-radius: 14px; width: min(680px, 100%); box-shadow: 0 16px 48px rgba(0,0,0,0.25); display: grid; }
.modalhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 8px; }
.modalhead h2 { margin: 0; font-size: 17px; line-height: 1.35; }
.modalbody { padding: 8px 20px 16px; }
.modalfoot { padding: 12px 20px 18px; border-top: 1px solid var(--grid); }
.footrow { display: flex; gap: 8px; align-items: center; }
.footrow .grow { flex: 1; }
.detail { display: grid; gap: 10px; }
.drow { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; font-size: 14px; }
.drow .dl { color: var(--ink-2); }
.drow .dv { white-space: pre-line; overflow-wrap: anywhere; }
.cform { display: grid; gap: 12px; }
.cform .field { display: grid; gap: 4px; }
.cform label, .cform .flabel { font-size: 12.5px; color: var(--ink-2); }
.cform input, .cform textarea, .cform select { width: 100%; }
.cform textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; resize: vertical; }
input[type="date"], input[type="url"] { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-height: 40px; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.platchecks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
@media (max-width: 600px) { .drow { grid-template-columns: 1fr; gap: 2px; } }
/* content from Google Sheet */
.syncbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-start; justify-content: space-between; background: var(--card); border: 1px solid var(--grid); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.syncinfo { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.syncactions { display: flex; flex-wrap: wrap; gap: 8px; }
.syncactions a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.syncfoot { flex-basis: 100%; margin: 0; }
.nav a[hidden] { display: none; }
/* publishing progress and client approval */
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; }
.pblock { display: grid; gap: 6px; min-width: 0; }
.pblock .meter { width: 100%; height: 8px; border-radius: 4px; }
.plabel { font-size: 12.5px; color: var(--ink-2); }
.pbig { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
details.bymonth { margin-top: 12px; }
details.bymonth summary { cursor: pointer; font-size: 13px; color: var(--accent); }
details.bymonth table { margin-top: 8px; }
tr.cur td { font-weight: 650; }
.apnote { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.35; }
ul.apprlist { list-style: none; margin: 0; padding: 0; display: grid; }
li.appr { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--grid); }
li.appr:last-child { border-bottom: 0; }
.apprmain { display: grid; gap: 3px; min-width: 0; flex: 1 1 300px; }
.apprtitle { font-weight: 600; }
.apprlinks { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin-top: 2px; }
.apprctl { display: grid; gap: 8px; flex: 0 1 auto; }
.appractions { display: flex; flex-wrap: wrap; gap: 8px; }
.apprnote { display: grid; gap: 6px; min-width: min(360px, 100%); }
.apprnote label { font-size: 12.5px; color: var(--ink-2); }
.apprnote textarea { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.modal .apprctl { margin-top: 8px; }
table.plantable td.numin { width: 120px; }
table.plantable td.numin input { width: 96px; text-align: right; }
.check.wrapok { white-space: normal; align-items: flex-start; }
.savebar.plain { position: static; background: none; border-top: 0; justify-content: flex-start; margin-top: 0; }
/* what we need from Sunway, deliverables */
.needhead { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 2px; }
.needkind { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.needkind.approval { color: #5a2d91; }
.due { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--head); color: var(--ink-2); }
.due.due-soon { background: var(--warn-bg); color: var(--warn-ink); }
.due.due-over { background: #fde2e1; color: #8a1c13; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .needkind.approval { color: #cdb4f0; }
  :root:where(:not([data-theme="light"])) .due.due-over { background: #4a1714; color: #f6b8b2; }
}
:root[data-theme="dark"] .needkind.approval { color: #cdb4f0; }
:root[data-theme="dark"] .due.due-over { background: #4a1714; color: #f6b8b2; }
section.needsum { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; border-left: 4px solid var(--accent); }
section.needsum.hasover { border-left-color: #c0392b; }
.needsumtext { min-width: 0; flex: 1 1 320px; }
.needsumtext h2 { margin: 0 0 4px; }
.needsumtext p { margin: 0; color: var(--ink-2); font-size: 14px; }
.deliv { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 28px; }
.dvrow { display: grid; gap: 6px; min-width: 0; }
.dvtop { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.dvlabel { font-size: 13.5px; color: var(--ink-2); }
.dvnum { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dvrow .meter { width: 100%; height: 8px; border-radius: 4px; }
.mform.leadrow { margin-top: 12px; grid-template-columns: minmax(0, 520px); }
