/* Albany Data Systems brand (albanydatasystems.com): near-black navy, the ADS
   purple, a soft purple glow. Dark is the default; Appearance can switch to light
   (data-theme on <html>, set by the server, per user). */
:root {
  color-scheme: dark;
  --brand: #8a2ce2;
  --brand-deep: #6d28d9;
  --brand-glow: color-mix(in srgb, var(--brand) 22%, transparent);
  --bg: #06080d;
  --bg-2: #0d1018;
  --surface: #10141e;
  --surface-2: #161c28;
  --border: #1f2836;
  --border-strong: #2c3648;
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --accent: #b47cf5;
  --series: #a964f0;
  --grid: #1f2836;
  --good: #22c55e;
  --warning: #f5b324;
  --serious: #f08a5d;
  --critical: #ef4444;
  --good-ink: #5ee08a;
  --warning-ink: #fac454;
  --critical-ink: #fb8a8a;
  --good-bg: rgba(34, 197, 94, 0.13);
  --warning-bg: rgba(245, 179, 36, 0.13);
  --critical-bg: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-ink: #7cb3fb;
  --info-bg: rgba(59, 130, 246, 0.14);
  --empty: #1c2331;
  --top-bg: rgba(6, 8, 13, 0.82);
  --summary-fade: rgba(16, 20, 30, 0.9);
  --glow-2: color-mix(in srgb, var(--brand-deep) 12%, transparent);
  --font: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Space Grotesk", Inter, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
}

/* Light: white cards on a soft lavender-gray, the same ADS purple. */
:root[data-theme="light"] {
  color-scheme: light;
  --brand-glow: color-mix(in srgb, var(--brand) 10%, transparent);
  --glow-2: color-mix(in srgb, var(--brand-deep) 6%, transparent);
  --bg: #f4f3f8;
  --bg-2: #f8f7fc;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: #e3e0ec;
  --border-strong: #cfcadd;
  --text: #0d1018;
  --text-2: #3b4252;
  --muted: #646b7b;
  --accent: #7a22d0;
  --series: #8a2ce2;
  --grid: #e3e0ec;
  --good: #16a34a;
  --warning: #e5a00d;
  --critical: #dc2626;
  --good-ink: #12752f;
  --warning-ink: #8a5a00;
  --critical-ink: #b42020;
  --good-bg: #e5f5ea;
  --warning-bg: #fdf1d6;
  --critical-bg: #fbe4e4;
  --info: #2563eb;
  --info-ink: #1d4ed8;
  --info-bg: #e3edfd;
  --empty: #ebe9f1;
  --top-bg: rgba(255, 255, 255, 0.88);
  --summary-fade: rgba(255, 255, 255, 0.95);
}
/* Accent color (Appearance): the user's own pick in place of the ADS purple. The
   server sets --pick on <html>; links and text get a lighter shade on dark, a deeper one on light. */
:root[data-accent] {
  --brand: var(--pick);
  --brand-deep: color-mix(in srgb, var(--pick) 78%, black);
  --accent: color-mix(in srgb, var(--pick) 62%, white);
  --series: color-mix(in srgb, var(--pick) 82%, white);
}
:root[data-accent][data-theme="light"] {
  --accent: color-mix(in srgb, var(--pick) 82%, black);
  --series: var(--pick);
}
/* The logo has white lettering, so the header bar stays dark in light mode. */
:root[data-theme="light"] .top {
  color-scheme: dark;
  --text: #f8fafc; --text-2: #cbd5e1; --muted: #94a3b8; --surface-2: #161c28; --border: #1f2836; --border-strong: #2c3648;
  --top-bg: rgba(6, 8, 13, 0.94);
}
:root[data-theme="light"] .card, :root[data-theme="light"] .mini-card, :root[data-theme="light"] .panel { box-shadow: 0 1px 3px rgba(13, 16, 24, 0.06); }

* { box-sizing: border-box; }
/* Text size (Appearance): everything is sized in rem off <html>, except the header bar, which stays put. */
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
:root[data-text="small"] { font-size: 14px; }
:root[data-text="large"] { font-size: 18px; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column;
  color: var(--text);
  font: 0.9375rem/1.5 var(--font);
  background:
    radial-gradient(1100px 600px at -10% -10%, var(--brand-glow), transparent 70%),
    radial-gradient(900px 500px at 110% 0%, var(--glow-2), transparent 70%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 600px);
  background-attachment: fixed;
}
::selection { background: color-mix(in srgb, var(--brand) 45%, transparent); }
a { color: var(--accent); }
code { font: 0.9em ui-monospace, "Cascadia Code", SFMono-Regular, Consolas, monospace; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.4em; font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-family: var(--font); font-weight: 650; }
.small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.hot { color: var(--critical-ink); font-weight: 600; }

/* Header: logo, clock, links; the purple rule under it matches the site's nav. */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--top-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 50%, transparent), 0 8px 30px -12px color-mix(in srgb, var(--brand) 45%, transparent);
  font-size: 15px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-name {
  font-family: var(--font-display); font-weight: 600; font-size: 16.8px; letter-spacing: 0.02em;
  padding-left: 12px; border-left: 1px solid var(--border-strong); color: var(--text-2);
}
.clock { margin-right: auto; color: var(--muted); font-size: 14.4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.top nav a, .top nav button.link { color: var(--text-2); text-decoration: none; font-weight: 500; }
.top nav a:hover, .top nav button.link:hover { color: var(--text); }
.top nav a[href="/sites/new"] {
  padding: 6px 14px; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 600;
  box-shadow: 0 4px 18px -6px color-mix(in srgb, var(--brand) 80%, transparent);
}
.top nav a[href="/sites/new"]:hover { background: var(--brand-deep); color: #fff; }
.top form { margin: 0; }
/* On a phone the header's links fold into a panel under a ⋮ button in the top-right
   corner (app.js bindTopMenu); each is a row with its icon and name. */
.top-menu-toggle, .top-label, .top-label-icon { display: none; }
@media (max-width: 640px) {
  header.top { position: relative; }
  .top .brand { order: 0; }
  .top-menu-toggle {
    order: 1; margin-left: auto; display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
    border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-2); cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
  .top-menu-toggle:hover, .top-menu-toggle[aria-expanded="true"] { color: var(--text); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
  .top-menu-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .top .clock { order: 2; flex-basis: 100%; margin: 0; }
  .top nav.top-menu {
    position: absolute; z-index: 20; top: 56px; right: 12px; min-width: 210px;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 2px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.55), 0 0 0 1px color-mix(in srgb, var(--brand) 20%, transparent);
    /* Shut: folded up into the button's corner and out of the tab order. */
    clip-path: inset(0 0 100% 0 round 12px); opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: clip-path 0.28s ease, opacity 0.2s ease, transform 0.28s ease, visibility 0s 0.28s;
  }
  .top-menu-toggle[aria-expanded="true"] + nav.top-menu {
    clip-path: inset(0 0 0 0 round 12px); opacity: 1; visibility: visible; transform: none;
    transition: clip-path 0.28s ease, opacity 0.2s ease, transform 0.28s ease;
  }
  .top nav.top-menu :is(a, button.link) {
    display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 10px 12px; border-radius: 8px;
    color: var(--text-2); font: inherit; font-size: 0.95rem; font-weight: 500; text-align: left;
  }
  .top nav.top-menu :is(a, button.link):hover { background: var(--surface-2); color: var(--text); }
  .top nav.top-menu form { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
  .top-label, .top-label-icon { display: inline; }
  .top-label-icon { display: block; flex: none; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .top nav.top-menu, .top-menu-toggle[aria-expanded="true"] + nav.top-menu { transition: none; }
}
main { flex: 1 0 auto; width: 100%; max-width: 1320px; margin: 0 auto; padding: 28px 24px 48px; }
/* The copyright bar at the bottom of every page. */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 20px;
  padding: 14px 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.8rem;
}
.foot-legal { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.foot-legal a { color: var(--muted); text-decoration: none; }
.foot-legal a:hover { color: var(--text); text-decoration: underline; }
/* Terms, Privacy, Acceptable Use, Cookies. */
.legal { width: 100%; max-width: 760px; margin: 0 auto; line-height: 1.6; }
.legal h1 { margin: 2px 0 4px; }
.legal h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.legal ul { padding-left: 20px; }
.legal li { margin: 4px 0; }
.legal-company { margin: 0; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.legal-nav { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--border); }
.legal-nav [aria-current] { font-weight: 600; }
:root[data-width="full"] main { max-width: none; padding-left: 32px; padding-right: 32px; }
.icon-link { display: inline-flex; padding: 6px; margin: -6px 0; border-radius: 8px; color: var(--text-2); }
.icon-link:hover { color: var(--text); background: var(--surface-2); }
.icon-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

button.link { background: none; border: 0; padding: 0; color: var(--text-2); font: inherit; cursor: pointer; }
.button {
  display: inline-block; padding: 9px 18px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 18px -6px color-mix(in srgb, var(--brand) 70%, transparent); transition: background 0.15s;
}
.button:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.button.secondary { background: transparent; color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.button.secondary:hover { border-color: var(--accent); }
.button.danger { background: transparent; border-color: var(--critical); color: var(--critical-ink); box-shadow: none; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Status pills: always an icon and a label, never color alone. */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.pill-up { background: var(--good-bg); color: var(--good-ink); }
.pill-warn { background: var(--warning-bg); color: var(--warning-ink); }
.pill-fail, .pill-down { background: var(--critical-bg); color: var(--critical-ink); }
.pill-unknown { border-color: var(--border); color: var(--muted); }
.pill-setup { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--text); }

.summary {
  display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 16%, transparent), var(--summary-fade) 45%), var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--good);
  border-radius: 14px; padding: 22px 26px; margin-bottom: 22px; box-shadow: 0 20px 50px -30px color-mix(in srgb, var(--brand) 60%, transparent);
}
.summary-warn { border-left-color: var(--warning); }
.summary-fail, .summary-down { border-left-color: var(--critical); }
.eyebrow {
  display: inline-block; margin: 0 0 8px; padding: 3px 10px; border-radius: 6px; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: #fff; background: color-mix(in srgb, var(--brand) 55%, transparent);
}
.summary > div:first-child { flex: 1 1 340px; min-width: 0; }
.summary h1 { margin: 0 0 4px; }
.summary .muted { margin: 0; }
.tally { display: flex; gap: 22px; margin: 0; }
/* A banner with an action (Add a client, Add an app) keeps it beside the tally. */
.summary-side { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.tally div { text-align: center; }
.tally dt { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tally dd { margin: 4px 0 0; font: 700 2rem/1 var(--font-display); font-variant-numeric: tabular-nums; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr)); gap: 18px; }
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card:hover, .mini-card:hover { border-color: color-mix(in srgb, var(--brand) 55%, transparent); box-shadow: 0 12px 34px -20px color-mix(in srgb, var(--brand) 70%, transparent); }
.card-down, .card-fail { border-color: var(--critical); box-shadow: 0 12px 34px -22px rgba(239, 68, 68, 0.8); }
.card-warn { border-color: var(--warning); }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card-head h2 { margin: 0; }
.card-title { flex: 1; min-width: 0; }
.drag {
  flex: none; align-self: flex-start; margin: -2px -6px 0 -8px; padding: 2px 4px; border: 0; border-radius: 6px;
  background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: grab; touch-action: none;
}
.drag:hover { color: var(--text); background: var(--surface-2); }
.drag:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; color: var(--text); }
.card.dragging { opacity: 0.85; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), 0 20px 40px -20px color-mix(in srgb, var(--brand) 90%, transparent); }
.card.dragging .drag { cursor: grabbing; }
.card-head h2 a { color: var(--text); text-decoration: none; }
.card-head h2 a:hover { color: var(--accent); }
.host { font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.card-status { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
/* A server's Lightsail plan beside its address, and the AWS bill above the cards (lib/aws.mjs). */
.card-plan { margin-left: 8px; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--border); font-size: 0.75rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.aws-bill { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 32px; margin-bottom: 22px; }
.aws-bill-main { flex: 1 1 300px; min-width: 0; }
.aws-bill-main .eyebrow { margin-bottom: 4px; }
.aws-bill-big { margin: 0; font: 700 2.2rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.aws-bill-main .muted { margin: 4px 0 0; }
.aws-bill-facts { display: flex; flex-wrap: wrap; gap: 14px 32px; margin: 0; }
.aws-bill-facts dt { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.aws-bill-facts dd { margin: 4px 0 0; font: 700 1.4rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.aws-bill-facts p { margin: 2px 0 0; }
.aws-bill-services { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0; padding: 0; list-style: none; font-size: 0.82rem; }
.aws-bill-services li { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); font-variant-numeric: tabular-nums; }
.aws-bill-services li:last-child { border-color: transparent; }
.aws-bill-error { flex: 1 1 100%; margin: 0; color: var(--warning-ink); }
.aws-bill-off { margin: 0 0 18px; }
.since { font-size: 0.75rem; color: var(--muted); }
.reasons { margin: 0; padding: 8px 12px 8px 28px; background: var(--warning-bg); border-radius: 8px; font-size: 0.85rem; }
.card-down .reasons, .card-fail .reasons { background: var(--critical-bg); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stats div { display: flex; flex-direction: column; }
.k { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.v { font: 600 1.1rem/1.3 var(--font-display); font-variant-numeric: tabular-nums; }

.chart-block { display: flex; flex-direction: column; gap: 4px; }
.chart-title { font-size: 0.75rem; color: var(--text-2); }
.strip { width: 100%; height: 22px; display: block; }
.cell { fill: var(--empty); }
.cell-up { fill: var(--good); }
.cell-warn { fill: var(--warning); }
.cell-fail, .cell-down { fill: var(--critical); }
.cell:hover { opacity: 0.75; }

.spark { position: relative; margin: 0; }
.spark svg { width: 100%; height: 48px; display: block; overflow: visible; }
.spark .line { fill: none; stroke: var(--series); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark .base { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark .cross { stroke: var(--text-2); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 3 3; }
.spark-empty { font-size: 0.8rem; color: var(--muted); height: 48px; display: flex; align-items: center; }
.tip {
  position: absolute; top: -30px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); font-size: 0.75rem; padding: 3px 8px; border-radius: 6px;
}

.bars { width: 100%; height: 36px; display: block; margin-top: 6px; }
.bars .bar { fill: var(--series); }
.bars .hit { fill: transparent; }
.bars .hit:hover { fill: var(--grid); fill-opacity: 0.35; }

.report { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.group p { margin: 6px 0 0; }
.meter { display: grid; grid-template-columns: 70px 1fr 56px; align-items: center; gap: 8px; font-size: 0.85rem; margin: 5px 0; }
.meter-label { color: var(--text-2); }
.meter-track { height: 8px; background: var(--empty); border-radius: 4px; overflow: hidden; }
.meter-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-deep), var(--series)); border-radius: 4px; }
.meter-warn .meter-fill { background: var(--serious); }
.meter-val { text-align: right; font-variant-numeric: tabular-nums; }
.meter-warn .meter-val { color: var(--critical-ink); font-weight: 600; }
.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0; }
.counts dt { font-size: 0.7rem; color: var(--muted); }
.counts dd { margin: 0; font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.counts .not-counted dd { color: var(--muted); font-weight: 400; }
.lights { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.light { font-size: 0.8rem; padding: 2px 9px; border-radius: 999px; background: var(--good-bg); color: var(--good-ink); }
.light-warn { background: var(--warning-bg); color: var(--warning-ink); }
.light-fail { background: var(--critical-bg); color: var(--critical-ink); }
.problems { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.problem { padding: 7px 10px; border-radius: 8px; background: var(--warning-bg); font-size: 0.85rem; }
.problem-fail { background: var(--critical-bg); }
.problem-fail > span:first-child, .problem-fail strong { color: var(--critical-ink); }
.problem-warn > span:first-child { color: var(--warning-ink); }
.problem-off { opacity: 0.7; }
.report-foot { margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px 12px; margin: 0; }
.metrics dt { font-size: 0.7rem; color: var(--muted); }
.metrics dd { margin: 0; font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.metrics .unit { font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.warn-ink { color: var(--warning-ink); font-weight: 600; }

/* Problem details fold behind their counts. */
.problems-toggle { margin-top: 8px; font-size: 0.85rem; }
.problems-toggle summary { cursor: pointer; list-style: none; display: inline-flex; gap: 6px; align-items: center; padding: 3px 0; }
.problems-toggle summary::-webkit-details-marker { display: none; }
.problems-toggle summary::before { content: "▸"; color: var(--muted); }
.problems-toggle[open] summary::before { content: "▾"; }
.problems-toggle summary:hover .muted { color: var(--text-2); text-decoration: underline; }

/* Card body: stacked in the grid, side by side when one per row. */
.card-body, .card-main, .card-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: -8px 0 16px; }
.layout-switch { display: flex; align-items: center; gap: 6px; }
.seg { white-space: nowrap; }
@media (max-width: 640px) {
  .layout-switch { flex-wrap: wrap; row-gap: 8px; }
  .per-row { margin-left: 0; }
}
.seg {
  font: inherit; font-size: 0.85rem; padding: 5px 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer;
}
.seg:first-of-type { border-radius: 8px 0 0 8px; }
.seg:last-of-type { border-radius: 0 8px 8px 0; }
.seg + .seg { margin-left: -1px; }
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

body[data-layout="rows"] .cards { grid-template-columns: 1fr; }

/* Per row: only for Grid; a fixed count from tablet width up (phones keep auto). */
.per-row { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.per-row select {
  font: inherit; font-size: 0.85rem; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.per-row select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
body:not([data-layout="grid"]) .per-row { display: none; }
@media (min-width: 900px) {
  body[data-layout="grid"][data-cols="2"] :is(.cards, .mini-cards, .crows, .goals, .todo-list, .oc-notes, .guide-grid, .ccards) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-layout="grid"][data-cols="3"] :is(.cards, .mini-cards, .crows, .goals, .todo-list, .oc-notes, .guide-grid, .ccards) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body[data-layout="grid"][data-cols="4"] :is(.cards, .mini-cards, .crows, .goals, .todo-list, .oc-notes, .guide-grid, .ccards) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body[data-layout="grid"][data-cols="5"] :is(.cards, .mini-cards, .crows, .goals, .todo-list, .oc-notes, .guide-grid, .ccards) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  body[data-layout="grid"][data-cols="6"] :is(.cards, .mini-cards, .crows, .goals, .todo-list, .oc-notes, .guide-grid, .ccards) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  body[data-layout="rows"] .card-body { display: grid; grid-template-columns: minmax(300px, 2fr) 3fr; gap: 28px; align-items: start; }
  body[data-layout="rows"] .card-side .report { border-top: 0; padding-top: 0; border-left: 1px solid var(--border); padding-left: 24px; }
  body[data-layout="rows"] .outside-only { border-left: 1px solid var(--border); padding-left: 24px; margin: 0; }
}
/* One per row on a wide card: one short band per server, in the same five columns
   down the page: the numbers, the charts, Server, Activity, Checks. */
body[data-layout="rows"] .cards > .card { container-type: inline-size; }
@container (min-width: 1120px) {
  body[data-layout="rows"] .card-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1.1fr) minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 0 20px;
  }
  body[data-layout="rows"] .card-main { grid-column: 1 / 3; grid-row: 1 / 3; display: grid; grid-template-columns: subgrid; align-content: start; row-gap: 12px; }
  body[data-layout="rows"] .card-main .stats { grid-column: 1; grid-row: 1 / 3; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; align-content: start; }
  body[data-layout="rows"] .card-main .chart-block { grid-column: 2; }
  body[data-layout="rows"] :is(.card-side, .report, .report-grid) { display: contents; }
  body[data-layout="rows"] .report .group { padding-left: 20px; border-left: 1px solid var(--border); min-width: 0; }
  body[data-layout="rows"] .report h3 { margin-top: 0; }
  body[data-layout="rows"] .g-server { grid-column: 3; grid-row: 1 / 3; }
  body[data-layout="rows"] .g-second { grid-column: 4; grid-row: 1 / 3; }
  body[data-layout="rows"] .g-checks { grid-column: 5; grid-row: 1 / 3; }
  body[data-layout="rows"] .report-foot { grid-column: 1 / -1; grid-row: 3; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
  body[data-layout="rows"] .outside-only { grid-column: 3 / -1; grid-row: 1 / 3; padding-left: 20px; }
}

/* Compact: one slim line per card. Name and status on the left, the key
   numbers on the right; charts and the server report stay on the site page. */
body[data-layout="compact"] .cards,
body[data-layout="compact"] .mini-cards { grid-template-columns: 1fr; gap: 8px; }
body[data-layout="compact"] .card { padding: 10px 16px; gap: 6px 24px; }
body[data-layout="compact"] .card-body,
body[data-layout="compact"] .card-main { display: contents; }
body[data-layout="compact"] .chart-block,
body[data-layout="compact"] .card-side,
body[data-layout="compact"] .strip-mini,
body[data-layout="compact"] .wtask-progress { display: none; }
body[data-layout="compact"] .card-head h2 { font-size: 1.05rem; }
body[data-layout="compact"] .reasons { padding: 4px 10px 4px 26px; font-size: 0.8rem; }
body[data-layout="compact"] .reasons li { display: inline; }
body[data-layout="compact"] .reasons li + li::before { content: " · "; }
body[data-layout="compact"] .mini-card { padding: 8px 14px; gap: 6px 20px; }
body[data-layout="compact"] .wtasks { gap: 4px; }
body[data-layout="compact"] .wtask + .wtask { padding-top: 4px; }
@media (min-width: 900px) {
  body[data-layout="compact"] .card { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.6fr); align-items: center; }
  body[data-layout="compact"] .card-head { align-items: center; }
  body[data-layout="compact"] .card-status { flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; }
  body[data-layout="compact"] .reasons { grid-column: 1 / -1; order: 5; }
  body[data-layout="compact"] .mini-card { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.6fr) minmax(200px, 1fr); align-items: center; }
  body[data-layout="compact"] .mini-head { align-items: center; }
  body[data-layout="compact"] .mini-reasons,
  body[data-layout="compact"] .wmanage { grid-column: 1 / -1; order: 5; }
  body[data-layout="compact"] .mini-foot .small { margin-left: 0; }
}
.tag-warn { color: var(--warning-ink); font-weight: 600; }

.incidents, .panel { margin-top: 28px; }
.panel { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); border-radius: 14px; padding: 20px 24px; }
.panel.narrow { max-width: 520px; margin: 40px auto; }
.incident-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.incident-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); }
.incident-list li:first-child { border-top: 0; }
.incident-list time { color: var(--muted); font-size: 0.85rem; min-width: 64px; }
.who { font-weight: 600; }
.empty { padding: 40px; text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; }
.crumbs { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
/* Setup steps: on their own page (Add worker) or beside the add form (Add server). */
.help-page { margin: 0; }
/* The steps in two columns, side by side on a wide screen (a second list carries on the numbering). */
.help-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 36px; align-items: start; }
.help-col { min-width: 0; }
.help-col > h2 { margin: 6px 0 8px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 650; }
.help-page h1 { margin: 0 0 10px; }
.help-page .actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 1000px) { .help-cols { grid-template-columns: 1fr; } }
/* Add server: the form on the left, its setup steps on the right; stacked on a narrow screen. */
.site-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; margin: 8px 0 40px; }
.site-add > .panel, .site-add > .panel.app-form { margin: 0; min-width: 0; }
.site-add .af-cols, .site-add .af-col { display: flex; flex-direction: column; }
.site-add-help > h2 { margin: 0 0 10px; }
@media (max-width: 1100px) { .site-add { grid-template-columns: minmax(0, 1fr); } }
.help-steps { padding-left: 1.3em; line-height: 1.5; }
.help-steps > li { margin-bottom: 10px; }
.help-page .help-steps > li { margin-bottom: 0; padding: 0 0 18px; }
.help-page .help-steps > li + li { padding-top: 18px; border-top: 1px solid var(--border); }
.help-page .help-steps > li::marker { font-weight: 700; color: var(--accent); }
.help-steps ul { margin: 6px 0 0; padding-left: 1.2em; }
.help-where { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.code-copy { position: relative; margin: 8px 0; }
.code-copy pre {
  margin: 0; padding: 10px 84px 10px 12px; overflow-x: auto; white-space: pre;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; line-height: 1.45;
}
.code-copy .button { position: absolute; top: 6px; right: 6px; }
/* A guide's HTML on its Edit page (lib/guides.mjs): numbered lines; the numbers aren't copied. */
.guide-edit { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 18px; align-items: start; }
.guide-edit > .panel { margin: 0; min-width: 0; }
.guide-settings .choice-row { grid-template-columns: 1fr; }
.guide-footer-pick:not(:has(input[value="custom"]:checked)) .guide-footer-text { display: none; }
@media (max-width: 900px) { .guide-edit { grid-template-columns: minmax(0, 1fr); } }
.guide-source-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guide-preview { display: block; width: 100%; height: 70vh; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; margin: 8px 0; }
.guide-preview[hidden], .code-copy[hidden] { display: none; }
/* The HTML box scrolls, so Copy sits clear of its scrollbar. */
.guide-source .code-copy .button { right: 24px; }
.guide-source-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.guide-source-head h2 { margin: 0 0 4px; }
.guide-source-head p { margin: 0; }
.code-lines { max-height: 70vh; overflow: auto; counter-reset: ln; font: 0.8rem/1.55 var(--font-mono, ui-monospace, Consolas, monospace); tab-size: 2; }
.code-lines .ln { counter-increment: ln; }
.code-lines .ln::before { content: counter(ln); display: inline-block; width: 3.2em; margin-right: 1em; padding-right: 0.6em; text-align: right; color: var(--muted); border-right: 1px solid var(--border); user-select: none; }

.checks { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.checks th, .checks td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--border); vertical-align: top; }
.checks tr:first-child th, .checks tr:first-child td { border-top: 0; }
.checks th { width: 140px; color: var(--text-2); font-weight: 600; }
.actions { display: flex; gap: 14px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.actions form { margin: 0; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 0.9rem; }
.form label.check { flex-direction: row; align-items: center; font-weight: 400; }
.alert-rules { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.alert-rules legend { padding: 0; margin-bottom: 4px; font-weight: 600; font-size: 0.9rem; }
.alert-rules label.check { align-items: flex-start; }
label .muted { font-weight: 400; }
.field-hint { display: block; font-weight: 400; font-size: 0.8rem; color: var(--text-2); }
.form input:not([type="checkbox"]) {
  font: inherit; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.form input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
/* Settings → Google Calendar: each app item kind, and the calendar it goes on. */
.kind-routes { margin: 4px 0 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.kind-routes-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.kind-routes ul { list-style: none; margin: 0; padding: 0; }
.kind-routes li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.kind-routes li:first-child { border-top: 0; }
.kind-routes li:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.kind-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }
.kind-count { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kind-pick { position: relative; flex: none; width: 220px; }
.kind-pick::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.kind-pick select { appearance: none; -webkit-appearance: none; width: 100%; font: inherit; font-size: 0.9rem; font-weight: 500; padding: 8px 34px 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.kind-pick select:hover { border-color: var(--accent); }
.kind-pick select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
@media (max-width: 560px) {
  .kind-routes li { flex-direction: column; align-items: stretch; gap: 8px; }
  .kind-pick { width: 100%; }
}
details summary { cursor: pointer; color: var(--text-2); margin-bottom: 10px; }
details label { margin-bottom: 12px; }
.error { background: var(--critical-bg); color: var(--critical-ink); padding: 10px 14px; border-radius: 8px; }
/* A field's own error, right under it (app.js): from the browser's checks as you go, or the server's on a sent form. */
.field-error { display: flex; gap: 6px; align-items: baseline; margin-top: 2px; font-size: 0.82rem; font-weight: 500; color: var(--critical-ink); }
.field-error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 1.15em; height: 1.15em; border-radius: 50%; background: var(--critical); color: #fff; font-size: 0.75em; font-weight: 800; }
.form-error { flex-basis: 100%; margin: 0 0 6px; }
/* A required field's asterisk (app.js markRequired). */
.req { margin-left: 2px; color: var(--critical); font-weight: 700; }
.form [aria-invalid="true"], [aria-invalid="true"]:is(input, select, textarea) { border-color: var(--critical); }
fieldset[aria-invalid="true"] { border-color: var(--critical); }
.danger-zone { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.goal-convert { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.goal-convert + .danger-zone { margin-top: 18px; }
.secret code { font-size: 1.2rem; letter-spacing: 0.08em; word-break: break-all; }
.recovery { columns: 2; font-size: 1rem; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .top { padding: 12px 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .report-grid { grid-template-columns: 1fr; }
  .summary { padding: 16px; }
  .panel { padding: 16px; }
}

/* Tabs (left of the layout switch). */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.tab { position: relative; padding: 6px 14px; border-radius: 7px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.tab:hover { background: var(--bg); color: var(--text); }
.tab[aria-current="page"] { background: var(--brand); color: #fff; box-shadow: 0 4px 14px -6px color-mix(in srgb, var(--brand) 90%, transparent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Number circles on the tabs: red = failing, yellow = needs you, blue = activity, green = on track.
   Pinned to the tab's top-right corner so a badge never changes a tab's width or the spacing. */
.tab-badge {
  position: absolute; top: -5px; right: -5px; z-index: 1;
  display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; font-size: 0.66rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}
.tab-badge-warn { background: #f5b301; color: #1a1300; }
.tab-badge-bad { background: #e5484d; color: #fff; }
.tab-badge-info { background: #3b82f6; color: #fff; }
.tab-badge-good { background: #22a06b; color: #fff; }
.tab[aria-current="page"] .tab-badge { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }
/* On a phone the tabs fold into a menu: a button with the current tab; tap it and the
   tabs slide open one per row, pick one and they slide shut (app.js bindTabMenu). */
.tabs-menu, .tabs-fold { display: contents; }
/* The arrow on a fold-down menu's button (the tabs, Communications' side): down, up when open. */
.fold-caret { flex: none; width: 8px; height: 8px; margin-top: -4px; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg); transition: transform 0.25s ease, margin 0.25s ease; }
[aria-expanded="true"] > .fold-caret { transform: rotate(-135deg); margin-top: 4px; }
.tabs-toggle { display: none; }
/* Each tab's icon (Lucide, ISC licence), only in the phone menu; the desktop tabs stay words.
   Drawn as a mask in the text's colour, so the tab markup needn't change. */
:is(.tab, .tabs-toggle)[data-key="overview"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='7' height='9' x='3' y='3' rx='1'/%3E%3Crect width='7' height='5' x='14' y='3' rx='1'/%3E%3Crect width='7' height='9' x='14' y='12' rx='1'/%3E%3Crect width='7' height='5' x='3' y='16' rx='1'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="goals"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='12' r='6'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="clients"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16'/%3E%3Crect width='20' height='14' x='2' y='6' rx='2'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="servers"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='20' height='8' x='2' y='2' rx='2'/%3E%3Crect width='20' height='8' x='2' y='14' rx='2'/%3E%3Cpath d='M6 6h.01'/%3E%3Cpath d='M6 18h.01'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="apps"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='M10 4v4'/%3E%3Cpath d='M2 8h20'/%3E%3Cpath d='M6 4v4'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="websites"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20'/%3E%3Cpath d='M2 12h20'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="workers"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 8V4H8'/%3E%3Crect width='16' height='12' x='4' y='8' rx='2'/%3E%3Cpath d='M2 14h2'/%3E%3Cpath d='M20 14h2'/%3E%3Cpath d='M15 13v2'/%3E%3Cpath d='M9 13v2'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="todos"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 17 2 2 4-4'/%3E%3Cpath d='m3 7 2 2 4-4'/%3E%3Cpath d='M13 6h8'/%3E%3Cpath d='M13 12h8'/%3E%3Cpath d='M13 18h8'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="comms"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="schedule"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="finances"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v20'/%3E%3Cpath d='M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="partners"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="accounts"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z'/%3E%3Ccircle cx='16.5' cy='7.5' r='.5' fill='black'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="documents"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z'/%3E%3Cpath d='M14 2v4a2 2 0 0 0 2 2h4'/%3E%3Cpath d='M10 9H8'/%3E%3Cpath d='M16 13H8'/%3E%3Cpath d='M16 17H8'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="history"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E"); }
:is(.tab, .tabs-toggle)[data-key="notes"] { --tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z'/%3E%3Cpath d='M15 3v4a2 2 0 0 0 2 2h4'/%3E%3C/svg%3E"); }
@media (max-width: 640px) {
  :is(.tabs-fold .tab, .tabs-toggle)::before {
    content: ""; flex: none; width: 18px; height: 18px; background: currentColor;
    -webkit-mask: var(--tab-icon) center / contain no-repeat; mask: var(--tab-icon) center / contain no-repeat;
  }
  .tabs-toggle::before { color: var(--accent); }
  .tabs-fold .tab:not([aria-current])::before { opacity: 0.6; transition: opacity 0.15s ease; }
  .tabs-fold .tab:hover::before { opacity: 1; }
  .tabs-menu { display: block; flex: 1 1 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
  .tabs-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px;
    background: none; border: 0; border-radius: 10px; color: var(--text); font: inherit; font-weight: 600; font-size: 0.95rem; text-align: left; cursor: pointer;
  }
  .tabs-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .tabs-toggle-label { flex: 1; }
  /* A dot on the closed menu when a tab inside it has a number circle. */
  .tabs-menu:has(.tab:not([aria-current]) .tab-badge) .tabs-toggle-label::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; vertical-align: middle; border-radius: 50%; background: #3b82f6; }
  .tabs-menu:has(.tab:not([aria-current]) .tab-badge-warn) .tabs-toggle-label::after { background: #f5b301; }
  .tabs-menu:has(.tab:not([aria-current]) .tab-badge-bad) .tabs-toggle-label::after { background: #e5484d; }
  .tabs-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
  .tabs-toggle[aria-expanded="true"] + .tabs-fold { grid-template-rows: 1fr; }
  .tabs-fold > .tabs {
    min-height: 0; overflow: hidden; flex-direction: column; flex-wrap: nowrap; gap: 2px;
    background: none; border: 0; border-radius: 0; padding: 0 6px;
    /* Hidden once shut, so its links aren't tabbed to. */
    opacity: 0; visibility: hidden; transition: opacity 0.2s ease, padding 0.3s ease, visibility 0s 0.3s;
  }
  .tabs-toggle[aria-expanded="true"] + .tabs-fold > .tabs { opacity: 1; visibility: visible; padding: 0 6px 6px; transition: opacity 0.2s ease, padding 0.3s ease; }
  .tabs-fold .tab { display: flex; align-items: center; gap: 12px; padding: 10px 12px; font-size: 0.95rem; }
  .tabs-fold .tab-badge { margin-left: auto; }
  .tabs-fold .tab-badge { position: static; box-shadow: none; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .tabs-fold, .tabs-fold > .tabs { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fold-caret { transition: none; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Tags. */
.tag { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--text-2); }
.tag-muted { color: var(--muted); font-weight: 500; }
.tag-warn { background: var(--warning-bg); border-color: transparent; color: var(--warning-ink); }
.tag-deploy { background: color-mix(in srgb, var(--brand) 15%, transparent); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--accent); }

/* Websites: the BMTS / outside filter and smaller cards. */
.site-filter { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.site-filter .app-filter { margin: 0; }
a.chip { text-decoration: none; }
/* A website's edit page: what the BMTS platform sets is shown, not changed. */
.af input:disabled { color: var(--muted); background: transparent; border-style: dashed; cursor: not-allowed; }
.mini-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 14px; }
.mini-card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); border-radius: 12px; transition: border-color 0.15s, box-shadow 0.15s; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mini-card.card-down { border-color: var(--critical); }
.mini-card.card-warn { border-color: var(--warning); }
.mini-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.mini-head h3 { margin: 0; font-size: 0.98rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.mini-head h3 a { color: var(--text); text-decoration: none; }
.mini-head h3 a:hover { color: var(--accent); }
.mini-head .host { font-size: 0.78rem; color: var(--muted); word-break: break-all; }
.mini-reasons { margin: 0; padding: 5px 8px; border-radius: 6px; background: var(--warning-bg); }
.card-down .mini-reasons { background: var(--critical-bg); }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0; }
.mini-stats dt { font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.mini-stats dd { margin: 0; font-size: 0.92rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.mini-stats .unit { font-size: 0.7rem; font-weight: 400; color: var(--muted); }
.strip-mini { height: 12px; }
.mini-foot { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.mini-foot .small { margin-left: auto; }
body[data-layout="rows"] .mini-cards { grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 900px) {
  body[data-layout="rows"] .mini-card { display: grid; grid-template-columns: minmax(200px, 1.3fr) minmax(260px, 1.4fr) minmax(140px, 1fr) minmax(220px, 1.2fr); align-items: center; gap: 16px; }
  body[data-layout="rows"] .mini-reasons { grid-column: 1 / -1; order: 5; }
  body[data-layout="rows"] .mini-foot .small { margin-left: 0; }
}

/* Incidents tab. */
.incidents-tab h3, .changes h3 { margin-top: 22px; }
.history-jump { margin: -8px 0 18px; color: var(--muted); }
.history-rule { border: 0; border-top: 1px solid var(--border-strong); margin: 32px 0; }
.count { display: inline-block; min-width: 22px; text-align: center; font-size: 0.8rem; padding: 1px 7px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--text-2); }
.incident { flex-direction: column; align-items: stretch !important; gap: 4px !important; }
.incident-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.incident-down, .incident-fail { border-left: 4px solid var(--critical); }
.incident-warn { border-left: 4px solid var(--warning); }

/* Who's working (lib/tabs.mjs workersStrip / workersView) */
.whos-working { margin-bottom: 22px; }
.whos-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.whos-head h2 { margin: 0; }
.mini-card.worker-working { border-color: var(--good); }
.mini-card.worker-offline { opacity: 0.6; }
.wnone { margin: 0; }
.wstop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.wstop form { margin: 0; }
.wtasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wtask + .wtask { border-top: 1px solid var(--border); padding-top: 10px; }
.wtask-title { font-weight: 650; overflow-wrap: anywhere; }
.wtask-title a { color: var(--text); }
.wtask-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
.wtask-for { font-weight: 650; color: var(--good-ink); font-variant-numeric: tabular-nums; }
.wtask-progress { margin-top: 3px; }
.wtask-stale { opacity: 0.7; }
/* Edit: a gear at the card's top right that opens the worker's Edit page. */
.whead { position: relative; }
.wmanage { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; color: var(--muted); text-decoration: none; transition: color 0.15s, background 0.15s, border-color 0.15s; }
.wmanage:hover { color: var(--text); background: var(--bg); border-color: var(--border); }
.wmanage svg { transition: transform 0.3s; }
.wmanage:hover svg { transform: rotate(60deg); }
.wmanage:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.wdesc { margin: 2px 0 8px; color: var(--text-2); line-height: 1.45; }
button.link.danger { color: var(--critical-ink); }

/* The Workers tab's big cards: a 24-hour activity chart, a busy ring and a live signal line. */
/* "Auto" per row; a picked number per row (data-cols) and the other layouts win over this. */
.mini-cards.wcards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 580px), 1fr)); gap: 18px; }
.mini-card.worker.worker-big { padding: 20px 22px; gap: 16px; overflow: visible; container-type: inline-size; }
.worker-big .whead { gap: 16px; }
.worker-big .wdrone { width: 88px; height: 88px; border-radius: 16px; }
.worker-big .wdrone .robot-svg { width: 58px; }
.worker-big .wdrone-pad { width: 54px; margin-left: -27px; height: 9px; }
.worker-big .whead-name h3 { font-size: 1.3rem; }
.worker-big .whead-name .host { font-size: 0.82rem; }
.worker-big.worker-working::before { border-radius: 12px 12px 0 0; }
.wtele { display: grid; grid-template-columns: 112px 1fr; gap: 14px 20px; align-items: center; padding: 16px; border-radius: 12px; border: 1px solid var(--border); background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 6%, transparent), transparent 70%), var(--bg); position: relative; overflow: hidden; }
.wtele::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(color-mix(in srgb, var(--brand) 16%, transparent) 1px, transparent 1px); background-size: 14px 14px; mask-image: linear-gradient(90deg, transparent, #000 40%); opacity: 0.6; }
.wring { position: relative; width: 112px; height: 112px; }
.wring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.wring circle { fill: none; stroke-width: 8; }
.wring-track { stroke: var(--border); }
.wring-ticks { stroke: var(--border-strong); stroke-width: 2 !important; stroke-dasharray: 1 9.99; opacity: 0.8; }
.wring-fill { stroke: var(--accent); stroke-linecap: round; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--brand) 60%, transparent)); transition: stroke-dasharray 0.6s; }
.worker-working .wring-fill { stroke: var(--good); filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.7)); }
.wring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.wring-label strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.wring-label small { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.wring-label span { font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.wchart { min-width: 0; position: relative; z-index: 1; }
.wchart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.wchart-standby { color: var(--accent); animation: wblink 2.4s ease-in-out infinite; }
.wchart-standby::before { content: "● "; }
.worker-offline .wchart-standby { color: var(--muted); animation: none; }
.wbars { display: block; width: 100%; height: 72px; overflow: visible; }
.wbars line { stroke: var(--border); stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
.wbar { fill: var(--accent); opacity: 0.85; }
.worker-working .wbar { fill: var(--good); }
.wbar-off { fill: var(--border-strong) !important; opacity: 0.5; }
.wbar-now { animation: wblink 1.4s ease-in-out infinite; }
.wbars-quiet .wbar-off { animation: wquiet 3s ease-in-out infinite; }
.wbars-quiet .wbar-off:nth-of-type(4n + 1) { animation-delay: 0.4s; }
.wbars-quiet .wbar-off:nth-of-type(4n + 2) { animation-delay: 0.8s; }
.wbars-quiet .wbar-off:nth-of-type(4n + 3) { animation-delay: 1.2s; }
.worker-offline .wbars-quiet .wbar-off { animation: none; }
.wchart-axis { display: flex; justify-content: space-between; font-size: 0.66rem; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.wsignal { grid-column: 1 / -1; height: 34px; overflow: hidden; position: relative; z-index: 1; mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.wsignal svg { width: 200%; height: 100%; display: block; animation: wsignal 6s linear infinite; }
.wsignal path { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; opacity: 0.7; }
.worker-working .wsignal path { stroke: var(--good); opacity: 1; filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.8)); }
.worker-working .wsignal svg { animation-duration: 5s; } /* a calm beat while working; idle is 6s */
.worker-offline .wsignal path { stroke: var(--muted); opacity: 0.4; }
.worker-offline .wsignal svg { animation: none; }
.wstats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; position: relative; z-index: 1; }
.wstats div { padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.wstats dt { font-size: 0.64rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wstats dd { margin: 2px 0 0; font-size: 0.98rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.worker-big .wtasks { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.worker-big .wtask-title { font-size: 1.02rem; }
/* Narrow cards (a phone, or 3+ per row): stack the ring over the chart, smaller robot, stats in pairs. */
@container (max-width: 520px) {
  .wtele { grid-template-columns: 1fr; justify-items: center; padding: 14px; }
  .wchart { width: 100%; }
  .wstats { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .worker-big .whead { gap: 12px; flex-wrap: wrap; }
  .worker-big .wdrone { width: 64px; height: 64px; border-radius: 12px; }
  .worker-big .wdrone .robot-svg { width: 42px; }
  .worker-big .wdrone-pad { width: 40px; margin-left: -20px; }
  .worker-big .whead-name h3 { font-size: 1.1rem; }
}
/* Very narrow (4+ per row): the robot beside the name with the status under it, the gear pinned top right. */
@container (max-width: 380px) {
  .worker-big .whead { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 12px; padding-right: 38px; }
  .worker-big .wdrone { grid-row: span 2; }
  .worker-big .whead > .pill { justify-self: start; align-self: start; }
  .worker-big .whead-name { align-self: end; }
  .worker-big .whead-name .host { word-break: normal; overflow-wrap: anywhere; }
  .worker-big .wmanage { position: absolute; top: 0; right: 0; }
  .wchart-head { flex-wrap: wrap; }
}
/* One per row: full width, the header across the top, the activity panel on the left and the work on the right. */
body[data-layout="rows"] .mini-cards.wcards { grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 900px) {
  body[data-layout="rows"] .mini-card.worker.worker-big { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); align-items: start; gap: 16px 22px; }
  body[data-layout="rows"] .worker-big .whead { grid-column: 1 / -1; }
  body[data-layout="rows"] .worker-big .wtele { grid-column: 1; grid-row: 2; }
  body[data-layout="rows"] .worker-big :is(.wtasks, .wnone) { grid-column: 2; grid-row: 2; }
  body[data-layout="rows"] .worker-big .wnone { padding: 14px; border-radius: 10px; border: 1px dashed var(--border); text-align: center; }
}
body[data-layout="compact"] .mini-cards.wcards { grid-template-columns: 1fr; }
body[data-layout="compact"] .wtele { display: none; }
@keyframes wsignal { to { transform: translateX(-50%); } }
@keyframes wblink { 50% { opacity: 0.45; } }
@keyframes wquiet { 50% { opacity: 0.15; } }
.wrecent { margin-top: 26px; }

/* Worker cards: each machine's drone in its bay. Working ones hover with the
   eye sweeping and exhaust puffing; idle ones float and blink; offline ones go dark. */
.mini-card.worker { position: relative; overflow: hidden; }
.mini-card.worker-working { background: radial-gradient(120% 90% at 0% 0%, rgba(34, 197, 94, 0.10), transparent 55%), linear-gradient(180deg, var(--surface-2), var(--surface)); box-shadow: 0 14px 36px -24px rgba(34, 197, 94, 0.7); }
.mini-card.worker-working::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, transparent, var(--good), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: wscan 3.2s linear infinite; }
.whead { align-items: center; gap: 12px; }
.whead-name { flex: 1; min-width: 0; }
.wdrone { position: relative; flex: none; width: 58px; height: 58px; border-radius: 12px; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #1b1430, #07070d 75%); border: 1px solid color-mix(in srgb, var(--brand-deep) 45%, transparent); box-shadow: inset 0 0 14px color-mix(in srgb, var(--brand-deep) 35%, transparent); }
.wdrone .robot-svg { position: relative; z-index: 1; width: 38px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 5px rgba(255, 45, 111, 0.3)); margin-top: -4px; }
.wdrone .r-foot { animation: none; }
.wdrone-pad { position: absolute; left: 50%; bottom: 4px; width: 36px; height: 7px; margin-left: -18px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 70%, transparent), transparent); }
.worker-working .wdrone { border-color: rgba(34, 197, 94, 0.55); box-shadow: inset 0 0 14px rgba(34, 197, 94, 0.25), 0 0 14px -4px rgba(34, 197, 94, 0.6); }
.worker-working .wdrone .robot-svg { animation: wdrone-hover 1.6s ease-in-out infinite; }
.worker-working .wdrone-pad { background: radial-gradient(closest-side, rgba(34, 197, 94, 0.8), transparent); animation: wdrone-pad 1.6s ease-in-out infinite; }
.worker-working .wdrone .r-eye { animation-duration: 1.4s; }
.worker-idle .wdrone .robot-svg { animation: idle-float 3.2s ease-in-out infinite; }
.worker-idle .wdrone .r-eye { animation: idle-blink 5.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.worker-idle .wdrone .r-core { animation: core-pulse 3.4s ease-in-out infinite; }
.worker-offline .wdrone { border-color: var(--border); box-shadow: none; }
.worker-offline .wdrone .robot-svg { filter: grayscale(1) brightness(0.7); margin-top: 2px; }
.worker-offline .wdrone .r-eye, .worker-offline .wdrone .r-core { animation: none; opacity: 0.15; }
.worker-offline .wdrone-pad { opacity: 0; }
.wtally .wt-working dd { color: var(--good-ink); }
.wtally .wt-offline dd { color: var(--muted); }
.wdone-mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 0.7rem; background: var(--bg); border: 1px solid var(--border); color: var(--muted); }
.wdone-done .wdone-mark { background: var(--good-bg); border-color: transparent; color: var(--good-ink); }
.wdone-lost .wdone-mark { background: var(--warning-bg); border-color: transparent; color: var(--warning-ink); }
@keyframes wdrone-hover { 50% { transform: translateY(-3px); } }
@keyframes wdrone-pad { 50% { transform: scaleX(0.75); opacity: 0.6; } }
@keyframes wscan { from { background-position: -100% 0; } to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .mini-card.worker-working::before, .wdrone .robot-svg, .wdrone .r-eye, .wdrone .r-core, .wdrone-pad, .wsignal svg, .wbar, .wchart-standby { animation: none !important; }
}

/* Sign-in and setup pages: a centered panel with the purple glow behind it. */
.panel.narrow { box-shadow: 0 30px 80px -40px color-mix(in srgb, var(--brand) 80%, transparent); border-top: 2px solid var(--brand); }
@media (max-width: 640px) {
  .top { position: static; padding: 8px 16px; }
  .brand-logo { height: 32px; }
  .brand-name { font-size: 0.95rem; padding-left: 10px; }
  .tally { gap: 12px; flex-wrap: wrap; }
  .tally dd { font-size: 1.6rem; }
}

/* Settings: two option cards per choice, each with a tiny preview. */
.settings { max-width: 760px; margin: 0 auto; }
/* The Settings page: full width, connections on the left and agent access on the right, always the same height. */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.settings-card { margin: 0; min-width: 0; }
.settings-card > h2 { margin-top: 0; }
#agent .users-table td { white-space: normal; }
#agent .users-table .button { padding: 6px 12px; }
@media (max-width: 980px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
/* Connections: one row each (name, what it's for, status). Click a row and it opens below. */
.conn-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.conn + .conn { border-top: 1px solid var(--border); }
.conn > summary { display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 14px; list-style: none; color: var(--text); }
.conn > summary::-webkit-details-marker { display: none; }
.conn > summary:hover, .conn[open] > summary { background: var(--surface-2); }
.conn > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.conn-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conn-name strong { font: 650 1rem var(--font-display); }
.conn > summary .tag { flex: none; }
.conn-chevron { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; margin: 0 4px; }
.conn[open] .conn-chevron { transform: rotate(45deg); }
.conn-body { padding: 4px 14px 14px; background: var(--surface-2); }
/* An agent key opened: its facts in two columns, then Revoke. */
.conn-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 6px 0 12px; font-size: 0.92rem; }
.conn-facts dt { color: var(--muted); }
.conn-facts dd { margin: 0; overflow-wrap: anywhere; }
/* The row already shows the status tag; the sentence below it doesn't repeat it. */
.conn-body > p.small:first-child > .tag:first-child { display: none; }
.notice { background: var(--good-bg); color: var(--good-ink); padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.choice { border: 0; margin: 0; padding: 0; }
.choice legend { font: 650 1rem var(--font-display); margin-bottom: 10px; padding: 0; }
.choice-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form label.option {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px; cursor: pointer; font-weight: 400;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg); transition: border-color 0.15s, box-shadow 0.15s;
}
.option:hover { border-color: var(--accent); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), 0 10px 30px -18px color-mix(in srgb, var(--brand) 90%, transparent); }
.option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.option:has(input:checked) .option-label::after { content: "✓"; margin-left: 6px; color: var(--accent); }
.option-label { font-weight: 650; }
.option-hint { font-size: 0.82rem; color: var(--muted); }
.option-preview { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 10px 34px; gap: 5px; padding: 8px; border-radius: 8px; margin-bottom: 6px; height: 70px; }
.option-preview span { border-radius: 4px; }
.option-preview span:first-child { grid-column: 1 / -1; }
.option-theme-dark .option-preview { background: #06080d; border: 1px solid #1f2836; }
.option-theme-dark .option-preview span { background: #161c28; }
.option-theme-dark .option-preview span:first-child { background: var(--brand); }
.option-theme-light .option-preview { background: #f4f3f8; border: 1px solid #e3e0ec; }
.option-theme-light .option-preview span { background: #fff; border: 1px solid #e3e0ec; }
.option-theme-light .option-preview span:first-child { background: var(--brand); border: 0; }
.option-width-boxed .option-preview, .option-width-full .option-preview { background: var(--empty); }
.option-width-boxed .option-preview { padding: 8px 26px; }
.option-width-boxed .option-preview span, .option-width-full .option-preview span { background: var(--series); opacity: 0.55; }
.option-width-boxed .option-preview span:first-child, .option-width-full .option-preview span:first-child { opacity: 1; }
[class*="option-text-"] .option-preview { display: flex; align-items: center; justify-content: center; background: var(--empty); }
[class*="option-text-"] .option-preview span { display: none; }
[class*="option-text-"] .option-preview::after { content: "Aa"; font: 650 22px/1 var(--font-display); color: var(--text); }
.option-text-small .option-preview::after { font-size: 17px; }
.option-text-large .option-preview::after { font-size: 29px; }
/* My account: two equal columns (details on the left, appearance on the right), the option cards a little narrower to fit. */
.account-form .settings-card { display: flex; flex-direction: column; gap: 14px; }
.account-form textarea {
  font: inherit; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical;
}
.account-form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
/* Mailing address (My account, user form): Street on top, then City | State | ZIP; they stack on a phone. */
.form .address-fields { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.form .address-fields legend { padding: 0; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; }
.address-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) 7.5em; gap: 8px; }
.address-row .small { font-weight: 500; color: var(--text-2); }
.address-row label { min-width: 0; }
.address-row input, .address-row select { width: 100%; min-width: 0; box-sizing: border-box; }
.address-fields textarea, .address-fields select {
  font: inherit; font-weight: 400; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical; min-width: 0;
}
.address-fields textarea:focus, .address-fields select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
@media (max-width: 520px) { .address-row { grid-template-columns: 1fr 1fr; } .address-city { grid-column: 1 / -1; } }
/* A new email waiting for its code: a highlighted box under the Email field. */
.email-confirm { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--brand) 45%, var(--border)); background: color-mix(in srgb, var(--brand) 8%, var(--bg)); }
.email-confirm p { margin: 0; }
.email-confirm-row { display: flex; gap: 10px; }
.email-confirm-row input { flex: 1; min-width: 0; letter-spacing: 0.2em; font-variant-numeric: tabular-nums; }
.email-confirm-more { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.email-confirm-more button.link { color: var(--accent); }
.appearance-grid .choice-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.appearance-save { margin-top: 4px; }
/* Accent color: round swatches (radio buttons underneath) and a Custom one that opens the color picker. */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.form label.swatch { position: relative; display: block; width: 38px; height: 38px; margin: 0; cursor: pointer; }
.swatch input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.swatch-dot { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); transition: box-shadow 0.15s, transform 0.15s; }
.swatch:hover .swatch-dot { transform: scale(1.08); }
.swatch:has(input:checked) .swatch-dot { box-shadow: 0 0 0 2px var(--text); }
.swatch:has(input:checked) .swatch-dot::after { content: "✓"; display: grid; place-items: center; height: 100%; color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 50%; }
.swatch-custom .swatch-dot { background: conic-gradient(#ef4444, #f59e0b, #22c55e, #06b6d4, #3b82f6, #a855f7, #ef4444); }
.swatch-custom:has(input:checked) .swatch-dot { background: var(--c); }
.form .swatch-custom input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.accent-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); }
.accent-preview .button { pointer-events: none; }

/* The hidden attribute wins over any display rule below. */
[hidden] { display: none !important; }

/* To-dos, Communications, Scheduling (lib/hub.mjs). */
.tag-app { background: color-mix(in srgb, var(--brand) 12%, transparent); border-color: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--accent); }
.app-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chip {
  font: inherit; font-size: 0.85rem; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip[aria-pressed="true"] .count { background: rgba(255, 255, 255, 0.2); border-color: transparent; color: #fff; }
.chip:focus-visible, .folder:focus-visible, .comm-row:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.count-alert { background: var(--critical); border-color: var(--critical); color: #fff; }

/* To-dos: one panel, one row of filters, a flat list (like BMTS's queue). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.125em; }
.button.small { padding: 5px 12px; font-size: 0.85rem; box-shadow: none; }
.todo-panel { padding: 16px 20px; }
.todo-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; }
/* The three filter strips (who, approval, status): 40px apart on a wide screen. On a phone
   they fold under a button reading what's picked; tap it and they slide open (app.js bindTodos). */
.todo-strips-menu, .strips-fold, .todo-strips { display: contents; }
@media (min-width: 761px) { .todo-filters { column-gap: 40px; } }
.strips-toggle { display: none; }
@media (max-width: 760px) {
  .todo-strips-menu { display: block; flex: 1 1 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
  .strips-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
    background: none; border: 0; border-radius: 10px; color: var(--text); font: inherit; font-weight: 600; font-size: 0.9rem; text-align: left; cursor: pointer;
  }
  .strips-toggle > .icon { color: var(--accent); }
  .strips-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .strips-toggle-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .strips-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
  .strips-toggle[aria-expanded="true"] + .strips-fold { grid-template-rows: 1fr; }
  .todo-strips {
    display: flex; min-height: 0; overflow: hidden; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; margin: 0; padding: 0 8px;
    /* Hidden once shut, so its buttons aren't tabbed to. */
    opacity: 0; visibility: hidden; transition: opacity 0.2s ease, padding 0.3s ease, visibility 0s 0.3s;
  }
  .strips-toggle[aria-expanded="true"] + .strips-fold > .todo-strips { opacity: 1; visibility: visible; padding: 0 8px 8px; transition: opacity 0.2s ease, padding 0.3s ease; }
  .todo-strips .todo-strip { background: var(--surface); }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .strips-fold, .todo-strips { transition: none; }
}
/* The filter strips, as on BMTS: a tinted track, the chosen tab raised. */
.todo-strip { display: flex; flex: none; max-width: 100%; overflow-x: auto; scrollbar-width: none; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.todo-strip button {
  display: inline-flex; align-items: center; gap: 5px; flex: none; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px;
  background: none; color: var(--text-2); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.todo-strip button:hover { color: var(--text); }
.todo-strip button[aria-pressed="true"] { background: var(--surface); border-color: var(--border-strong); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.todo-strip button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.todo-strip .count { min-width: 20px; padding: 0 6px; font-size: 0.72rem; font-weight: 700; line-height: 18px; }
.count-alert { background: var(--critical); border-color: var(--critical); color: #fff; }
.count-info { background: var(--info-bg); border-color: transparent; color: var(--info-ink); }
.todo-filter-menus { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.ctl {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 4px 0 8px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 0.8rem;
}
.ctl select { font: inherit; color: var(--text); background: transparent; border: 0; padding: 4px 2px; cursor: pointer; max-width: 170px; text-overflow: ellipsis; }
.ctl select option { background: var(--surface); color: var(--text); }
.ctl:focus-within { border-color: var(--brand); }
.ctl select:focus-visible { outline: none; }
.ctl-filter { height: 34px; font-size: 0.85rem; }
.todo-search {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--muted);
}
.todo-search:focus-within { border-color: var(--brand); }
.todo-search input { font: inherit; font-size: 0.85rem; width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text); }
.todo-search { flex: 1 1 120px; min-width: 90px; max-width: 220px; }
.todo-search input:focus { outline: none; }
.todo-count { margin: 12px 0 0; }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px 4px; border-top: 1px solid var(--border); }
.todo:first-child { border-top: 0; }
.todo-in_progress { margin: 0 -8px; padding: 14px 12px; border-radius: 10px; background: var(--info-bg); box-shadow: inset 0 0 0 1px var(--info); }
.todo-in_progress + .todo { border-top-color: transparent; }
.todo-in_progress + .todo-in_progress { margin-top: 6px; }
.todo-status { width: 22px; height: 22px; display: grid; place-items: center; font-size: 20px; color: var(--muted); }
.todo-status-warn { color: var(--critical-ink); }
.todo-status-hold { color: var(--warning-ink); }
.todo-status-up { color: var(--good-ink); }
.todo-status-merging, .ib-merging { color: color-mix(in srgb, #14b8a6 70%, var(--text)); }
.todo-status-deploying, .ib-deploying { color: color-mix(in srgb, #6366f1 70%, var(--text)); }
.todo-status-review { color: color-mix(in srgb, #6366f1 70%, var(--text)); }
.todo-status-dismissed { color: var(--muted); }
.todo-pulse { position: relative; width: 14px; height: 14px; display: grid; place-items: center; }
.todo-pulse::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--info); opacity: 0.5; animation: todo-ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite; }
.todo-pulse span { width: 10px; height: 10px; border-radius: 50%; background: var(--info); }
@keyframes todo-ping { 75%, 100% { transform: scale(1.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .todo-pulse::before { animation: none; } }
.todo-main { min-width: 0; }
.todo-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.todo-badges .tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; padding: 2px 9px; }
.todo-title { margin: 6px 0 0; font-size: 1.02rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.todo-num { margin-right: 4px; padding: 1px 7px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-2); color: var(--accent); font: 700 0.85rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; vertical-align: 1px; cursor: copy; }
.todo-num:hover { border-color: var(--brand); }
.todo-num:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.todo-done .todo-num, .todo-dismissed .todo-num { text-decoration: none; display: inline-block; }
.todo-done .todo-title, .todo-dismissed .todo-title { color: var(--muted); font-weight: 500; text-decoration: line-through; }
.todo-when { display: flex; align-items: center; gap: 5px; margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); }
.tag-ai { background: color-mix(in srgb, var(--brand) 12%, transparent); border-color: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--accent); }
.tag-human { background: var(--good-bg); border-color: transparent; color: var(--good-ink); }
/* A personal to-do (lib/todos.mjs): only its maker sees it. */
.tag-personal { background: color-mix(in srgb, #f59e0b 14%, transparent); border-color: color-mix(in srgb, #f59e0b 42%, transparent); color: color-mix(in srgb, #f59e0b 62%, var(--text)); }
.tag-approved { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good-ink); }
/* An AI to-do's code-change and go-live approvals (lib/hub.mjs aiApprovals): badges that toggle. */
.tag-form { display: inline-flex; margin: 0; }
.tag-toggle { font: inherit; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.tag-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.tag-toggle-off { background: transparent; border: 1px dashed var(--border-strong); color: var(--muted); font-weight: 500; }
.tag-toggle-off:hover { border-style: solid; color: var(--text); }
/* Not yet: the approval before it comes first (lib/hub.mjs aiApprovals). */
.tag-toggle-off[data-waiting] { opacity: 0.65; }
.tag-drive { background: color-mix(in srgb, #16a34a 14%, transparent); border-color: color-mix(in srgb, #16a34a 40%, transparent); color: color-mix(in srgb, #16a34a 70%, var(--text)); }
.tag-code { background: color-mix(in srgb, #a855f7 16%, transparent); border-color: color-mix(in srgb, #a855f7 45%, transparent); color: color-mix(in srgb, #a855f7 70%, var(--text)); }
.tag-live { background: color-mix(in srgb, #14b8a6 16%, transparent); border-color: color-mix(in srgb, #14b8a6 45%, transparent); color: color-mix(in srgb, #14b8a6 70%, var(--text)); }
:is(.tag-code, .tag-live).tag-toggle:hover { filter: brightness(1.15); }
.tag-repeat { background: var(--warning-bg); border-color: transparent; color: var(--warning-ink); }
/* The server or website a to-do is also about: a link to its page. */
a.tag-about { color: var(--text-2); text-decoration: none; }
a.tag-about:hover { border-color: var(--brand); color: var(--text); }
/* A to-do kept on Build My Trade Site (lib/bmtstodos.mjs): its badge links there,
   the line over the list says when they were read, and a worker's progress shows. */
.tag-bmts { background: color-mix(in srgb, var(--brand) 8%, transparent); color: var(--text-2); text-decoration: none; }
a.tag-bmts:hover { border-color: var(--brand); color: var(--text); }
.todo-sync { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.todo-sync-bad { color: var(--warning-ink); }
/* What a BMTS worker is on right now (lib/hub.mjs workingBanner): blue with a
   pinging dot while it checks in, red once it may be stuck. 30px under the filters. */
.todo-progress { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 0; padding: 4px 8px; border-radius: 8px; font-size: 0.8rem; width: fit-content; max-width: 100%; }
.todo-progress .icon { flex: none; margin-top: 2px; }
.todo-progress-good { background: var(--good-bg); color: var(--good-ink); }
.todo-progress-bad { background: var(--critical-bg); color: var(--critical-ink); }
.todo-progress-warn { background: var(--warning-bg); color: var(--warning-ink); }
.todo-progress-info { background: var(--info-bg); color: var(--info-ink); }
.todo-progress-muted { background: var(--empty); color: var(--muted); }
.todo-progress a { color: inherit; text-decoration: underline; }
.todo-progress .muted { color: inherit; opacity: 0.75; }
.todo-working-banner { display: flex; align-items: flex-start; gap: 10px; margin: 30px 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--info-bg); border: 1px solid color-mix(in srgb, var(--info) 40%, transparent); color: var(--info-ink); }
.todo-working-banner p { margin: 0; }
.todo-working-banner .muted { color: inherit; opacity: 0.8; }
.todo-working-banner.is-stuck { background: var(--critical-bg); border-color: color-mix(in srgb, var(--critical) 40%, transparent); color: var(--critical-ink); }
.todo-working-dot { position: relative; flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--info); }
.todo-working-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: todo-ping 1.6s ease-out infinite; }
.is-stuck .todo-working-dot { background: var(--critical); }
.is-stuck .todo-working-dot::after { animation: none; }
@keyframes todo-ping { to { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .todo-working-dot::after { animation: none; } }
/* BMTS's workers (lib/hub.mjs agentsStrip): one pill each, green dot when online. */
.todo-agents { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 0.8rem; }
.todo-agents-label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.todo-agent { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--grid); color: var(--text-2); }
.todo-agent-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.todo-agent.is-off { opacity: 0.65; }
.todo-agent.is-off .todo-agent-dot { background: var(--muted); }
/* To-dos: every worker, online or offline, at the top of the page (lib/hub.mjs workersBar).
   Green edge when all are online, amber when some are off, red when none is on. */
.wbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--border); border-left: 4px solid var(--good); border-radius: 12px; background: var(--surface); }
/* The sync log at the card's foot: its own line under the workers. */
.wbar-log { flex: 1 1 100%; padding-top: 8px; border-top: 1px solid var(--border); }
.wbar-log .todo-log { margin: 0; }
.wbar-part { border-left-color: var(--warning); }
.wbar-down { border-left-color: var(--critical); }
.wbar-head { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.wbar-n { padding: 2px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.wbar-n.is-on { background: var(--good-bg); color: var(--good-ink); }
.wbar-n.is-off { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--text-2); }
.wbar-down .wbar-n.is-off { background: var(--critical-bg); color: var(--critical-ink); }
.wbar-list { display: flex; flex-wrap: wrap; gap: 6px; }
.wbar-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--grid); font-size: 0.82rem; color: var(--text-2); }
.wbar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.wbar-pill.is-off { color: var(--muted); }
.wbar-pill.is-off .wbar-dot { background: var(--critical); }
/* The sync lines over the list, folded behind one line (lib/hub.mjs syncLog). */
.todo-log { margin: 0 0 10px; }
.todo-log > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.85rem; color: var(--text-2); list-style: none; }
.todo-log > summary::-webkit-details-marker { display: none; }
.todo-log > summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
.todo-log[open] > summary::before { transform: rotate(90deg); }
.todo-log > summary:hover { color: var(--text); }
.todo-log-body { margin: 8px 0 0; padding: 10px 12px 2px; border-left: 2px solid var(--grid); }
.todo-working { color: var(--accent); }
.todo-site { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 0.85rem; color: var(--text-2); }
.todo-site a { color: inherit; }
.todo-details { white-space: pre-wrap; margin: 4px 0 0; font-size: 0.88rem; color: var(--text-2); }
/* A long description: its first sentences, and See more for the rest (lib/hub.mjs shortDetails). */
.todo-more > summary { display: block; list-style: none; cursor: pointer; }
.todo-more > summary::-webkit-details-marker { display: none; }
.todo-more .todo-more-full, .todo-more[open] .todo-more-short { display: none; }
.todo-more[open] .todo-more-full { display: inline; }
.todo-more-link { color: var(--brand); font-weight: 600; white-space: nowrap; }
.todo-more-link::after { content: "See more"; }
.todo-more[open] .todo-more-link::after { content: "See less"; }
.todo-more > summary:hover .todo-more-link { text-decoration: underline; }
.todo-more > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* The Filter button and its popover: search, status, app, related to, approval. */
.todo-filter-pop { position: relative; display: flex; }
.todo-filter-btn {
  display: flex; box-sizing: border-box; margin: 0; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-2); font-size: 0.85rem; font-weight: 600; cursor: pointer; list-style: none; user-select: none;
}
.todo-filter-btn::-webkit-details-marker { display: none; }
.todo-filter-btn:hover, .todo-filter-pop[open] > .todo-filter-btn { border-color: var(--brand); color: var(--text); }
.todo-filter-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.todo-filter-btn .count { min-width: 20px; padding: 0 6px; font-size: 0.72rem; font-weight: 700; line-height: 18px; background: var(--brand); color: #fff; }
.todo-pop {
  position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; width: min(520px, calc(100vw - 32px)); max-height: min(75vh, 640px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px; padding: 18px; border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.45);
}
.todo-pop .todo-search { flex: none; max-width: none; width: 100%; box-sizing: border-box; }
.todo-pop-sec { display: flex; flex-direction: column; gap: 6px; }
.todo-pop-h { margin: 0; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
/* Apps, servers and websites: two equal columns of buttons, the count on the right. */
.todo-pop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.todo-pop-grid button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px;
  background: none; color: var(--text-2); font: inherit; font-size: 0.85rem; font-weight: 600; text-align: left; cursor: pointer;
}
.todo-pop-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-pop-grid button:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.todo-pop-grid button[aria-pressed="true"] { background: var(--surface); border-color: var(--border-strong); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.todo-pop-grid button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.todo-pop-grid .count { flex: none; min-width: 20px; padding: 0 6px; font-size: 0.72rem; font-weight: 700; line-height: 18px; }
.todo-pop-foot { display: flex; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  /* On a phone the popover spans the filter bar instead of hanging off the button. */
  .todo-filters { position: relative; }
  .todo-filter-pop { position: static; }
  .todo-pop { left: 0; right: 0; width: auto; top: calc(100% + 6px); }
}
.todo-badges .tag-category { background: transparent; color: var(--text-2); font-weight: 500; }
.todo-tag-warn { background: var(--critical-bg); border-color: transparent; color: var(--critical-ink); }
.todo-tag-progress, .tag.prio-medium { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 45%, transparent); color: var(--info-ink); }
.todo-tag-hold { background: var(--warning-bg); border-color: transparent; color: var(--warning-ink); }
.todo-tag-up { background: var(--good-bg); border-color: transparent; color: var(--good-ink); }
.todo-tag-dismissed { color: var(--muted); }
.todo-tag-merging { background: color-mix(in srgb, #14b8a6 16%, transparent); border-color: color-mix(in srgb, #14b8a6 45%, transparent); color: color-mix(in srgb, #14b8a6 70%, var(--text)); }
.todo-tag-deploying { background: color-mix(in srgb, #6366f1 16%, transparent); border-color: color-mix(in srgb, #6366f1 45%, transparent); color: color-mix(in srgb, #6366f1 70%, var(--text)); }
.todo-tag-review { background: color-mix(in srgb, #6366f1 16%, transparent); border-color: color-mix(in srgb, #6366f1 45%, transparent); color: color-mix(in srgb, #6366f1 70%, var(--text)); }
.tag.prio-high { background: var(--critical-bg); border-color: transparent; color: var(--critical-ink); }
.tag.prio-low { color: var(--muted); }

/* The controls on the right of a row: two menus, then one bordered icon group. */
.todo-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; max-width: 500px; }
.todo-actions form { margin: 0; }
.icon-group { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.icon-form { display: inline-flex; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 30px; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--muted); font-size: 16px; cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.icon-btn-sm { width: 26px; height: 24px; font-size: 14px; }
.ib-good { color: var(--good-ink); }
.ib-accent { color: var(--accent); }
.ib-warn { color: var(--critical-ink); }
.ib-hold { color: var(--warning-ink); }
.ib-danger:hover { color: var(--critical-ink); }
form[aria-busy="true"] { opacity: 0.5; pointer-events: none; }

/* Edit form under the title. */
.todo-edit { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.todo-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.todo-edit-row { display: flex; flex-wrap: wrap; gap: 8px; }
.todo-edit-row label { flex: 1 1 140px; }
.todo-edit input, .todo-edit select, .todo-notes textarea {
  font: inherit; font-size: 0.9rem; font-weight: 400; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.todo-edit input:focus, .todo-edit select:focus, .todo-notes textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.todo-edit-buttons { display: flex; gap: 8px; }

/* A to-do's summary over its notes: what's needed, then the specifics when opened. */
.todo-summary { margin: 6px 0 0; }
.todo-summary summary {
  display: block; width: fit-content; max-width: 100%; padding: 3px 8px; margin-left: -8px;
  border-radius: 6px; font-size: 0.85rem; line-height: 1.4; color: var(--text); cursor: pointer; list-style: none;
}
.todo-summary summary::-webkit-details-marker { display: none; }
.todo-summary summary .icon { vertical-align: -0.15em; margin-right: 6px; color: var(--brand); }
.todo-summary summary:hover { background: var(--surface-2); }
.summary-label { font-weight: 600; color: var(--text-2); }
.summary-label::after { content: ": "; }
.summary-needed { font-weight: 500; }
.todo-summary.is-stale .summary-needed { color: var(--text-2); }
.summary-stale { margin-left: 6px; font-size: 0.78rem; font-style: italic; }
.summary-points { margin: 4px 0 0; padding: 8px 10px 8px 28px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); font-size: 0.88rem; color: var(--text); }
.summary-points li + li { margin-top: 3px; }

/* Notes: a closed thread shows its newest note in the summary. */
.todo-notes { margin: 6px 0 0; }
.todo-notes summary {
  display: flex; align-items: baseline; gap: 6px; width: fit-content; max-width: 100%; padding: 3px 8px; margin-left: -8px;
  border-radius: 6px; font-size: 0.82rem; font-weight: 600; color: var(--text-2); cursor: pointer; list-style: none;
}
.todo-notes summary::-webkit-details-marker { display: none; }
.todo-notes summary .icon { align-self: center; }
.todo-notes summary:hover { background: var(--surface-2); color: var(--text); }
.notes-label { flex: none; }
.note-latest { min-width: 0; font-weight: 400; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-latest::before { content: "· "; color: var(--muted); }
.note-latest strong { font-weight: 600; }
.todo-notes[open] .note-latest { display: none; }
.notes { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.note { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.note-head { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-2); }
.note-head .muted { font-size: 0.78rem; }
.note-tools { display: inline-flex; margin-left: auto; }
.note-body { margin: 4px 0 0; font-size: 0.9rem; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.note-add { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
/* Notes (lib/notes.mjs): a banner like every tab's (what's new and whose notes you see, one line;
   Leave a note opens the composer), then the board. */
.oc-owners { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.oc-owner { display: inline-flex; align-items: center; gap: 5px; }
.oc-owner .cmark-sm { --size: 20px; font-size: 0.6rem; }
.oc-owner strong { color: var(--text); font-weight: 600; }
.oc-waiting-new { color: var(--accent); font-weight: 600; }
.oc-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.oc-page .panel h2 { margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.oc-compose { display: flex; flex-direction: column; gap: 12px; }
.oc-compose-box { display: flex; align-items: flex-start; gap: 12px; }
.oc-compose textarea {
  flex: 1; width: 100%; min-height: 96px; font: inherit; font-size: 0.95rem; line-height: 1.5; padding: 12px 14px; resize: vertical;
  border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
.oc-compose textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.oc-new .oc-compose-foot { padding-left: 52px; }
.oc-compose-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.oc-compose-go { margin-left: auto; display: inline-flex; gap: 8px; }
.oc-for { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.oc-for legend { float: left; margin-right: 4px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.oc-pick, .oc-important {
  position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer;
  font-size: 0.88rem; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); transition: border-color 0.15s, background 0.15s;
}
.oc-pick input, .oc-important input { position: absolute; opacity: 0; pointer-events: none; }
.oc-pick .cmark-sm { --size: 24px; }
.oc-all { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); }
/* The filter chips above the board (All, Everyone, Owners...), each with its group's sign. */
.oc-filter { margin: 0; }
.oc-filter .chip { display: inline-flex; align-items: center; gap: 6px; }
.oc-filter .oc-all { width: 18px; height: 18px; font-size: 0.62rem; }
.oc-pick:hover, .oc-important:hover { border-color: var(--border-strong); }
.oc-pick:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 16%, var(--surface)); color: var(--text); font-weight: 600; }
.oc-pick:has(input:focus-visible), .oc-important:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.oc-important { padding: 6px 12px; }
.oc-important span { color: var(--muted); }
.oc-important:has(input:checked) { border-color: var(--warning); background: var(--warning-bg); color: var(--warning-ink); font-weight: 600; }
.oc-important:has(input:checked) span { color: var(--warning-ink); }
.oc-summary h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.oc-wave { display: inline-block; transform-origin: 70% 70%; animation: oc-wave 2.4s ease-in-out 0.4s 1; }
@keyframes oc-wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-8deg); } }
/* The paper colors: the same pastels in light and dark, with dark ink, like the real thing. */
.oc-paper-sunny { --paper: #fff3a8; --paper-edge: #f2dc5d; }
.oc-paper-peach { --paper: #ffd9c2; --paper-edge: #f5b08a; }
.oc-paper-mint { --paper: #c9f2d9; --paper-edge: #8fdcae; }
.oc-paper-sky { --paper: #cfe6ff; --paper-edge: #92c3f5; }
.oc-paper-lilac { --paper: #e6d7ff; --paper-edge: #c3a6f5; }
/* The dark papers, with light ink. */
.oc-paper-navy { --paper: #1d2c52; --paper-edge: #3d5a9a; }
.oc-paper-forest { --paper: #1c3d30; --paper-edge: #3c7a5e; }
.oc-paper-plum { --paper: #3a2050; --paper-edge: #7a4aa0; }
.oc-paper-wine { --paper: #4a1d2a; --paper-edge: #93445a; }
.oc-paper-charcoal { --paper: #26282e; --paper-edge: #5b5f6a; }
/* The ink and washes a note is drawn with: dark on the light papers (the default), light on the dark ones. */
.oc-notes { --ink: 42, 36, 20; --wash: rgba(255, 255, 255, 0.42); --bubble: rgba(255, 255, 255, 0.7); --field: rgba(255, 255, 255, 0.85); --paper-hi: #fff; --seen-ink: #1f7a4d; --danger-ink: #a51d22; }
:is(.oc-paper-navy, .oc-paper-forest, .oc-paper-plum, .oc-paper-wine, .oc-paper-charcoal).oc-note {
  --ink: 244, 240, 230; --wash: rgba(0, 0, 0, 0.22); --bubble: rgba(255, 255, 255, 0.09); --field: rgba(0, 0, 0, 0.28); --paper-hi: var(--paper-edge); --seen-ink: #86e3ae; --danger-ink: #ff9a9a;
  outline: 1px solid rgba(255, 255, 255, 0.08); outline-offset: -1px;
}
.oc-colors .oc-swatch:nth-child(7) { margin-left: 6px; }
.oc-colors { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; border: 0; }
.oc-colors legend { float: left; margin-right: 4px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.oc-swatch { position: relative; width: 24px; height: 24px; border-radius: 6px; cursor: pointer; background: color-mix(in srgb, var(--paper) var(--see, 100%), transparent); border: 2px solid var(--paper-edge); transform: rotate(-4deg); transition: transform 0.15s; }
.oc-swatch:nth-child(odd) { transform: rotate(4deg); }
.oc-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.oc-see { display: inline-flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.oc-see input { width: 120px; accent-color: var(--brand); }
.oc-see output { min-width: 3ch; font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; color: var(--text-2); }
.oc-swatch:hover { transform: rotate(0) scale(1.1); }
.oc-swatch:has(input:checked) { transform: rotate(0) scale(1.15); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand); }
.oc-swatch:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; }
/* The board: sticky notes pinned up, standing straight; they lift a little on hover. */
.oc-board h2 { margin: 6px 0 16px; display: flex; align-items: center; gap: 8px; }
.oc-notes { list-style: none; margin: 0; padding: 8px 4px 4px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 500px), 1fr)); gap: 44px 36px; align-items: start; }
.oc-note {
  position: relative; display: flex; flex-direction: column; gap: 16px; padding: 40px 34px 24px; min-height: 360px; color: rgb(var(--ink));
  /* --see: how solid the paper is (100% unless the note is see-through, lib/notes.mjs Transparency). */
  background: linear-gradient(180deg, color-mix(in srgb, color-mix(in srgb, var(--paper) 80%, var(--paper-hi)) var(--see, 100%), transparent) 0%, color-mix(in srgb, var(--paper) var(--see, 100%), transparent) 30%); border-radius: 3px 3px 14px 3px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 14px 26px -16px rgba(0, 0, 0, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.oc-note::after { content: ""; position: absolute; right: 0; bottom: 0; width: 32px; height: 32px; border-radius: 0 0 14px 0; background: linear-gradient(135deg, var(--paper-edge) 50%, transparent 50%); opacity: 0.7; }
.oc-note:hover, .oc-note:focus-within { transform: translateY(-3px); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 22px 34px -18px rgba(0, 0, 0, 0.6); z-index: 1; }
.oc-pin { position: absolute; top: -11px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c9a6ff, var(--brand) 55%, var(--brand-deep)); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.35); }
.oc-note-important .oc-pin { background: radial-gradient(circle at 35% 35%, #ff9a9a, #e5484d 55%, #a51d22); }
.oc-note-new { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 70%, transparent), 0 14px 26px -16px rgba(0, 0, 0, 0.55); }
.oc-note-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.oc-note-to { margin: 0 auto 0 0; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(var(--ink), 0.65); }
.oc-note-to strong { color: rgb(var(--ink)); }
.oc-flag { padding: 3px 11px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.03em; }
.oc-flag-new { background: var(--brand); color: #fff; }
.oc-flag-important { background: #e5484d; color: #fff; }
.oc-note-body { flex: 1; margin: 0; font-size: 1.45rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.oc-note-sign { display: flex; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px dashed rgba(var(--ink), 0.22); font-size: 1rem; color: rgba(var(--ink), 0.75); }
.oc-note-sign strong { color: rgb(var(--ink)); }
.oc-note-sign .cmark-sm { --size: 32px; }
.oc-seen { margin: -4px 0 0; font-size: 0.92rem; color: rgba(var(--ink), 0.6); }
.oc-seen-yes { color: var(--seen-ink); font-weight: 600; }
/* Edit and delete: two small icons in the top right corner of your own notes and replies. */
.oc-corner { position: absolute; top: 10px; right: 10px; display: flex; gap: 2px; opacity: 0.55; transition: opacity 0.15s; }
.oc-note:hover > .oc-corner, .oc-reply-main:hover > .oc-corner, .oc-corner:focus-within { opacity: 1; }
.oc-corner form { margin: 0; }
.oc-icon { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: rgba(var(--ink), 0.75); cursor: pointer; }
.oc-icon:hover { background: rgba(var(--ink), 0.1); color: rgb(var(--ink)); }
.oc-icon-danger:hover { background: rgba(229, 72, 77, 0.16); color: var(--danger-ink); }
.oc-icon:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.oc-note-mine .oc-note-top { padding-right: 52px; }
.oc-tool { padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; color: rgba(var(--ink), 0.7); font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer; }
.oc-tool:hover { background: rgba(var(--ink), 0.08); color: rgb(var(--ink)); }
.oc-tool-danger:hover { background: rgba(229, 72, 77, 0.14); color: var(--danger-ink); }
.oc-tool:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.oc-edit { padding: 12px; margin: 0 -6px -2px; border-radius: 10px; background: var(--surface); color: var(--text); }
.oc-edit .oc-compose-foot { gap: 8px 12px; }
/* Replies: a little thread at the foot of the note, then a box to add one. */
.oc-replies { margin: 2px -10px -8px; border-radius: 12px; }
.oc-replies[open] { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 12px; background: var(--wash); }
.oc-replies > summary { display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 6px 12px; margin: 0 0 0 10px; border-radius: 999px; cursor: pointer; list-style: none; font-size: 0.92rem; font-weight: 700; color: rgba(var(--ink), 0.75); background: var(--wash); }
.oc-replies > summary::-webkit-details-marker { display: none; }
.oc-replies > summary:hover { background: var(--bubble); color: rgb(var(--ink)); }
.oc-replies > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.oc-replies[open] > summary { margin: 10px 0 0 -4px; background: transparent; padding-left: 4px; }
.oc-replies > summary .oc-flag { font-size: 0.72rem; padding: 1px 8px; }
.oc-replies ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.oc-reply { display: flex; align-items: flex-start; gap: 10px; }
.oc-reply .cmark-sm { --size: 28px; flex: none; }
.oc-reply-main { position: relative; flex: 1; min-width: 0; padding: 8px 12px; border-radius: 4px 12px 12px 12px; background: var(--bubble); }
.oc-reply-new .oc-reply-main { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 60%, transparent); }
.oc-reply-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; padding-right: 52px; font-size: 0.88rem; color: rgba(var(--ink), 0.7); }
.oc-reply-head strong { color: rgb(var(--ink)); }
.oc-reply-head .oc-flag { font-size: 0.72rem; padding: 1px 8px; }
.oc-reply-body { margin: 3px 0 0; font-size: 1.05rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.oc-reply-edit { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.oc-reply-edit span { display: flex; justify-content: flex-end; gap: 6px; }
.oc-reply-edit textarea { width: 100%; padding: 8px 10px; font: inherit; font-size: 1rem; color: rgb(var(--ink)); border: 1px solid rgba(var(--ink), 0.25); border-radius: 8px; background: var(--field); resize: vertical; }
.oc-reply-main:has(.oc-reply-edit:not([hidden])) .oc-reply-body { display: none; }
.oc-reply-main > .oc-corner { top: 4px; right: 4px; }
.oc-reply-add { display: flex; align-items: flex-end; gap: 8px; margin: 0; }
.oc-reply-add textarea {
  flex: 1; min-width: 0; min-height: 40px; padding: 9px 12px; resize: vertical; font: inherit; font-size: 1rem; line-height: 1.4; color: rgb(var(--ink));
  border: 1px solid rgba(var(--ink), 0.2); border-radius: 10px; background: var(--field);
}
.oc-reply-add textarea::placeholder { color: rgba(var(--ink), 0.5); }
.oc-reply-add textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.oc-reply-send { flex: none; height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: rgb(var(--ink)); color: var(--paper); font: inherit; font-weight: 700; cursor: pointer; }
.oc-reply-send:hover { background: var(--brand-deep); color: #fff; }
.oc-reply-send:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* The layout switch: Grid is the board above; One per row is the same sticky notes full width;
   Compact is one colored line per note (to, the note, who and when, replies), opening in place. */
body[data-layout="rows"] .oc-notes { grid-template-columns: 1fr; gap: 28px; }
body[data-layout="rows"] .oc-note { min-height: 0; }
body[data-layout="compact"] .oc-notes { grid-template-columns: 1fr; gap: 8px; padding-top: 0; }
body[data-layout="compact"] .oc-note {
  display: grid; grid-template-columns: minmax(130px, 190px) minmax(0, 1fr) auto auto; align-items: center; gap: 6px 18px;
  min-height: 0; padding: 10px 18px; border-radius: 8px; border-left: 6px solid var(--paper-edge);
}
body[data-layout="compact"] .oc-note-mine { padding-right: 76px; }
body[data-layout="compact"] :is(.oc-pin, .oc-seen) { display: none; }
body[data-layout="compact"] .oc-note::after { display: none; }
body[data-layout="compact"] .oc-note-top { padding-right: 0; flex-wrap: nowrap; min-width: 0; }
body[data-layout="compact"] .oc-note-to { font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-layout="compact"] .oc-note-top .oc-flag { font-size: 0.7rem; padding: 1px 7px; }
body[data-layout="compact"] .oc-note-body { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-layout="compact"] .oc-note-sign { padding: 0; border: 0; font-size: 0.85rem; white-space: nowrap; }
body[data-layout="compact"] .oc-note-sign .cmark-sm { --size: 24px; }
body[data-layout="compact"] .oc-corner { top: 50%; transform: translateY(-50%); }
body[data-layout="compact"] .oc-note:has(.oc-replies[open], .oc-edit:not([hidden])) .oc-corner { top: 10px; transform: none; }
body[data-layout="compact"] .oc-replies { margin: 0; }
body[data-layout="compact"] .oc-replies > summary { margin: 0; padding: 4px 10px; font-size: 0.85rem; }
body[data-layout="compact"] .oc-replies[open] { grid-column: 1 / -1; margin: 4px -8px 0; }
body[data-layout="compact"] .oc-replies[open] > summary { margin: 8px 0 0 -4px; }
body[data-layout="compact"] .oc-edit { grid-column: 1 / -1; }
/* An open note in Compact shows its whole text. */
body[data-layout="compact"] .oc-note:has(.oc-replies[open]) .oc-note-body { white-space: pre-wrap; }
@media (max-width: 760px) {
  body[data-layout="compact"] .oc-note { grid-template-columns: minmax(0, 1fr) auto; }
  body[data-layout="compact"] .oc-note-body { grid-column: 1 / -1; grid-row: 2; }
}
.oc-empty { display: grid; justify-items: center; gap: 4px; padding: 36px 16px; border: 2px dashed var(--border-strong); border-radius: 14px; text-align: center; }
.oc-empty > span { font-size: 2rem; }
.oc-empty p { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .oc-wave { animation: none; }
  .oc-note, .oc-swatch { transition: none; }
}
@media (max-width: 640px) {
  .oc-new .oc-compose-foot { padding-left: 0; }
  .oc-compose-box > .cmark { display: none; }
  .oc-compose-go { margin-left: 0; width: 100%; }
  .oc-compose-go .button { flex: 1; }
}
.todo-notes textarea { flex: 1; min-width: 0; resize: vertical; }

.todo-add-open { display: inline-flex; align-items: center; gap: 6px; height: 34px; }
/* "Add a to-do": an even four-column grid (two on tablets, one on phones). */
.todo-add { margin: 14px 0 4px; padding: 16px 18px; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 12px; background: var(--surface-2); }
.todo-add-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.todo-add-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1rem; }
.todo-add-head h3 .icon { color: var(--brand); }
.todo-add-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.todo-add-grid label { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 0.78rem; font-weight: 600; color: var(--text-2); }
.todo-add-grid .span-2 { grid-column: span 2; }
.todo-add-grid .span-all { grid-column: 1 / -1; }
.todo-add-grid :is(input, select, textarea) {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 0.9rem; font-weight: 400; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.todo-add-grid :is(input, select) { height: 38px; }
.todo-add-grid textarea { resize: vertical; min-height: 64px; }
.todo-add-grid :is(input, select, textarea):focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.todo-add-grid select option, .todo-add-grid select optgroup { background: var(--surface); color: var(--text); }
.field-opt { font-weight: 400; color: var(--muted); margin-left: 4px; }
/* "What's it for?" first; the rest shows once it's picked (data-step, app.js). */
.todo-add-for label { display: flex; flex-direction: column; gap: 6px; font-size: 0.95rem; font-weight: 600; color: var(--text); }
.todo-add-for select {
  width: 100%; max-width: 520px; height: 42px; box-sizing: border-box; font: inherit; font-size: 0.95rem; font-weight: 400; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.todo-add-for select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.todo-add-for select option, .todo-add-for select optgroup { background: var(--surface); color: var(--text); }
.todo-ties { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; font-size: 0.85rem; }
.todo-ties [data-ties] { display: contents; }
.todo-tie .muted { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; margin-right: 2px; }
.todo-add-links > summary { display: none; }
.todo-add-links[open] { margin-top: 12px; padding: 12px; border: 1px dashed var(--border); border-radius: 10px; }
.todo-add-rest { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.todo-add-more { margin-top: 12px; }
/* The quick row under Details: small gray priority chips, then person / AI and which one (app.js). */
.todo-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 12px; }
.todo-quick-prio, .todo-quick-who { display: flex; align-items: center; gap: 6px; }
.todo-chip {
  height: 26px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: none;
  font: inherit; font-size: 0.78rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.todo-chip:hover { color: var(--text-2); border-color: var(--text-2); }
.todo-chip.prio-low[aria-pressed="true"] { background: var(--surface-2); border-color: var(--text-2); color: var(--text); }
.todo-chip.prio-medium[aria-pressed="true"] { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 45%, transparent); color: var(--info-ink); }
.todo-chip.prio-high[aria-pressed="true"] { background: var(--critical-bg); border-color: color-mix(in srgb, var(--critical-ink) 45%, transparent); color: var(--critical-ink); }
.todo-who-btn { border: 1px solid var(--border); border-radius: 999px; width: 30px; height: 26px; }
.todo-who-btn[aria-pressed="true"] { color: var(--brand); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.todo-quick-who select {
  height: 28px; max-width: 220px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.82rem;
}
.todo-quick-who select option { background: var(--bg-2); color: var(--text); }
/* A field whose label has a link beside it (Category's "Edit categories", Kind of work's
   "Read more"): the same spacing as a plain label over its field. */
.todo-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.todo-field-head { display: flex; align-items: baseline; gap: 10px; font-size: 0.78rem; }
.todo-field-head > * { font-size: inherit; line-height: inherit; }
.todo-field-head label { margin: 0; font-weight: 600; color: var(--text-2); }
.todo-kind-help { margin-top: 4px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.82rem; line-height: 1.45; color: var(--text-2); }
.todo-kind-help p { margin: 0 0 8px; }
.todo-kind-help p:last-child { margin-bottom: 0; }
.todo-kind-help strong { color: var(--text); }
.todo-add-more > summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.todo-add[data-step="for"] :is(.todo-add-rest, .todo-add-foot button:not([type="button"])) { display: none; }
.todo-add-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 820px) {
  .todo-add-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .todo-add-grid .span-2 { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .todo-add { padding: 14px; }
  .todo-add-grid { grid-template-columns: minmax(0, 1fr); }
  .todo-add-foot .button { flex: 1; }
}

/* Compact (the Layout bar): one line per to-do. The title takes the room; the
   owner and repeat menus, the category, approval and repeat badges and the
   dates step aside; notes shrink to their count and open onto their own line. */
body[data-layout="compact"] .todo { grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 4px; }
body[data-layout="compact"] .todo-in_progress { padding: 6px 12px; }
body[data-layout="compact"] .todo-in_progress + .todo-in_progress { margin-top: 4px; }
body[data-layout="compact"] .todo-status { font-size: 17px; }
body[data-layout="compact"] .todo-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
body[data-layout="compact"] .todo-badges { flex: none; flex-wrap: nowrap; }
body[data-layout="compact"] .todo-badges :is(.tag-category, .tag-approved, .tag-repeat, .todo-tag-progress, .tag-form) { display: none; }
body[data-layout="compact"] .todo-title { flex: 1 1 200px; min-width: 0; margin: 0; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-layout="compact"] .todo-when,
body[data-layout="compact"] .todo-actions .ctl-form,
body[data-layout="compact"] .note-latest { display: none; }
body[data-layout="compact"] .todo-notes { flex: none; margin: 0; order: 1; }
body[data-layout="compact"] .todo-notes[open], body[data-layout="compact"] .todo-edit { flex-basis: 100%; order: 2; }
body[data-layout="compact"] .todo-notes summary { margin-left: 0; font-weight: 500; color: var(--muted); }
body[data-layout="compact"] .todo-notes-empty:not([open]) { display: none; }
/* The summary shrinks to its label, and opens onto its own line like the notes. */
body[data-layout="compact"] .todo-summary { flex: none; margin: 0; order: 1; }
body[data-layout="compact"] .todo-summary[open] { flex-basis: 100%; order: 2; }
body[data-layout="compact"] .todo-summary summary { margin-left: 0; }
body[data-layout="compact"] .todo-summary:not([open]) :is(.summary-needed, .summary-stale) { display: none; }
body[data-layout="compact"] .todo-summary:not([open]) .summary-label::after { content: none; }


@media (max-width: 760px) {
  .todo { grid-template-columns: 22px minmax(0, 1fr); }
  .todo-actions { grid-column: 2; justify-content: flex-start; max-width: none; }
  .todo-search { flex: 1; }
  .todo-search input { width: 100%; }
  /* The filter rows wrap onto more lines instead of running off the edge. */
  .todo-strip { flex: 1 1 100%; flex-wrap: wrap; overflow: visible; }
  /* Full and Grid: more room between to-dos, so each reads on its own. */
  .todo { padding: 26px 4px; border-top-color: var(--border-strong); }
  .todo-in_progress { padding: 18px 12px; }
  .todo-in_progress + .todo-in_progress { margin-top: 12px; }
  body[data-layout="grid"] .todo-list > .todo { padding: 16px; }
  /* Compact: one line each, the number and title, its badges small beneath. Tap one and
     its buttons and notes fold open under it (app.js bindTodoFold); tap again to shut. */
  body[data-layout="compact"] .todo { grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 10px; padding: 12px 4px; cursor: pointer; }
  body[data-layout="compact"] .todo-in_progress { padding: 12px; }
  body[data-layout="compact"] .todo-status { margin-top: 1px; }
  body[data-layout="compact"] .todo-main { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 6px; }
  body[data-layout="compact"] .todo-title { order: -1; flex: none; }
  body[data-layout="compact"] .todo-badges { flex-wrap: wrap; gap: 4px; }
  body[data-layout="compact"] .todo-badges .tag { font-size: 0.7rem; padding: 1px 7px; }
  body[data-layout="compact"] .todo-badges :is(.tag-category, .tag-approved, .tag-repeat, .todo-tag-progress) { display: inline-flex; }
  body[data-layout="compact"] .todo.is-open .todo-badges .tag-form { display: inline-flex; }
  body[data-layout="compact"] .todo:not(.is-open) :is(.todo-site, .todo-summary, .todo-notes, .todo-actions) { display: none; }
  body[data-layout="compact"] .todo.is-open .todo-title { white-space: normal; }
  body[data-layout="compact"] .todo.is-open :is(.todo-summary, .todo-notes) { flex-basis: auto; }
  /* Folded open on a phone there's room for the summary's line. */
  body[data-layout="compact"] .todo-summary:not([open]) :is(.summary-needed, .summary-stale) { display: inline; }
  body[data-layout="compact"] .todo-summary:not([open]) .summary-label::after { content: ": "; }
  body[data-layout="compact"] .todo-actions { grid-column: 2; justify-content: flex-start; animation: todo-fold 0.25s ease; }
  body[data-layout="compact"] .todo.is-open .todo-main > :is(.todo-site, .todo-summary, .todo-notes) { animation: todo-fold 0.25s ease; }
}
@keyframes todo-fold { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  body[data-layout="compact"] :is(.todo-actions, .todo-site, .todo-summary, .todo-notes) { animation: none !important; }
}

/* To-dos as a grid of cards (Layout: Grid, with Per row): the controls drop under the text. */
body[data-layout="grid"] .todo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 24px; margin-top: 14px; }
body[data-layout="grid"] .todo {
  grid-template-columns: 22px minmax(0, 1fr); grid-template-rows: 1fr auto; margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
}
body[data-layout="grid"] .todo-in_progress { border-color: var(--info); background: var(--info-bg); box-shadow: none; }
body[data-layout="grid"] .todo-in_progress + .todo-in_progress { margin-top: 0; }
body[data-layout="grid"] .todo-actions { grid-column: 1 / -1; align-self: end; justify-content: flex-start; max-width: none; padding-top: 10px; border-top: 1px solid var(--border); }

/* Communications: folders on the left, the list or one conversation on the right. */
.comms { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.comm-side { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px; position: sticky; top: 76px; }
.folders { list-style: none; margin: 0; padding: 0; }
.folder {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text-2); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
}
.folder .count { margin-left: auto; }
.folder:hover { background: var(--surface-2); color: var(--text); }
.folder[aria-pressed="true"] { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--text); font-weight: 650; }
.folder-sub { padding-left: 28px; font-size: 0.85rem; }
.side-heading { margin: 12px 10px 4px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
/* On a phone the side folds into a menu above the mail: a button with what's open; tap it and
   the inboxes and folders slide open one per row, pick one and they slide shut (app.js bindSideMenu). */
.side-fold, .side-list { display: contents; }
.side-toggle { display: none; }
@media (max-width: 800px) {
  .comm-side { padding: 0; }
  .side-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px;
    background: none; border: 0; border-radius: 12px; color: var(--text); font: inherit; font-weight: 600; font-size: 0.95rem; text-align: left; cursor: pointer;
  }
  .side-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  .side-toggle-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
  .side-toggle[aria-expanded="true"] + .side-fold { grid-template-rows: 1fr; }
  .side-list {
    display: block; min-height: 0; overflow: hidden; padding: 0 8px;
    /* Hidden once shut, so its links aren't tabbed to. */
    opacity: 0; visibility: hidden; transition: opacity 0.2s ease, padding 0.3s ease, visibility 0s 0.3s;
  }
  .side-toggle[aria-expanded="true"] + .side-fold > .side-list { opacity: 1; visibility: visible; padding: 0 8px 8px; transition: opacity 0.2s ease, padding 0.3s ease; }
  .comm-side .folder { padding: 10px 12px; font-size: 0.95rem; }
}
@media (max-width: 800px) and (prefers-reduced-motion: reduce) {
  .side-fold, .side-list { transition: none; }
}
.app-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--series); }
.comm-main { min-width: 0; }
.comm-search {
  width: 100%; font: inherit; padding: 9px 12px; margin-bottom: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.comm-search:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.comm-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.comm-list li + li { border-top: 1px solid var(--border); }
.comm-row {
  width: 100%; display: grid; grid-template-columns: 8px 16px minmax(120px, 190px) auto 1fr auto 52px; gap: 10px; align-items: center;
  padding: 10px 14px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: 0.88rem; text-align: left; cursor: pointer;
}
.comm-row:hover { background: var(--surface-2); }
.comm-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.comm-row.unread .dot { background: var(--brand); box-shadow: 0 0 8px color-mix(in srgb, var(--brand) 80%, transparent); }
.comm-row.unread .comm-name { color: var(--text); font-weight: 700; }
.comm-row:not(.unread) strong { font-weight: 500; }
.comm-row .dir { color: var(--muted); }
.comm-name, .comm-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comm-subject strong { color: var(--text); }
.comm-date { text-align: right; }
.comm-empty { padding: 30px; text-align: center; }
.chip-status { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.chip-received { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.chip-delivered { background: var(--good-bg); color: var(--good-ink); }
.chip-failed { background: var(--critical-bg); color: var(--critical-ink); }
.chip-scheduled { background: var(--warning-bg); color: var(--warning-ink); }
.comm-thread { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.thread-head { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.back { color: var(--accent); font-size: 0.88rem; margin-bottom: 10px; }
.thread-who { display: flex; gap: 12px; align-items: center; }
.thread-who h2 { margin: 0 0 2px; font-size: 1.2rem; }
.thread-who p { margin: 0; }
.thread-count { margin-left: auto; white-space: nowrap; }
.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}
.avatar-in { background: linear-gradient(135deg, #10b981, #047857); }
.message-failed .avatar { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.messages { list-style: none; margin: 0; padding: 0; }
.message { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.message-body { min-width: 0; }
.message-body p { margin: 0 0 6px; }
.message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.message-out .message-body > p:last-child { background: color-mix(in srgb, var(--brand) 8%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); border-radius: 10px; padding: 8px 12px; }
.message-in .message-body > p:last-child { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.reply { padding: 14px 18px; background: var(--bg); }
.reply-box {
  width: 100%; text-align: left; font: inherit; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: not-allowed;
}
.reply p { margin: 6px 0 0; }
@media (max-width: 800px) {
  .comms { grid-template-columns: 1fr; }
  .comm-side { position: static; }
  .comm-row { grid-template-columns: 8px 16px 1fr auto 46px; }
  .comm-row .tag-app, .comm-row .chip-status { display: none; }
  .comm-subject { grid-column: 3 / -1; grid-row: 2; white-space: normal; }
}

/* Communications with Gmail connected (lib/mailview.mjs): folders are links, a conversation is its own page. */
a.folder { text-decoration: none; }
.folder[aria-current="page"] { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--text); font-weight: 650; }
.mail-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-search { margin: 0; }
.mail-row {
  display: grid; grid-template-columns: 8px 14px minmax(120px, 200px) 1fr 64px; gap: 10px; align-items: center;
  padding: 10px 14px; color: var(--text-2); font-size: 0.88rem; text-decoration: none;
}
.mail-row:hover { background: var(--surface-2); }
.mail-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.mail-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.mail-row.unread .dot { background: var(--brand); box-shadow: 0 0 8px color-mix(in srgb, var(--brand) 80%, transparent); }
.mail-row.unread .comm-name, .mail-row.unread .comm-subject strong { color: var(--text); font-weight: 700; }
.mail-row:not(.unread) strong { font-weight: 500; }
.mail-star { color: #e3a008; font-size: 0.85rem; }
.mail-draft { color: var(--critical-ink); font-size: 0.8rem; font-weight: 600; }
.mail-pager { display: flex; justify-content: flex-end; gap: 8px; margin: 12px 0 0; }
.mail-subject { margin: 0 0 4px; font-size: 1.35rem; }
.mail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mail-actions form { margin: 0; }
.mail-msgs { list-style: none; margin: 0; padding: 0; }
.mail-msg { border-bottom: 1px solid var(--border); }
.mail-msg > summary { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: start; padding: 12px 18px; cursor: pointer; list-style: none; }
.mail-msg > summary::-webkit-details-marker { display: none; }
.mail-msg > summary:hover { background: var(--surface-2); }
.mail-msg-who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mail-msg-who strong { color: var(--text); }
.mail-msg-to, .mail-msg-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-msg[open] .mail-msg-snippet, .mail-msg:not([open]) .mail-msg-to { display: none; }
.mail-msg-date { white-space: nowrap; }
.mail-msg-body { padding: 0 18px 16px 68px; }
.mail-frame { display: block; width: 100%; height: 320px; border: 0; background: #fff; color-scheme: light; }
/* An email in a conversation: square, edge to edge (more specific than Email reports' framed example, below). */
.mail-msg-body .mail-frame { border: 0; border-radius: 0; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.mail-files { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.mail-files li { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: var(--bg); }
.mail-reply { padding: 16px 18px; background: var(--bg); margin: 0; }
/* The reply, folded as in Gmail: one bar that opens into the form. */
.mail-reply-fold { padding: 14px 18px 18px 68px; }
.mail-reply-fold[open] { padding: 0; }
.mail-reply-bar { display: flex; align-items: center; gap: 10px; list-style: none; cursor: text; padding: 12px 16px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--bg); color: var(--muted); transition: border-color 0.15s, box-shadow 0.15s; }
.mail-reply-bar::-webkit-details-marker { display: none; }
.mail-reply-bar:hover { border-color: var(--brand); box-shadow: 0 1px 6px color-mix(in srgb, var(--brand) 25%, transparent); }
.mail-reply-bar:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.mail-reply-icon { color: var(--text-2); }
.mail-reply-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-reply-all { color: var(--accent); cursor: pointer; }
.mail-reply-fold[open] > .mail-reply-bar { display: none; }
.mail-reply h2 { margin: 0 0 10px; font-size: 1.05rem; }
.mail-reply-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.mail-compose { max-width: 780px; }
.folder[aria-current="true"] { background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--text); font-weight: 650; }
.mail-did { list-style: none; margin: 10px 0 0; padding: 0; color: var(--text-2); }
.mail-activity { margin-top: 16px; }
.mail-activity > summary { cursor: pointer; }
.mail-activity > summary:hover { color: var(--text); }
.mail-activity[open] > summary { margin-bottom: 6px; }
.mail-activity ul { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; color: var(--text-2); }
.mail-activity li { padding: 4px 0; }
.uf-inboxes { margin-top: 16px; }
@media (max-width: 800px) {
  .mail-row { grid-template-columns: 8px 14px 1fr 56px; }
  .mail-row .comm-subject { grid-column: 3 / -1; grid-row: 2; white-space: normal; }
  .mail-msg-body { padding-left: 18px; }
  .mail-msg > summary { grid-template-columns: 38px 1fr; }
  .mail-msg-date { grid-column: 2; }
}

/* Scheduling. */
.sched-list { list-style: none; margin: 0; padding: 0; }
.sched { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 0.9rem; }
.sched:first-child { border-top: 0; }
.sched-time { width: 64px; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.sched-kind { min-width: 104px; color: var(--muted); font-size: 0.82rem; }
.sched-title { flex: 1; min-width: 180px; }
.table-wrap { overflow-x: auto; }
.jobs th { width: auto; }
.jobs thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

/* Scheduling calendar: a month grid, then the picked day's list. */
.cal-panel { margin: 0 0 18px; }
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; }
.cal-head h2 { margin: 0; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-step { padding: 4px 12px; font-size: 0.9rem; }
.cal-step:disabled { opacity: 0.4; cursor: default; }
.cal-label { min-width: 140px; text-align: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.cal-legend li { display: flex; align-items: center; gap: 6px; }
.cal-key { width: 10px; height: 10px; border-radius: 3px; border-left: 3px solid; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--border); gap: 1px; }
.cal-dow { background: var(--surface-2); color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 8px; }
.cal-cell { background: var(--surface); min-height: 248px; padding: 4px 4px 6px; cursor: pointer; min-width: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-blank { background: var(--bg); cursor: default; }
.cal-blank:hover { background: var(--bg); }
.cal-past .cal-date { color: var(--muted); }
.cal-date {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 0; background: none;
  color: var(--text-2); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.cal-date:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal-today .cal-date { background: var(--brand); color: #fff; }
.cal-picked { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-events { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 3px; }
.cal-ev {
  font-size: 0.8rem; line-height: 1.35; padding: 3px 6px; border-radius: 4px; border-left: 3px solid;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2);
}
.cal-ev-mark { color: var(--text-2); margin-right: 3px; }
.cal-ev-mark .icon { vertical-align: -0.12em; }
.cal-ev-who {
  font-weight: 800; font-size: 0.82em; letter-spacing: 0.03em; padding: 0 3px; margin-right: 3px;
  border-radius: 3px; background: color-mix(in srgb, currentColor 16%, transparent); color: var(--text);
}
.cal-ev-time { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.cal-ev-scheduled { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.cal-ev-sent { border-color: var(--good); background: var(--good-bg); }
.cal-ev-failed { border-color: var(--critical); background: var(--critical-bg); }
.cal-ev-repeat { border-color: var(--muted); background: var(--surface-2); }
.cal-ev-mine { border-color: #0ea5e9; background: rgba(14, 165, 233, 0.14); }
.cal-ev-office { border-color: #16a34a; background: rgba(22, 163, 74, 0.14); }
/* A deadline's and a goal's date: hot pink and gold, glowing a little so they stand out. */
.cal-ev-deadline { border-color: #ec4899; background: rgba(236, 72, 153, 0.18); box-shadow: 0 0 10px rgba(236, 72, 153, 0.45); font-weight: 650; }
.cal-ev-goal { border-color: #f59e0b; background: rgba(245, 158, 11, 0.16); box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); font-weight: 650; }
.cal-ev.ev-over { display: none; }
.cal-more {
  font: inherit; font-size: 0.8rem; font-weight: 600; line-height: 1.35; padding: 3px 6px; border: 0; border-radius: 4px;
  background: none; color: var(--accent); cursor: pointer; text-align: left; width: 100%;
}
.cal-more:hover { background: var(--surface-2); }
.cal-add { margin-left: 4px; box-shadow: none; }
.cal-edit { font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.fin-form .form textarea {
  font: inherit; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical;
}
.fin-form .form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.cal-ev { cursor: pointer; }
.cal-ev:hover { filter: brightness(1.1); }
.cal-ev:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* A calendar item's pop-up: big, and the whole screen on a phone. */
.cal-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6); overflow: auto; }
.cal-dialog::backdrop { background: rgba(6, 4, 14, 0.6); backdrop-filter: blur(3px); }
.cal-dialog[open] { animation: ask-in 0.16s ease-out; }
.cal-dlg-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; padding: 12px 14px 8px 28px; background: var(--surface); }
.cal-dlg-back { font-weight: 600; }
.cal-dlg-step { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.cal-dlg-step span { margin-right: 4px; font-variant-numeric: tabular-nums; }
.cal-dlg-step:not([hidden]) + .cal-dlg-close { margin-left: 6px; }
.cal-dlg-bar [hidden], .cal-dialog [hidden] { display: none; }
/* The day's items, one line each. */
.cal-dlg-day { padding: 0 28px 26px; }
.cal-dlg-day .cal-dlg-title { margin-bottom: 2px; }
.cal-dlg-day > p { margin: 0 0 14px; }
.cal-dlg-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.cal-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.cal-row:hover { background: var(--surface-2); }
.cal-row:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal-row-office { border-left-color: #16a34a; }
.cal-row-mine { border-left-color: #0ea5e9; }
.cal-row-sent { border-left-color: var(--good); }
.cal-row-failed { border-left-color: var(--critical); }
.cal-row-repeat { border-left-color: var(--muted); }
.cal-row-time { flex: none; width: 66px; font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-2); }
.cal-row-kind { flex: none; width: 18px; text-align: center; color: var(--text-2); }
.cal-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-row .tag, .cal-row .chip-status { flex: none; }
.cal-row-go { flex: none; color: var(--muted); font-size: 1.2rem; }
.cal-dlg-close { width: 36px; height: 36px; margin-left: auto; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.cal-dlg-close:hover { background: var(--surface-2); color: var(--text); }
.cal-dlg-body { padding: 8px 32px 30px; border-left: 5px solid var(--brand); margin: 14px 0 0; }
.cal-dlg-office { border-color: #16a34a; }
.cal-dlg-mine { border-color: #0ea5e9; }
.cal-dlg-sent { border-color: var(--good); }
.cal-dlg-failed { border-color: var(--critical); }
.cal-dlg-repeat { border-color: var(--muted); }
.cal-dlg-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--text-2); font-weight: 600; }
.cal-dlg-title { margin: 0 0 6px; font-size: 1.7rem; line-height: 1.25; overflow-wrap: anywhere; }
.cal-dlg-when { margin: 0 0 20px; font-size: 1.05rem; color: var(--text-2); }
.cal-dlg-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 24px; margin: 0 0 22px; }
.cal-dlg-facts dt { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.cal-dlg-facts dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.cal-dlg-notes h3 { margin: 0 0 6px; font-size: 0.95rem; }
.cal-dlg-notes p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
div.cal-dlg-notes { padding: 14px 16px; border-radius: 10px; background: var(--surface-2); }
.cal-dlg-actions { display: flex; gap: 18px; margin: 22px 0 0; font-size: 1.05rem; }
.cal-dlg-actions .cal-edit { font-size: inherit; }

/* A blog post's pop-up: whether it's written, and the button to write it here. */
.cal-blog { margin: 0 0 20px; padding: 13px 15px; border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 12px; background: var(--surface-2); }
.cal-blog-state { display: flex; align-items: center; gap: 12px; }
.cal-blog-state > div { flex: 1; min-width: 0; }
.cal-blog-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.cal-blog-dot.is-unwritten { background: var(--warning-ink); }
.cal-blog-dot.is-written { background: var(--good-ink); }
.cal-blog-dot.is-draft { background: var(--brand); }
.cal-blog-dot.is-auto, .cal-blog-dot.is-unknown { background: var(--muted); }
.cal-blog-dot.is-checking { background: var(--muted); animation: cal-blog-pulse 1s ease-in-out infinite alternate; }
@keyframes cal-blog-pulse { from { opacity: 0.35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cal-blog-dot.is-checking { animation: none; } }
.cal-blog-head { margin: 0; font-weight: 700; }
.cal-blog-sub { margin: 2px 0 0; }
.cal-blog-open { flex: none; }
/* With the writer open beside it, the button that opened it goes. */
.cal-writing .cal-blog-open { display: none; }

/* The write column that slides in beside the details when writing (app.js adds
   .cal-writing to the dialog). The dialog grows and the body becomes two columns. */
.cal-dialog.cal-writing { width: min(1120px, calc(100vw - 32px)); }
/* Stacked by default (narrow dialogs and phones); side by side once there's room. */
.cal-writing .cal-dlg-main { display: grid; grid-template-columns: 1fr; align-items: start; }
.cal-write { padding: 6px 32px 30px; border-top: 1px solid var(--border); margin-top: 10px; }
@media (min-width: 880px) {
  .cal-writing .cal-dlg-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
  .cal-write { padding: 8px 32px 30px; border-top: 0; border-left: 1px solid var(--border); margin-top: 0; }
}
.cal-write-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 0; }
.cal-write-head h3 { margin: 0; font-size: 1.2rem; }
.cal-write-for { margin: 2px 0 0; }
.cal-write-grid { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cal-write-subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-wsec-all { margin: 2px 0 0; color: var(--muted); }
/* The column's folds: a thin bar each, its note saying what's inside while it's folded. */
.cal-wsec { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.cal-wsec[hidden] { display: none; }
.cal-wsec > summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; list-style: none; cursor: pointer; font-weight: 600; font-size: 0.88rem; }
.cal-wsec > summary::-webkit-details-marker { display: none; }
.cal-wsec > summary::before { content: ""; flex: none; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform 0.15s; }
.cal-wsec[open] > summary::before { transform: rotate(45deg); }
.cal-wsec > summary:hover { background: var(--surface-2); border-radius: 10px; }
.cal-wsec > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 10px; }
.cal-wsec-note { min-width: 0; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.cal-wsec[open] .cal-wsec-note { display: none; }
.cal-wsec-body { display: flex; flex-direction: column; gap: 14px; padding: 2px 12px 14px; }
.cal-wsec-body > p { margin: 0; }
.cal-wsec-body .sp-wrap { margin-top: 0; }
.cal-img-hint { margin: 0; }
.cal-write-field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 0.85rem; }
.cal-write :is(input, textarea, select) { font: inherit; font-weight: 400; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.cal-write textarea { resize: vertical; line-height: 1.5; }
.cal-write :is(input, textarea, select):focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.cal-write-opts { display: flex; gap: 12px; }
.cal-write-opts label { flex: 1; display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 0.85rem; }
.cal-write-genrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cal-write-foot { margin-top: 18px; }
.cal-write-status { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--text); }
.cal-write-acts { display: flex; gap: 10px; justify-content: flex-end; }

/* Images: the picked/uploaded strip, the add buttons, and the gallery picker. */
.cal-write-images { gap: 9px; }
.cal-write-images > span { font-weight: 600; font-size: 0.85rem; }
.cal-img-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cal-img-empty { color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.cal-img { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.cal-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cal-img-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.95rem; line-height: 1; cursor: pointer; }
.cal-img-x:hover { background: rgba(0, 0, 0, 0.8); }
.cal-img-tag { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0; border: 0; background: rgba(0, 0, 0, 0.55); color: #fff; font: inherit; font-size: 0.62rem; text-align: center; letter-spacing: 0.03em; }
button.cal-img-tag { cursor: pointer; }
button.cal-img-tag:hover, button.cal-img-tag:focus-visible { background: var(--brand); }
.cal-img:first-child .cal-img-tag { background: var(--brand); font-weight: 700; }
.cal-write[aria-busy] :is(textarea, input) { opacity: 0.7; }
.cal-img-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px; }
.cal-img-up { display: inline-flex; align-items: center; cursor: pointer; }
.cal-img-note { margin: 0; }
.cal-gallery { margin-top: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.cal-gallery > p { margin: 8px 0 0; }
.cal-gallery-head input { width: 100%; box-sizing: border-box; }
.cal-gallery > [data-cal-gallery-more] { margin-top: 10px; }
.cal-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-top: 10px; }
.cal-gallery-tile { padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1; background: var(--surface); }
.cal-gallery-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cal-gallery-tile:hover, .cal-gallery-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* The social post writer (lib/hub.mjs socialColumn): the preview on top, then the
   channels, the text and the pictures. The previews keep each network's own light
   look in either theme, so they read as "this is how it'll look there". */
.sp-wrap { margin-top: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.sp-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sp-tabs[hidden] { display: none; }
.sp-tab { padding: 5px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text-2); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.sp-tab[aria-selected="true"] { border-color: transparent; background: var(--brand); color: #fff; }
.sp-tab-facebook[aria-selected="true"] { background: #1877f2; }
.sp-tab-instagram[aria-selected="true"] { background: linear-gradient(45deg, #f58529, #dd2a7b 55%, #8134af); }
.sp-preview { display: flex; justify-content: center; }
.sp-card { width: 100%; max-width: 420px; border-radius: 10px; overflow: hidden; background: #fff; color: #050505; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.38; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.sp-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sp-avatar { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #7c3aed; color: #fff; font-weight: 700; font-size: 15px; }
.sp-dots { margin-left: auto; color: #65676b; font-weight: 700; letter-spacing: 1px; }
.sp-text { margin: 0; padding: 4px 12px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-tag { color: #385898; }
.sp-more { padding: 0; border: 0; background: none; color: #65676b; font: inherit; font-weight: 600; cursor: pointer; }
.sp-empty { color: #8a8d91; font-style: italic; }
.sp-nopic { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; background: repeating-linear-gradient(45deg, #f0f2f5, #f0f2f5 10px, #e4e6eb 10px, #e4e6eb 20px); color: #65676b; font-size: 13px; }
.sp-ico { display: inline-flex; width: 22px; height: 22px; }
.sp-ico svg { width: 100%; height: 100%; }
.sp-ico-sm { width: 12px; height: 12px; vertical-align: -1px; }
/* Facebook */
.sp-fb-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px; }
.sp-who { display: flex; flex-direction: column; min-width: 0; }
.sp-who strong { font-size: 15px; }
.sp-meta { color: #65676b; font-size: 13px; }
.sp-fb-media { display: grid; gap: 2px; background: #fff; }
.sp-fb-media.sp-n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
.sp-fb-media.sp-n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.sp-fb-media.sp-n3 .sp-cell:first-child { grid-row: span 2; }
.sp-fb-media.sp-n4 { grid-template-columns: 1fr 1fr; aspect-ratio: 1; }
.sp-fb-media.sp-n1 .sp-cell { max-height: 420px; }
.sp-cell { position: relative; overflow: hidden; min-height: 0; }
.sp-plus { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 28px; font-weight: 700; }
.sp-fb-bar { display: flex; justify-content: space-around; margin: 4px 12px 0; padding: 4px 0; border-top: 1px solid #ced0d4; color: #65676b; font-weight: 600; font-size: 14px; }
.sp-act { display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px; }
.sp-act .sp-ico { width: 18px; height: 18px; }
/* Instagram */
.sp-ig { border: 1px solid #dbdbdb; box-shadow: none; }
.sp-ig-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.sp-ig-head strong { font-size: 14px; }
.sp-ring { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(45deg, #f58529, #dd2a7b 55%, #8134af); }
.sp-ring .sp-avatar { width: 30px; height: 30px; border: 2px solid #fff; font-size: 13px; }
.sp-ig-media { position: relative; aspect-ratio: 4 / 5; background: #efefef; }
.sp-ig-media .sp-nopic { height: 100%; aspect-ratio: auto; }
.sp-count-badge { position: absolute; top: 10px; right: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 600; }
.sp-ig-dots { position: absolute; bottom: -18px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; }
.sp-ig-dots i { width: 6px; height: 6px; border-radius: 50%; background: #c7c7c7; }
.sp-ig-dots i.on { background: #0095f6; }
.sp-ig-icons { display: flex; gap: 14px; padding: 10px 12px 6px; color: #262626; }
.sp-grow { flex: 1; }
.sp-ig .sp-text { padding: 0 12px 4px; }
.sp-ig .sp-tag { color: #00376b; }
.sp-ig-time { margin: 0; padding: 0 12px 12px; color: #737373; font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em; }
/* The website's gallery */
.sp-web-head { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; color: #374151; font-weight: 700; }
.sp-web-media { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 4px; padding: 8px; }
.sp-web-media img { aspect-ratio: 4 / 3; border-radius: 6px; }
.sp-web .sp-text { color: #374151; }
/* Anything else */
.sp-generic-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.sp-generic-head .sp-meta { margin-left: auto; }
.sp-generic-media { aspect-ratio: 4 / 3; }
.sp-generic-media .sp-nopic { height: 100%; aspect-ratio: auto; }
.sp-tiktok .sp-generic-head { background: #010101; color: #fff; }
.sp-youtube .sp-generic-head { border-bottom: 3px solid #ff0000; }
.sp-pinterest .sp-generic-head { border-bottom: 3px solid #e60023; }
.sp-nextdoor .sp-generic-head { border-bottom: 3px solid #8ed500; }
/* The blog post, as an article on the website */
.sp-tab-blog[aria-selected="true"] { background: var(--brand); }
.sp-blog { max-width: 460px; }
.sp-card img.sp-blog-cover, .sp-card img.sp-blog-img { height: auto; aspect-ratio: 16 / 9; }
.sp-blog > .sp-nopic { aspect-ratio: 16 / 9; }
.sp-blog-inner { padding: 14px 18px 18px; }
.sp-blog-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 21px; line-height: 1.25; }
.sp-blog-by { margin: 4px 0 12px; color: #6b7280; font-size: 12px; }
.sp-blog-excerpt { margin: 0 0 12px; padding-left: 10px; border-left: 3px solid #e5e7eb; color: #4b5563; font-style: italic; }
.sp-blog-h { margin: 14px 0 4px; font-size: 16px; }
.sp-blog-p { margin: 0 0 9px; }
.sp-blog-list { margin: 0 0 9px; padding-left: 20px; }
.sp-blog-img { margin: 6px 0 10px; border-radius: 6px; }
.sp-blog-more { margin: 4px 0 0; color: #7c3aed; font-weight: 600; }
/* The email newsletter, as it lands in an inbox */
.sp-tab-email[aria-selected="true"] { background: #b45309; }
.sp-email { max-width: 480px; }
.sp-email-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 4px; }
.sp-email-head > .sp-meta { margin-left: auto; font-size: 12px; }
.sp-email-subject { margin: 0; padding: 4px 14px 12px; border-bottom: 1px solid #e5e7eb; font-size: 17px; line-height: 1.3; }
.sp-email-body { padding: 16px 20px 6px; background: #f9fafb; font-family: Arial, Helvetica, sans-serif; color: #1f2937; }
.sp-email-brand { margin: 0 0 14px; font-size: 18px; font-weight: 700; color: #111827; }
.sp-card img.sp-email-img { height: auto; max-height: 260px; margin: 0 0 14px; border-radius: 6px; object-fit: cover; }
.sp-email-h { margin: 16px 0 6px; font-size: 16px; color: #111827; }
.sp-email-p { margin: 0 0 12px; line-height: 1.55; }
.sp-email-list { margin: 0 0 12px; padding-left: 22px; line-height: 1.55; }
.sp-email-link { color: #2563eb; text-decoration: underline; }
.sp-email-btn { display: inline-block; margin: 2px 0 16px; padding: 10px 18px; border-radius: 6px; background: #2563eb; color: #fff; font-weight: 700; }
.sp-email-foot { margin: 0; padding: 10px 20px 14px; border-top: 1px solid #e5e7eb; background: #f9fafb; color: #64748b; font-size: 11px; line-height: 1.5; }
/* The text message, as it lands on a phone */
.sp-tab-sms[aria-selected="true"] { background: #0f766e; }
.sp-sms { max-width: 360px; background: #fff; }
.sp-sms-head { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 12px 10px; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }
.sp-sms-head strong { font-size: 14px; }
.sp-sms-head .sp-meta { font-size: 11px; }
.sp-sms-thread { padding: 16px 14px 6px; }
.sp-sms-bubble { max-width: 85%; margin: 0; padding: 9px 13px; border-radius: 18px 18px 18px 4px; background: #e9e9eb; color: #111; font-size: 15px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-sms-count { margin: 4px 0 0 4px; color: #8a8d91; font-size: 11px; }
.sp-sms-foot { margin: 0; padding: 8px 14px 12px; color: #8a8d91; font-size: 11px; }
.cal-write-sub { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-weight: 500; font-size: 0.82rem; }
/* Google Business Profile's update */
.sp-tab-google_business_profile[aria-selected="true"] { background: #1a73e8; }
.sp-gbp { border: 1px solid #dadce0; box-shadow: none; color: #202124; }
.sp-gbp-head { display: flex; align-items: center; gap: 10px; padding: 12px; }
.sp-g { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid #dadce0; border-radius: 50%; background: #fff; color: #4285f4; font-weight: 700; font-size: 17px; }
.sp-gbp-media { aspect-ratio: 4 / 3; }
.sp-gbp-media .sp-nopic { height: 100%; aspect-ratio: auto; }
.sp-gbp .sp-text { padding-top: 10px; }
.sp-gbp .sp-tag { color: inherit; }
.sp-gbp-btn { display: inline-block; margin: 0 12px 12px; padding: 7px 18px; border: 1px solid #dadce0; border-radius: 999px; color: #1a73e8; font-weight: 600; font-size: 13px; }
.sp-gbp-foot { margin: 0; padding: 8px 12px; border-top: 1px solid #f1f3f4; color: #5f6368; font-size: 12px; }
/* "Information being used for this post", under a writable item's details */
.cal-facts { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.cal-facts h3 { margin: 0; font-size: 1rem; }
.cal-facts > p { margin: 2px 0 0; }
/* Folded: the heading is the button that opens it. */
.cal-facts > summary { display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; }
.cal-facts > summary::-webkit-details-marker { display: none; }
.cal-facts > summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s; }
.cal-facts[open] > summary::after { transform: rotate(-135deg); }
.cal-facts > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 6px; }
.cal-facts-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-facts-group h4 { margin: 14px 0 6px; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.cal-facts-list { display: grid; gap: 9px; margin: 0; }
.cal-facts-list dt { color: var(--text-2); font-size: 0.78rem; font-weight: 600; }
.cal-facts-list dd { margin: 1px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.cal-facts-list [hidden] { display: none; }
.cal-facts-services { margin: 2px 0 0; padding-left: 18px; }
.cal-facts-services li { margin: 2px 0; }
.cal-facts-gap { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--warning-bg); color: var(--warning-ink); }
/* The fields */
.sp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-chip { padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.sp-chip[aria-pressed="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 18%, transparent); }
.sp-chip[aria-pressed="true"]::before { content: "✓ "; }
.sp-chip:disabled { cursor: default; opacity: 0.75; }
.sp-text-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sp-same { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.sp-count { margin: 2px 0 0; text-align: right; }
.sp-count.hot { color: var(--critical-ink); font-weight: 600; }
.sp-locked { margin: 10px 0 0; padding: 9px 12px; border-radius: 8px; background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--text); }
.sp-hint { margin: 0 0 10px; }
.cal-write-acts a.button { text-decoration: none; }

@media (max-width: 700px) {
  .cal-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .cal-dialog.cal-writing { width: 100vw; }
  .cal-dlg-bar { padding: 10px 10px 8px 18px; }
  .cal-dlg-day { padding: 0 14px 24px; }
  .cal-row { gap: 8px; padding: 8px 10px; }
  .cal-row-time { width: 58px; font-size: 0.8rem; }
  .cal-row .tag { display: none; }
  .cal-dlg-body { padding: 6px 18px 28px; border-left-width: 4px; }
  .cal-dlg-title { font-size: 1.4rem; }
  .cal-dlg-facts { grid-template-columns: 1fr; }
  .cal-write { padding: 6px 18px 28px; }
  .cal-blog-state { flex-wrap: wrap; }
  .cal-blog-open { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .cal-dialog[open] { animation: none; } }
.cal-agendas { margin-top: 14px; }
.cal-agenda h3 { margin: 0 0 6px; }
.cal-agenda .sched-list:has(> li:not([hidden]):not(.cat-off)) + .cal-none { display: none; }

/* Scheduling tabs: what to show (Everything, Office calendar, Yours, Apps), one app, and how (Calendar or List). */
.sched-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.sched-tabs > .seg-group:last-child { margin-left: auto; }
/* The App and Website menus: the To-dos tab filter look (.ctl). */
.sched-app { margin: 0; }
.sched-app[hidden] { display: none; }
.sched-app select { width: auto; min-width: 130px; margin: 0; }
.seg-group { display: flex; flex-wrap: wrap; row-gap: 6px; }
.sched-tabs .seg { padding: 7px 14px; font-weight: 600; }
.sched-views[data-view="list"] .cal-panel, .sched-views[data-view="calendar"] .sched-lists, .sched-views[data-view="calendar"] .filter-empty { display: none; }
.sched-lists { display: grid; gap: 18px; }
.sched-lists .panel { margin-top: 0; }
.sched-lists h3 { margin-top: 14px; }
.sched-views:not([data-cat="all"]) [data-cat-panel],
.sched-views[data-cat="all"] :is([data-cat-panel="mine"], [data-cat-panel="office"], [data-cat-panel="websites"]):not(:has(li)),
/* The other Google calendars' lists repeat what Everything already lists by type: only on their own tabs. */
.sched-views[data-cat="all"] :is([data-cat-panel="updates"], [data-cat-panel="social"], [data-cat-panel="payments"], [data-cat-panel="deadlines"], [data-cat-panel="goals"]) { display: none; }
.sched-views[data-cat="office"] [data-cat-panel="office"], .sched-views[data-cat="mine"] [data-cat-panel="mine"], .sched-views[data-cat="websites"] [data-cat-panel="websites"],
.sched-views[data-cat="updates"] [data-cat-panel="updates"], .sched-views[data-cat="social"] [data-cat-panel="social"], .sched-views[data-cat="payments"] [data-cat-panel="payments"],
.sched-views[data-cat="deadlines"] [data-cat-panel="deadlines"], .sched-views[data-cat="goals"] [data-cat-panel="goals"],
.sched-views[data-cat="apps"] :is([data-cat-panel="send"], [data-cat-panel="repeat"], [data-cat-panel="job"]) { display: block; }
.cal-ev.cat-off, .sched.cat-off { display: none; }
.tag-site { color: var(--text); background: var(--surface-2); margin-right: 4px; }
@media (max-width: 640px) {
  .sched-tabs .seg { padding: 6px 10px; }
}
.cal-none { margin: 4px 0 0; }
@media (max-width: 700px) {
  .cal-legend { margin-left: 0; }
  .cal-cell { min-height: 132px; padding: 3px; }
  .cal-date { width: 22px; height: 22px; font-size: 0.75rem; }
  /* Too narrow for titles: each item becomes a colored dot. */
  .cal-events { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 2px; }
  .cal-ev { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; font-size: 0; }
  .cal-ev-mark, .cal-ev-who { display: none; }
  .cal-ev-scheduled { background: var(--brand); }
  .cal-ev-sent { background: var(--good); }
  .cal-ev-failed { background: var(--critical); }
  .cal-ev-repeat { background: var(--muted); }
  .cal-ev-mine { background: #0ea5e9; }
  .cal-ev-office { background: #16a34a; }
  .cal-ev-deadline { background: #ec4899; }
  .cal-ev-goal { background: #f59e0b; }
  /* Dots fit: no "+N more" here. */
  .cal-ev.ev-over { display: block; }
  .cal-events li:has(> .cal-more) { display: none; }
}

/* Overview dashboard (lib/dashboard.mjs): a greeting, what needs you, one tile per tab. */
.dash-hero {
  position: relative; overflow: hidden; margin-bottom: 22px; padding: 28px 30px; border-radius: 18px;
  border: 1px solid var(--border);
  background:
    radial-gradient(600px 260px at 0% 0%, color-mix(in srgb, var(--brand) 35%, transparent), transparent 70%),
    radial-gradient(500px 240px at 100% 100%, color-mix(in srgb, var(--brand-deep) 22%, transparent), transparent 70%),
    var(--surface);
  box-shadow: 0 30px 60px -40px color-mix(in srgb, var(--brand) 80%, transparent);
}
.dash-date { margin: 0 0 6px; color: var(--accent); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; }
.dash-hero h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); margin: 0 0 8px; }
.dash-lede { margin: 0; color: var(--text-2); }
.needs { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.need {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; text-decoration: none;
  font-size: 0.88rem; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong);
  transition: border-color 0.15s, transform 0.15s;
}
.need:hover { border-color: var(--accent); transform: translateY(-1px); }
.need-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.need-bad .need-dot { background: var(--critical); box-shadow: 0 0 8px var(--critical); }
.need-warn .need-dot { box-shadow: 0 0 8px var(--warning); }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px 22px; border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tile::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; border-radius: 16px 16px 0 0; background: var(--border-strong);
}
.tile-good::before { background: linear-gradient(90deg, var(--good), transparent); }
.tile-warn::before { background: linear-gradient(90deg, var(--warning), transparent); }
.tile-bad::before { background: linear-gradient(90deg, var(--critical), transparent); }
.tile-calm::before { background: linear-gradient(90deg, var(--brand), transparent); }
.tile:hover { border-color: color-mix(in srgb, var(--brand) 55%, transparent); box-shadow: 0 18px 40px -24px color-mix(in srgb, var(--brand) 80%, transparent); transform: translateY(-2px); }
/* Eight tiles, always filling their rows (the wrapper is measured as a container):
   - very wide: all of them in one row;
   - most screens: two rows of four (Servers, Workers, To-dos, Websites, then
     Communications, Scheduling, Finances, Clients) on a 12-column grid;
   - medium: rows of two;
   - phones: one column.
   Someone who can't open every tab sees seven: three on top, four below
   (medium: two rows of two, then three). */
.dash-tiles { container-type: inline-size; }
@container (min-width: 2000px) {
  .dash-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
}
@container (min-width: 1000px) and (max-width: 1999px) {
  .dash-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .dash-grid > .tile { grid-column: span 3; }
  .dash-grid:has(> .tile:nth-child(7):last-child) > .tile:nth-child(-n + 3) { grid-column: span 4; }
}
@container (min-width: 640px) and (max-width: 999px) {
  .dash-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dash-grid > .tile { grid-column: span 3; }
  .dash-grid:has(> .tile:nth-child(7):last-child) > .tile:nth-child(n + 5) { grid-column: span 2; }
}

/* Recent activity and Incidents: half the width each, under the other tiles. */
.dash-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-top: 16px; }
.ti-kind { color: var(--accent); }
.tile-link { position: absolute; inset: 0; border-radius: 16px; z-index: 1; }
.tile-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Settings → Overview's Dim financials: a dark shade over the whole Finances tile and money
   chart, following the card's edges and corners at every width; it takes the clicks and
   hovers too, so nothing under it pops up its amounts. */
.fin-dim { position: relative; }
.fin-dim::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; background: rgb(0 0 0 / 0.88); z-index: 3; }
.tile-sub a { position: relative; z-index: 2; }
.tile-head { display: flex; align-items: center; gap: 10px; }
.tile-head h2 { margin: 0; font-size: 1rem; }
.tile-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1rem; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 90%, transparent);
}
.tile-go { margin-left: auto; color: var(--muted); transition: transform 0.15s, color 0.15s; }
.tile:hover .tile-go { color: var(--accent); transform: translateX(3px); }
.tile-big { margin: 6px 0 0; display: flex; align-items: baseline; gap: 8px; }
.tile-num { font: 700 2.4rem/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-good .tile-num { color: var(--good-ink); }
.tile-warn .tile-num { color: var(--warning-ink); }
.tile-bad .tile-num { color: var(--critical-ink); }
.tile-unit { color: var(--text-2); font-weight: 500; }
.tile-sub { margin: 0; font-size: 0.85rem; color: var(--muted); }
.ti-bad-text { color: var(--critical-ink); font-weight: 600; }
.tile-list { list-style: none; margin: 6px 0 0; padding: 10px 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.tile-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.86rem; padding-left: 12px; position: relative; }
.tile-list li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.tile-list li.ti-warn::before { background: var(--warning); }
.tile-list li.ti-bad::before { background: var(--critical); }
.ti-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ti-meta { flex: 0 1 auto; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 0.8rem; }
.tile-empty { margin: 6px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.86rem; color: var(--muted); }
/* A chart card's toggle (Open to-dos by app's Overview, Human, AI) and its panes;
   Human and AI list to-dos one line each (lib/dashboard.mjs todoRows). */
.viz-tabs { margin: 12px 0 10px; }
.viz-card:has(> .viz-tabs) .viz-sub { margin-top: 6px; }
.viz-card:has(> .viz-tabs) .viz-pane > .viz-legend:first-child { margin-top: 0; }
.viz-tabs .seg { padding: 3px 10px; font-size: 0.8rem; }
.viz-tabs .count { margin-left: 4px; font-size: 0.72rem; opacity: 0.8; }
.viz-pane { display: flex; flex-direction: column; gap: 8px; }
.viz-pane[hidden] { display: none; }
.viz-pane .tile-list { margin-top: 0; }
.tile-list li.ttodo { display: block; }
.ttodo summary { display: flex; gap: 12px; cursor: pointer; list-style: none; border-radius: 6px; }
.ttodo summary::-webkit-details-marker { display: none; }
.ttodo summary:hover .ti-text { color: var(--accent); }
.ttodo summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ttodo details[open] summary .ti-text { white-space: normal; font-weight: 600; }
.ttodo-more { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 2px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 0.82rem; }
.ttodo-facts { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--text-2); }
.ttodo-facts .cstatus { width: auto; }
.ttodo-details { margin: 0; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.ttodo-open, .ttodo-all { font-size: 0.8rem; color: var(--accent); text-decoration: none; }
.ttodo-open:hover, .ttodo-all:hover { text-decoration: underline; }
/* The Overview's Scheduling card (lib/dashboard.mjs scheduleCard): today's items by time,
   the next one called out, the passed ones dimmed; This week by day. */
.sched-list .ti-time { flex: 0 0 4.6em; color: var(--text-2); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile-list li.ti-next::before { background: var(--accent); }
.tile-list li.ti-next .ti-text { font-weight: 600; }
.tile-list li.ti-past { opacity: 0.55; }
.sched-alerts { border-top: 0; padding-top: 0; }
.sched-next { margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-next-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.sched-day { margin: 4px 0 -2px; font-size: 0.82rem; font-weight: 600; }
.viz-tools { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.viz-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.viz-switch input { margin: 0; accent-color: var(--accent); }
div[data-sched-upd] { display: flex; flex-direction: column; gap: 8px; }
[data-sched-upd][hidden] { display: none; }
.dots { display: inline-flex; flex-wrap: wrap; gap: 5px; vertical-align: middle; }
.sdot { width: 12px; height: 12px; border-radius: 4px; background: var(--empty); }
.sdot-up { background: var(--good); }
.sdot-warn { background: var(--warning); }
.sdot-fail, .sdot-down { background: var(--critical); }
.sdot-setup { background: color-mix(in srgb, var(--brand) 60%, transparent); }
@media (max-width: 640px) {
  .dash-hero { padding: 20px; }
}

/* Finances (lib/finances.mjs): big totals, an in/out bar, then credits and debits side by side. */
:root { --money-in: #34d399; --money-out: #f472b6; --money-in-bg: rgba(52, 211, 153, 0.12); --money-out-bg: rgba(244, 114, 182, 0.12); }
:root[data-theme="light"] { --money-in: #059669; --money-out: #db2777; --money-in-bg: rgba(5, 150, 105, 0.08); --money-out-bg: rgba(219, 39, 119, 0.07); }
/* The Finances banner is the shared .summary banner with money colors, a green
   glow, and the in/out split as a thin strip along the bottom edge, so it is
   the same height as the others. */
.summary.fin-hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(500px 240px at 100% 100%, rgba(52, 211, 153, 0.10), transparent 70%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 16%, transparent), var(--summary-fade) 45%), var(--surface);
}
.fin-totals dd { letter-spacing: -0.02em; }
.fin-total-in dd { color: var(--money-in); }
.fin-total-out dd { color: var(--money-out); }
.fin-total-net dd {
  background: linear-gradient(90deg, #fff, #c9a7f5); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="light"] .fin-total-net dd { background: linear-gradient(90deg, #0d1018, #7a22d0); -webkit-background-clip: text; background-clip: text; }
.fin-split { position: absolute; left: 0; right: 0; bottom: 0; display: flex; height: 5px; background: var(--empty); }
.fin-split-in { background: linear-gradient(90deg, #059669, var(--money-in)); }
.fin-split-out { background: linear-gradient(90deg, var(--money-out), #be185d); }
.fin-legend { white-space: nowrap; }
.key { display: inline-block; width: 9px; height: 9px; margin-right: 3px; border-radius: 3px; vertical-align: baseline; }
.key-in { background: var(--money-in); }
.key-out { background: var(--money-out); }

.fin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.fin-col-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--money-in); }
.fin-out .fin-col-head { border-bottom-color: var(--money-out); }
.fin-col-head h2 { margin: 0; font-size: 1.5rem; }
.fin-col-kind { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fin-col-total { margin: 0 0 0 auto; font: 700 1.5rem var(--font-display); font-variant-numeric: tabular-nums; color: var(--money-in); }
.fin-out .fin-col-total { color: var(--money-out); }
.fin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.fin-card {
  padding: 18px 20px; border-radius: 16px; border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--money-in-bg), transparent 60%), linear-gradient(180deg, var(--surface-2), var(--surface));
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.fin-out .fin-card { background: linear-gradient(135deg, var(--money-out-bg), transparent 60%), linear-gradient(180deg, var(--surface-2), var(--surface)); }
.fin-card:hover { transform: translateY(-2px); border-color: var(--money-in); box-shadow: 0 16px 34px -24px var(--money-in); }
.fin-out .fin-card:hover { border-color: var(--money-out); box-shadow: 0 16px 34px -24px var(--money-out); }
.fin-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.fin-card h3 { margin: 0 0 3px; font: 650 1.1rem var(--font-display); text-transform: none; letter-spacing: 0; color: var(--text); }
.fin-detail { margin: 0; font-size: 0.88rem; color: var(--text-2); }
.fin-amount { margin: 0; font: 700 1.7rem/1.1 var(--font-display); letter-spacing: -0.01em; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--money-in); }
.fin-out .fin-amount { color: var(--money-out); }
.fin-share { height: 5px; margin: 14px 0 10px; border-radius: 999px; background: var(--empty); overflow: hidden; }
.fin-share span { display: block; height: 100%; border-radius: 999px; background: var(--money-in); }
.fin-out .fin-share span { background: var(--money-out); }
.fin-meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem; }
@media (max-width: 860px) {
  .fin-cols { grid-template-columns: 1fr; }
}

/* Finances: month arrows, add buttons, edit links, the entry form. */
.fin-months { display: flex; align-items: center; gap: 8px; }
.fin-month-step {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text-2); text-decoration: none; font-size: 0.85rem; font-weight: 600; white-space: nowrap;
}
.fin-month-step:hover { color: var(--text); border-color: var(--accent); }
.fin-sync { margin: 0; }
.fin-sync button { cursor: pointer; font: inherit; font-size: 0.85rem; }
.fin-add {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; padding: 12px; border-radius: 14px;
  border: 1.5px dashed var(--money-in); color: var(--money-in); background: var(--money-in-bg);
  font-weight: 650; text-decoration: none; transition: background 0.15s, transform 0.15s;
}
.fin-out .fin-add { border-color: var(--money-out); color: var(--money-out); background: var(--money-out-bg); }
.fin-add span { font-size: 1.2rem; line-height: 1; }
.fin-add:hover { transform: translateY(-1px); background: transparent; }
.fin-none { margin: 0; padding: 26px; text-align: center; color: var(--muted); border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.fin-edit {
  margin-left: auto; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  color: var(--text-2); text-decoration: none; font-weight: 600;
}
.fin-edit:hover { color: var(--text); border-color: var(--accent); }
.fin-form .form select, .fin-form .form textarea {
  font: inherit; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.fin-form .form input[type="date"] { color-scheme: inherit; }
.option-kind-in:has(input:checked) { border-color: var(--money-in); box-shadow: 0 0 0 1px var(--money-in); }
.option-kind-out:has(input:checked) { border-color: var(--money-out); box-shadow: 0 0 0 1px var(--money-out); }
.option-kind-in .option-label { color: var(--money-in); }
.option-kind-out .option-label { color: var(--money-out); }

/* Finances: QuickBooks links, the import page and the connection page (lib/qbpages.mjs). */
.fin-sources { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: flex-end; margin: 14px 0 16px; font-size: 0.88rem; }
.fin-sources a, .fin-sources > span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-weight: 600; }
.fin-sources a:hover { color: var(--text); text-decoration: underline; }
.fin-qb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--money-in); }
.fin-qb-dot.bad { background: var(--critical); }
.tag-qb { background: rgba(44, 160, 28, 0.14); border-color: rgba(44, 160, 28, 0.45); color: var(--good-ink); }
.tag-good { background: var(--good-bg); border-color: transparent; color: var(--good-ink); }
.imp { max-width: 980px; margin-left: auto; margin-right: auto; }
.imp h1 { margin-top: 0; }
.imp-steps { padding-left: 1.3em; line-height: 1.7; }
.imp-form textarea {
  width: 100%; box-sizing: border-box; font: 0.82rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 9px 11px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.imp-form input[type="file"] { font: inherit; padding: 10px; border: 1.5px dashed var(--border-strong); border-radius: 10px; background: var(--bg); color: var(--text-2); }
.imp-chosen { margin: -6px 0 0; }
.imp-summary { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 6px 0 14px; }
.imp-summary p { margin: 0; }
.imp-in { color: var(--money-in); }
.imp-out { color: var(--money-out); }
.imp-confirm { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.imp-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.imp-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.imp-table th, .imp-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.imp-table th { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.imp-table tr:last-child td { border-bottom: 0; }
.imp-num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 650; }
.imp-dim td { opacity: 0.6; }
.imp-batches { list-style: none; margin: 0; padding: 0; }
.imp-batches li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.imp-batches li:last-child { border-bottom: 0; }
.imp-batches form { margin: 0; }
.qb-uri { display: inline-block; margin-top: 4px; padding: 4px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); word-break: break-all; }
.qb-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 12px 0; }
.qb-facts dt { color: var(--muted); font-weight: 600; }
.qb-facts dd { margin: 0; }
@media (max-width: 640px) {
  .fin-sources { justify-content: flex-start; }
  .imp-table th:nth-child(3), .imp-table td:nth-child(3) { display: none; }
}
/* Overview charts (lib/charts.mjs). Chart colors were checked with the dataviz
   palette validator against each theme's card surface: money in/out pass the
   color-blind separation check; the to-do status stack is one purple, light to dark. */
:root {
  --viz-in: #2b9bd8;
  --viz-out: #e0479a;
  --viz-line: #a964f0;
  --viz-s1: #d8b4fe;
  --viz-s2: #b07cf5;
  --viz-s3: #8a2ce2;
  --viz-s4: #6526b0;
}
:root[data-theme="light"] {
  --viz-in: #1f7fbf;
  --viz-out: #c42f80;
  --viz-line: #7a22d0;
  --viz-s1: #4f1a8c;
  --viz-s2: #7a22d0;
  --viz-s3: #9257e6;
  --viz-s4: #ad87ea;
}
.viz-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; margin-bottom: 22px; }
.viz-card {
  min-width: 0; padding: 18px 20px 14px; border-radius: 16px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.viz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.viz-head h2 { margin: 0; font-size: 1.02rem; }
/* A card's button and "All … →" link, side by side at the top right (the Overview's + Add a to-do). */
.viz-head-acts { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 14px; }
.viz-sub { margin: 3px 0 0; font-size: 0.82rem; color: var(--muted); }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 4px; font-size: 0.8rem; color: var(--text-2); }
.viz-key { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.viz-swatch.viz-in { background: var(--viz-in); }
.viz-swatch.viz-out { background: var(--viz-out); }
.viz-swatch.viz-s1 { background: var(--viz-s1); }
.viz-swatch.viz-s2 { background: var(--viz-s2); }
.viz-swatch.viz-s3 { background: var(--viz-s3); }
.viz-swatch.viz-s4 { background: var(--viz-s4); }
.viz-empty { margin: 30px 0; text-align: center; color: var(--muted); font-size: 0.9rem; }
.viz-svg { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.viz-svg .viz-grid { stroke: var(--grid); stroke-width: 1; }
.viz-tick { fill: var(--muted); font: 11px var(--font); }
.viz-line { fill: none; stroke: var(--viz-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-area { fill: url(#viz-area); }
.viz-area-top { stop-color: var(--viz-line); stop-opacity: 0.28; }
.viz-area-bottom { stop-color: var(--viz-line); stop-opacity: 0; }
.viz-end, .viz-solo { fill: var(--viz-line); stroke: var(--surface); stroke-width: 2; }
.viz-end-label { fill: var(--text); font: 600 12px var(--font); }
.viz-hit rect:first-child, .viz-bar-hit { fill: transparent; }
.viz-cross { stroke: var(--text-2); stroke-width: 1; opacity: 0; }
.viz-dot { fill: var(--viz-line); stroke: var(--surface); stroke-width: 2; opacity: 0; }
.viz-hit:hover .viz-cross, .viz-hit:hover .viz-dot { opacity: 1; }
.viz-svg path.viz-in { fill: var(--viz-in); }
.viz-svg path.viz-out { fill: var(--viz-out); }
.viz-svg rect.viz-in { fill: var(--viz-in); }
.viz-svg rect.viz-out { fill: var(--viz-out); }
.viz-hit:hover path { filter: brightness(1.15); }
/* Response time's "By server" view: whisker, middle-half band, median dot. */
.viz-whisker { stroke: var(--text-2); stroke-width: 1.5; stroke-linecap: round; opacity: 0.55; }
.viz-iqr { fill: var(--viz-line); opacity: 0.35; }
.viz-med { fill: var(--viz-line); stroke: var(--surface); stroke-width: 2; }
.viz-srv-name { fill: var(--text-2); font-size: 12px; }
.viz-hit:hover .viz-iqr { opacity: 0.55; }
.viz-hit:hover .viz-whisker { opacity: 1; }
.viz-swatch.viz-iqr { background: var(--viz-line); opacity: 0.35; }
.viz-swatch.viz-med { background: var(--viz-line); border-radius: 50%; }
.viz-swatch.viz-whisker { background: var(--text-2); height: 2px; align-self: center; opacity: 0.7; }
/* Server speed's "By hour" heatmap: six steps of the chart purple, light to deep = fast to slow. */
.ucell.heat-1, .viz-swatch.heat-1 { background: color-mix(in srgb, var(--viz-line) 16%, var(--empty)); }
.ucell.heat-2, .viz-swatch.heat-2 { background: color-mix(in srgb, var(--viz-line) 32%, var(--empty)); }
.ucell.heat-3, .viz-swatch.heat-3 { background: color-mix(in srgb, var(--viz-line) 50%, var(--empty)); }
.ucell.heat-4, .viz-swatch.heat-4 { background: color-mix(in srgb, var(--viz-line) 68%, var(--empty)); }
.ucell.heat-5, .viz-swatch.heat-5 { background: color-mix(in srgb, var(--viz-line) 85%, var(--empty)); }
.ucell.heat-6, .viz-swatch.heat-6 { background: var(--viz-out); }
.heat-scale { gap: 3px; }
.heat-scale .viz-swatch { border-radius: 2px; }
/* Server speed's "Spread" histogram. */
.viz-svg .viz-hist { fill: var(--viz-line); opacity: 0.8; }
.viz-svg .viz-hist-slow { fill: var(--viz-out); }
.viz-hit:hover .viz-hist { opacity: 1; }
.viz-swatch.viz-hist { background: var(--viz-line); }
.viz-swatch.viz-hist-slow { background: var(--viz-out); }
.viz-mark { stroke-width: 1.5; stroke-dasharray: 4 3; }
.viz-mark-med { stroke: var(--text); }
.viz-mark-slow { stroke: var(--viz-out); }
/* A money bar that opens what makes it up (lib/moneybreakdown.mjs). */
.viz-bar-link { cursor: pointer; }
.viz-bar-link:focus { outline: none; }
.viz-bar-link:focus-visible path, .viz-bar-link:focus-visible rect.viz-in, .viz-bar-link:focus-visible rect.viz-out { stroke: var(--text); stroke-width: 2; }
.viz-table { margin-top: 6px; font-size: 0.82rem; }
.viz-table summary { margin: 0; color: var(--muted); font-size: 0.8rem; }
.viz-table table { margin-top: 6px; }
.viz-tip {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; max-width: 280px;
  padding: 6px 10px; border-radius: 8px; font-size: 0.8rem; font-weight: 600;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
}

/* Uptime grid: a name column and 24 hour squares. */
.uptime { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.uptime-row { display: grid; grid-template-columns: minmax(90px, 150px) 1fr; gap: 10px; align-items: center; }
.uptime-name { font-size: 0.82rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uptime-cells { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.ucell { height: 16px; border-radius: 3px; background: var(--empty); transition: transform 0.1s; }
.ucell:hover { transform: scaleY(1.25); }
.ucell-up { background: var(--good); }
.ucell-warn { background: var(--warning); }
.ucell-down { background: var(--critical); }
.viz-swatch.ucell-up { background: var(--good); }
.viz-swatch.ucell-warn { background: var(--warning); }
.viz-swatch.ucell-down { background: var(--critical); }
.viz-swatch.ucell-none { background: var(--empty); }
.uptime-hours { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }

/* Stacked bars: one per app, a 2px gap between segments, rounded at the data end. */
.stackbars { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.stackbar-row { display: grid; grid-template-columns: minmax(80px, 110px) 1fr; gap: 10px; align-items: center; }
.stackbar-name { font-size: 0.85rem; color: var(--text-2); }
.stackbar-track { display: flex; align-items: center; gap: 8px; }
.stackbar { display: flex; gap: 2px; height: 22px; min-width: 4px; }
.stackseg { min-width: 4px; }
.stackseg:last-child { border-radius: 0 4px 4px 0; }
.stackseg:hover { filter: brightness(1.15); }
.stackseg.viz-s1 { background: var(--viz-s1); }
.stackseg.viz-s2 { background: var(--viz-s2); }
.stackseg.viz-s3 { background: var(--viz-s3); }
.stackseg.viz-s4 { background: var(--viz-s4); }
.stackbar-total { font-weight: 650; font-size: 0.9rem; color: var(--text); }
.stackbars-more { margin-top: 10px; }
.stackbars-more summary { margin: 0; color: var(--muted); font-size: 0.8rem; cursor: pointer; }
.stackbars-more .stackbars { margin-top: 10px; }
.stackbars-more[open] .more-closed, .stackbars-more:not([open]) .more-open { display: none; }

/* Workers at work: lanes of armored units on the left, falling code on the right.
   Task lanes sit at the task's progress (--pct) and glide when it changes;
   patrol lanes walk job after job at an uneven pace (app.js). Slow and heavy. */
.robots {
  margin-bottom: 22px; padding: 20px 22px; border-radius: 16px; border: 1px solid var(--border);
  background: radial-gradient(700px 220px at 30% 120%, rgba(190, 18, 60, 0.12), transparent 70%), radial-gradient(600px 200px at 80% -20%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%), linear-gradient(180deg, var(--surface-2), var(--surface));
}
.robots-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.robots-head h2 { margin: 0; }
.robots-all { font-size: 0.85rem; white-space: nowrap; }
.robots-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 22px; align-items: stretch; }
.lanes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
/* The Overview's Workers at work: more room between workers. */
.robots-backdrop .lanes { gap: 49px; }
.lane { display: grid; grid-template-columns: minmax(150px, 220px) 1fr minmax(84px, 130px); gap: 14px; align-items: end; }
.lane-label { display: flex; flex-direction: column; min-width: 0; }
.lane-task { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-who { font-size: 0.78rem; color: var(--muted); }
.lane-note { font-size: 0.8rem; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
/* What the worker last said: under its name, across the whole lane, two lines at most. */
.lane-detail { grid-column: 1 / -1; margin: -6px 0 0; font-size: 0.8rem; line-height: 1.4; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lane-detail[hidden] { display: none; }
.lane-track { --pct: 0%; position: relative; height: 6px; margin: 52px 22px 4px 0; border-radius: 1px; background: rgba(148, 163, 184, 0.14); box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08); }
.lane-fill {
  position: absolute; inset: 0 auto 0 0; width: var(--pct); border-radius: 1px;
  background:
    linear-gradient(90deg, transparent 0 70%, rgba(255, 45, 111, 0.9) 100%),
    repeating-linear-gradient(90deg, #4c1d95 0 10px, #6d28d9 10px 12px);
  background-size: 100% 100%, 48px 100%;
  box-shadow: 0 0 10px color-mix(in srgb, var(--brand-deep) 55%, transparent);
  animation: lane-packets 2.6s linear infinite;
  transition: width var(--move, 2.4s) cubic-bezier(0.45, 0.05, 0.3, 1), opacity 0.35s;
}
.lane-target { position: absolute; right: -20px; top: -7px; width: 20px; height: 20px; fill: none; stroke: #ff2d6f; stroke-width: 1.5; opacity: 0.75; animation: target-pulse 3s ease-in-out infinite; }
.robot { position: absolute; bottom: 4px; left: var(--pct); width: 46px; margin-left: -23px; transition: left var(--move, 2.4s) cubic-bezier(0.45, 0.05, 0.3, 1), opacity 0.35s; }
.robot-svg { position: relative; z-index: 1; display: block; width: 100%; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 6px rgba(255, 45, 111, 0.35)); animation: robot-tread 1.1s ease-in-out infinite alternate; }
.r-head { fill: #17121f; stroke: #8b5cf6; stroke-width: 1.6; stroke-linejoin: miter; }
.r-horn { fill: #2b1d3d; stroke: #6d28d9; stroke-width: 1; }
.r-jaw { stroke: #3b2a52; stroke-width: 1.4; }
.r-visor { fill: #2a0712; stroke: #4c0519; stroke-width: 0.8; }
.r-eye { fill: #ff2d6f; filter: drop-shadow(0 0 3px #ff2d6f); animation: robot-scan 2.8s ease-in-out infinite alternate; transform-box: view-box; }
.r-body { fill: #1d1528; stroke: #7c3aed; stroke-width: 1.4; stroke-linejoin: miter; }
.r-core { fill: #ff2d6f; opacity: 0.8; animation: core-pulse 2.2s ease-in-out infinite; }
.r-foot { fill: #3b2a52; stroke: #6d28d9; stroke-width: 0.8; transform-box: fill-box; }
.r-foot-l { animation: robot-step 1.1s ease-in-out infinite alternate; }
.r-foot-r { animation: robot-step 1.1s ease-in-out infinite alternate-reverse; }
.exhaust { position: absolute; left: -4px; bottom: 6px; width: 12px; height: 10px; }
.exhaust i { position: absolute; left: 0; bottom: 0; width: 3px; height: 3px; border-radius: 50%; background: #ff2d6f; box-shadow: 0 0 5px #ff2d6f; opacity: 0; animation: robot-exhaust 2.2s ease-out infinite; }
.exhaust i:nth-child(2) { animation-delay: 1.1s; }
/* Patrols (app.js): a job at a time in uneven steps; lane-pause while it scans,
   lane-swap to fade between jobs, lane-done at the target. */
.lane-swap .robot, .lane-swap .lane-fill { opacity: 0; }
.lane-pause .r-eye { animation-duration: 0.55s; }
.lane-pause .r-foot, .lane-pause .robot-svg { animation-play-state: paused; }
.lane-pause .lane-fill { box-shadow: 0 0 16px rgba(255, 45, 111, 0.55); }
.lane-done .lane-target { opacity: 1; animation: none; stroke-width: 2; filter: drop-shadow(0 0 4px #ff2d6f); }
.lane-done .r-core { opacity: 1; animation: none; }
.lane-scan { position: absolute; inset: -4px 0; background: linear-gradient(90deg, transparent, rgba(255, 45, 111, 0.28), transparent) 0 0 / 18% 100% no-repeat; animation: lane-scan 5s ease-in-out infinite; }
.lane-stale .lane-fill, .lane-stale .robot-svg, .lane-stale .r-foot, .lane-stale .exhaust i, .lane-stale .r-eye { animation: none; }
.lane-stale .lane-fill { filter: grayscale(0.8); box-shadow: none; }
.lane-stale .robot-svg { opacity: 0.55; }
.pulse-dot { width: 7px; height: 7px; border-radius: 1px; background: #ff2d6f; box-shadow: 0 0 0 0 rgba(255, 45, 111, 0.55); animation: pulse-dot 2.4s ease-out infinite; flex: none; }

/* The code panel beside the lanes: a dark window of falling code (app.js). */
.robot-code { position: relative; min-height: 180px; border-radius: 12px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--brand-deep) 45%, transparent); background: #05060a; box-shadow: inset 0 0 40px color-mix(in srgb, var(--brand-deep) 35%, transparent); }
.robot-code .matrix { -webkit-mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent); mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent); opacity: 0.9; }
:root[data-theme="light"] .robot-code .matrix { opacity: 0.9; }
/* The Overview's card: the code falls behind the lanes instead, faded back so they read. */
.robots-backdrop { position: relative; isolation: isolate; overflow: hidden; }
.robots-backdrop > :not(.matrix) { position: relative; z-index: 1; }
.robots-backdrop .robots-body { grid-template-columns: minmax(0, 1fr); }
.robots-backdrop > .matrix { opacity: 0.2; -webkit-mask-image: linear-gradient(transparent, #000 20%, #000 80%, transparent); mask-image: linear-gradient(transparent, #000 20%, #000 80%, transparent); }
:root[data-theme="light"] .robots-backdrop > .matrix { opacity: 0.1; }

/* The Overview: Deadlines, Goals, then Workers at work in one row, the same height. */
.dash-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: stretch; margin-bottom: 22px; }
.dash-work-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); }
.dash-work > .robots { margin-bottom: 0; }
.goals-glance { padding: 20px 22px; border-radius: 16px; border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface)); min-width: 0; display: flex; flex-direction: column; }
.glance-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
/* Each row folds down to its description and key steps (lib/keysteps.mjs glanceFold). */
.glance-fold > summary { display: flex; flex-direction: column; gap: 5px; list-style: none; cursor: pointer; padding: 8px 10px; margin: 0 -10px; border-radius: 10px; }
.glance-fold > summary::-webkit-details-marker { display: none; }
.glance-fold > summary:hover, .glance-fold[open] > summary { background: color-mix(in srgb, var(--c) 8%, transparent); }
.glance-fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.glance-fold[open] .glance-title { white-space: normal; }
.glance-info { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px 18px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); border-left: 3px solid var(--c); background: var(--surface); font-size: 0.85rem; }
.goals-glance .glance-info .goal-detail { display: block; font-size: 0.85rem; line-height: 1.5; }
.glance-steps-head { margin: 0; font-size: 0.78rem; font-weight: 650; color: var(--text-2); }
.goals-glance .glance-info .goal-steps { display: grid; padding: 0; border: 0; }
.glance-info .goal-steps li { font-size: 0.84rem; }
.glance-open { font-size: 0.8rem; color: var(--accent); text-decoration: none; }
.glance-open:hover { text-decoration: underline; }
.glance-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.glance-top .goal-dot { width: 9px; height: 9px; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.glance-title { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.glance-top .goal-status { flex: none; font-size: 0.7rem; padding: 1px 8px; }
.glance-bar { display: flex; align-items: center; gap: 10px; padding-left: 18px; }
.glance-bar .goal-bar { flex: 1; margin: 0; }
.glance-pct { font-size: 0.78rem; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 3ch; text-align: right; }
.glance-meta { font-size: 0.76rem; color: var(--muted); padding-left: 18px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.glance-meta .goal-income { margin: 0; font-size: 0.74rem; padding: 1px 8px; }
.glance-more { margin-top: auto; padding-top: 10px; }
.glance-more > summary { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--accent); list-style: none; }
.glance-more > summary::-webkit-details-marker { display: none; }
.glance-more > summary::after { content: " ▾"; }
.glance-more[open] > summary::after { content: " ▴"; }
.glance-more[open] > summary { margin-bottom: 12px; }
.glance-more[open] > summary .more-closed, .glance-more:not([open]) > summary .more-open { display: none; }
/* Narrower: the glances share a row and Workers at work goes full width under them. */
@media (max-width: 1100px) { .dash-work { grid-template-columns: minmax(0, 1fr); } .dash-work-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dash-work > .robots { grid-column: 1 / -1; } }
@media (max-width: 700px) { .dash-work-2 { grid-template-columns: minmax(0, 1fr); } }

@keyframes lane-packets { to { background-position: 0 0, 48px 0; } }
@keyframes robot-tread { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }
@keyframes robot-step { from { transform: translateY(0); } to { transform: translateY(-2px); } }
@keyframes robot-scan { from { transform: translateX(0); } to { transform: translateX(12px); } }
@keyframes core-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.95; } }
@keyframes robot-exhaust { 0% { opacity: 0.8; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(-12px, -4px) scale(0.4); } }
@keyframes target-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.9); } 50% { opacity: 0.9; transform: scale(1); } }
@keyframes lane-scan { from { background-position: -30% 0; } to { background-position: 130% 0; } }
@keyframes pulse-dot { to { box-shadow: 0 0 0 7px rgba(255, 45, 111, 0); } }

@media (max-width: 900px) {
  .robots-body { grid-template-columns: 1fr; }
  .robot-code { min-height: 120px; }
}
@media (max-width: 760px) {
  .lane { grid-template-columns: 1fr; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .lane-fill, .robot, .robot-svg, .r-foot, .r-eye, .r-core, .exhaust i, .lane-scan, .lane-target, .pulse-dot { animation: none !important; }
  .lane-patrol .lane-fill { width: 50%; }
  .lane-patrol .robot { left: 50%; }
}

/* Matrix code behind the greeting, faded out toward the text. */
.dash-hero { isolation: isolate; }
.dash-hero > :not(.matrix) { position: relative; z-index: 1; }
.matrix {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0.55;
  -webkit-mask-image: linear-gradient(to left, #000 15%, transparent 70%); mask-image: linear-gradient(to left, #000 15%, transparent 70%);
}
:root[data-theme="light"] .matrix { opacity: 0.3; }


/* Users (the people icon in the header). */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h1 { margin: 0; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
.users-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.users-table th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.users-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.users-table tr.is-canceled td { opacity: 0.6; }
.users-table tr:last-child td { border-bottom: 0; }
.users-table a { color: var(--accent); }
.users-table .cell-notes { white-space: normal; max-width: 280px; color: var(--text-2); }
.acct-why > summary { display: inline-block; list-style: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.acct-why > summary::-webkit-details-marker { display: none; }
.acct-why > summary::after { content: " ▾"; }
.acct-why[open] > summary::after { content: " ▴"; }
.acct-why > summary:hover { text-decoration: underline; }
.acct-why > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.acct-why > p { margin: 0.35em 0 0; }
.users-table .cell-money { font-variant-numeric: tabular-nums; }
.users-table .cell-password { white-space: nowrap; }
.users-table .cell-password .wlogin { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; user-select: all; }
.tag-on { background: var(--good-bg); border-color: transparent; color: var(--good-ink); }
.tag-wait { background: var(--warning-bg); border-color: transparent; color: var(--warning-ink); }
.alt-signin { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); }
.auth .actions.small { margin-top: 18px; }
.access { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.access legend { font-weight: 600; font-size: 0.9rem; padding: 0 6px; }
.access p { margin: 0; }
.access-sees { display: flex; flex-direction: column; gap: 8px; }
.access-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.access-levels .access-level select { width: 100%; min-width: 0; }
@media (max-width: 640px) { .access-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form .access-level select { padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: inherit; font-weight: 400; }
.users-table td.access-cell { white-space: normal; min-width: 180px; max-width: 280px; font-size: 0.85rem; }

/* Documents: the Google Drive box, then the highlighted documents by category. */
.drive-box { display: flex; gap: 14px; align-items: flex-start; margin-top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.drive-box h2 { margin: 0 0 8px; font-size: 1rem; }
.drive-box p { margin: 0; }
.drive-box .button { margin-right: 10px; }
.drive-box .drive-note { margin-top: 10px; color: var(--text-2); white-space: pre-line; }
.drive-icon { font-size: 1.3rem; line-height: 1; color: var(--brand); padding-top: 2px; }
.doc-group { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; margin: 22px 0 8px; }

/* How we work (lib/guides.mjs): a card per guide in its own color, then each guide's page, framed. */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.guide-card {
  display: flex; flex-direction: column; justify-content: space-between; min-width: 0; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 14%, transparent), transparent 55%), var(--surface);
  border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: 14px; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.guide-card:hover { border-color: color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 16px 40px -24px var(--c); transform: translateY(-2px); }
.guide-link { display: flex; gap: 14px; align-items: flex-start; padding: 18px 18px 10px; color: inherit; text-decoration: none; }
.guide-card-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.guide-card-title { font: 650 1.08rem/1.3 var(--font-display); overflow-wrap: anywhere; }
.guide-card-summary { color: var(--text-2); font-size: 0.9rem; }
.guide-card-foot { margin: 0; padding: 0 18px 14px; }
/* Who a document is for (lib/audience.mjs), and a public guide. */
.tag-who { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; }
.tag-who svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tag-public { background: var(--good-bg); color: var(--good-ink); border-color: transparent; }
.guide-card-foot .tag-who { margin-top: 0; }
.audience { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.form .audience label.af-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.guide-link-text { display: block; margin-top: 4px; overflow-wrap: anywhere; }
/* The layout switch on Documents: links as cards (grid), the full list (rows), or one line each (compact). */
body[data-layout="rows"] .guide-grid { grid-template-columns: 1fr; }
body[data-layout="compact"] .guide-grid { grid-template-columns: 1fr; gap: 8px; }
body[data-layout="compact"] .guide-grid .doc-tile { --size: 34px; }
body[data-layout="compact"] .guide-grid .doc-kind { display: none; }
body[data-layout="compact"] .guide-card-summary { display: none; }
body[data-layout="compact"] .guide-card { flex-direction: row; align-items: center; border-top-width: 1px; border-left: 4px solid var(--c); }
body[data-layout="compact"] .guide-card:hover { transform: none; }
body[data-layout="compact"] .guide-link { flex: 1; align-items: center; padding: 8px 14px; }
body[data-layout="compact"] .guide-card-foot { padding: 8px 14px; white-space: nowrap; }
.guide-bar { display: flex; flex-wrap: wrap; gap: 12px 20px; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; padding: 18px 22px; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, transparent), transparent 50%), var(--surface); }
.guide-bar h1 { margin: 0 0 4px; }
.guide-bar p { margin: 0; }
.guide-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.guide-share { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.guide-share input { flex: 1 1 320px; min-width: 0; font: 0.85rem var(--font-mono, monospace); padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); color: var(--text); }
.guide-frame { display: block; width: 100%; height: 80vh; border: 1px solid var(--border); border-radius: 14px; background: #fff; }

/* Signed-out pages (sign-in, setup): a full-screen scene behind a glass panel.
   Always dark, whatever the saved theme, so the scene reads the same for everyone. */
body.auth-scene {
  color-scheme: dark;
  --bg: #04050a; --bg-2: #070912; --surface: rgba(16, 20, 30, 0.62); --surface-2: rgba(24, 20, 40, 0.62);
  --border: rgba(180, 124, 245, 0.18); --border-strong: rgba(180, 124, 245, 0.32);
  --text: #f8fafc; --text-2: #cbd5e1; --muted: #a3acc0; --accent: #c89bff;
  --critical-ink: #fb8a8a; --critical-bg: rgba(239, 68, 68, 0.15);
  background: #04050a; overflow-x: hidden;
}
.auth-scene .top { background: rgba(4, 5, 10, 0.45); }
.auth-scene main { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; padding-top: 6vh; padding-bottom: 8vh; }
.auth-scene .legal { background: rgba(8, 10, 18, 0.82); backdrop-filter: blur(12px); border-color: rgba(180, 124, 245, 0.2); }
.auth-scene .foot { position: relative; z-index: 1; border-top-color: rgba(255, 255, 255, 0.06); background: rgba(4, 5, 10, 0.4); }
.backdrop { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: radial-gradient(ellipse 120% 70% at 50% 110%, #1a0b33 0%, #070912 55%, #04050a 100%); }

/* Aurora: four soft blobs drifting on long, out-of-step loops. */
.aurora { position: absolute; inset: -20%; filter: blur(70px) saturate(1.3); opacity: 0.85; }
.aurora i { position: absolute; border-radius: 50%; mix-blend-mode: screen; will-change: transform; }
.aurora i:nth-child(1) { width: 55vmax; height: 55vmax; left: 5%; top: 0%; background: radial-gradient(circle, color-mix(in srgb, var(--brand) 75%, transparent), transparent 65%); animation: aurora-a 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 48vmax; height: 48vmax; right: 0%; top: 10%; background: radial-gradient(circle, rgba(43, 155, 216, 0.5), transparent 65%); animation: aurora-b 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { width: 42vmax; height: 42vmax; left: 30%; top: 35%; background: radial-gradient(circle, rgba(224, 71, 154, 0.42), transparent 65%); animation: aurora-c 22s ease-in-out infinite alternate; }
.aurora i:nth-child(4) { width: 36vmax; height: 36vmax; left: -5%; bottom: 0%; background: radial-gradient(circle, color-mix(in srgb, var(--brand-deep) 60%, transparent), transparent 65%); animation: aurora-d 29s ease-in-out infinite alternate; }

/* A glowing horizon line, and a perspective grid floor sliding toward you. */
.horizon { position: absolute; left: -10%; right: -10%; top: 62%; height: 2px; background: linear-gradient(90deg, transparent, rgba(200, 155, 255, 0.9) 30%, #fff 50%, rgba(200, 155, 255, 0.9) 70%, transparent); box-shadow: 0 0 24px 4px color-mix(in srgb, var(--brand) 70%, transparent), 0 0 120px 30px color-mix(in srgb, var(--brand) 35%, transparent); animation: horizon-breathe 6s ease-in-out infinite; }
.floor {
  position: absolute; left: -50%; right: -50%; top: 62%; height: 80%;
  background-image: linear-gradient(rgba(180, 124, 245, 0.55) 1px, transparent 1px), linear-gradient(90deg, rgba(180, 124, 245, 0.45) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(380px) rotateX(62deg); transform-origin: top center;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 60%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 60%, transparent);
  animation: floor-run 2.4s linear infinite;
}
.net { position: absolute; inset: 0; width: 100%; height: 100%; }
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse 80% 70% at 50% 45%, transparent 40%, rgba(2, 3, 6, 0.75) 100%); }

/* The panel: frosted glass with a slowly turning purple-blue edge. */
.auth-scene .panel.narrow {
  position: relative; width: 100%; margin: 0 auto; padding: 30px 32px;
  background: linear-gradient(160deg, rgba(30, 22, 52, 0.72), rgba(10, 12, 20, 0.78));
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid transparent; border-radius: 20px;
  box-shadow: 0 40px 120px -30px color-mix(in srgb, var(--brand) 75%, transparent), 0 0 0 1px rgba(255, 255, 255, 0.04) inset, 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  animation: panel-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.auth-scene .panel.narrow::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--edge, 0deg), color-mix(in srgb, var(--brand) 15%, transparent), #b47cf5, #2b9bd8, color-mix(in srgb, var(--brand) 15%, transparent) 40%, color-mix(in srgb, var(--brand) 15%, transparent) 60%, #e0479a, color-mix(in srgb, var(--brand) 15%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: edge-turn 8s linear infinite;
}
.auth-scene .panel.narrow h1 { background: linear-gradient(90deg, #fff, #d8b4fe 60%, #93c5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-scene .panel.narrow input { background: rgba(4, 5, 10, 0.55); border-color: rgba(180, 124, 245, 0.25); color: var(--text); }
.auth-scene .panel.narrow input:focus { border-color: #b47cf5; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); outline: none; }
.auth-scene .panel.narrow .button { background: linear-gradient(135deg, #8a2ce2, #6d28d9 60%, #4f46e5); box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--brand) 90%, transparent); }
.auth-scene .panel.narrow .button:hover:not(:disabled) { filter: brightness(1.12); }
.auth-scene .alt-signin { border-top-color: rgba(255, 255, 255, 0.08); }

@property --edge { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes edge-turn { to { --edge: 360deg; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
@keyframes floor-run { to { background-position: 0 64px, 0 0; } }
@keyframes horizon-breathe { 50% { opacity: 0.65; } }
@keyframes aurora-a { to { transform: translate(18vw, 12vh) scale(1.15); } }
@keyframes aurora-b { to { transform: translate(-22vw, 18vh) scale(0.9); } }
@keyframes aurora-c { to { transform: translate(-12vw, -16vh) scale(1.25); } }
@keyframes aurora-d { to { transform: translate(25vw, -10vh) scale(1.1); } }
@media (max-width: 640px) {
  .auth-scene main { padding-top: 24px; align-items: flex-start; }
  .auth-scene .panel.narrow { padding: 22px 20px; }
  .floor { background-size: 44px 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .aurora i, .floor, .horizon, .auth-scene .panel.narrow, .auth-scene .panel.narrow::before { animation: none !important; }
}

/* Clients (lib/apps.mjs, lib/clients.mjs). A client's color is --c (their brand
   color, or a steady hue from their name); it tints their row and their page. */
.cmark {
  --size: 40px; flex: none; display: inline-grid; place-items: center; width: var(--size); height: var(--size);
  border-radius: calc(var(--size) * 0.26); overflow: hidden; position: relative;
}
.cmark-sm { --size: 24px; }
.cmark-md { --size: 40px; }
.cmark-lg { --size: 56px; }
.cmark-xl { --size: 96px; }
.cmark-logo { background: #fff; box-shadow: 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent), 0 10px 26px -14px var(--c); }
.cmark-logo img { width: 84%; height: 84%; object-fit: contain; display: block; }
.cmark-mono {
  color: #fff; font: 700 calc(var(--size) * 0.38) / 1 var(--font-display); letter-spacing: 0.02em;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 82%, #fff), color-mix(in srgb, var(--c) 78%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 26px -14px var(--c);
}
.client-cell { display: inline-flex; align-items: center; gap: 8px; }

.crows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.crow {
  position: relative; display: grid; align-items: center; gap: 18px; padding: 14px 18px 14px 22px; border-radius: 16px;
  grid-template-columns: auto minmax(160px, 1.3fr) minmax(150px, 1fr) minmax(140px, 1.2fr) minmax(110px, 0.8fr) minmax(100px, 0.7fr) minmax(100px, 0.7fr) auto;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 10%, var(--surface)), var(--surface) 45%);
  border: 1px solid var(--border); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.crow::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.crow:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--border)); box-shadow: 0 18px 40px -26px var(--c); transform: translateY(-1px); }
.crow:hover .tile-go { color: var(--accent); transform: translateX(3px); }
.crow-link { position: absolute; inset: 0; border-radius: 16px; z-index: 1; }
.crow-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.crow a:not(.crow-link) { position: relative; z-index: 2; }
.crow-id h2 { margin: 0 0 4px; font-size: 1.08rem; }
.crow-sub { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.85rem; }
.crow-web { color: var(--muted); text-decoration: none; }
.crow-web:hover { color: var(--accent); }
.crow-contact { display: flex; flex-direction: column; font-size: 0.85rem; min-width: 0; }
.crow-contact a { color: var(--text-2); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow-contact a:hover { color: var(--accent); }
.crow-apps { display: flex; flex-wrap: wrap; gap: 6px; }
.app-chip { font-size: 0.76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: var(--text-2); background: color-mix(in srgb, var(--c, var(--brand)) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c, var(--brand)) 35%, transparent); }
.crow-stat { display: flex; flex-direction: column; gap: 2px; }
.crow-num { font: 700 1.3rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.crow-k { font-size: 0.76rem; color: var(--muted); }
.crow-stat .dots { margin-top: 3px; }
.crow-go { display: flex; align-items: center; gap: 14px; }
.crow-edit { font-size: 0.85rem; }
.crow-when { white-space: nowrap; }
.crow-docs :is(.crow-docs-on, .crow-docs-off) { font-weight: 600; font-size: 0.92rem; }
.crow-docs .crow-docs-on { color: var(--good-ink); text-decoration: none; }
.crow-docs .crow-docs-on:hover { text-decoration: underline; }
.crow-docs-off { color: var(--muted); }
.web-card .mini-stats dt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.web-docs-on { color: var(--good-ink); text-decoration: none; white-space: nowrap; }
.web-docs-on:hover { text-decoration: underline; }
.web-docs-off { color: var(--muted); font-weight: 400; }
/* What a website is tied to: three labelled columns under its numbers; a missing one reads "None". */
.web-card .web-ties { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 8px; border-top: 1px dashed var(--border); }
.web-ties dd { min-width: 0; }
.web-tie { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: 0.86rem; line-height: 1.25; }
.web-tie-none { color: var(--muted); font-weight: 400; font-size: 0.86rem; }
/* Rows and compact: the ties are a column of their own beside the numbers, lined up
   down the list; narrower, they take a line of their own. */
body:is([data-layout="rows"], [data-layout="compact"]) .web-card .web-ties { border-top: 0; padding-top: 0; }
@media (min-width: 900px) {
  body:is([data-layout="rows"], [data-layout="compact"]) .web-card .web-ties { grid-column: 1 / -1; order: 4; }
}
@media (min-width: 1200px) {
  body[data-layout="rows"] .web-card { grid-template-columns: minmax(180px, 1.2fr) minmax(240px, 1.4fr) minmax(240px, 1.3fr) minmax(120px, 0.8fr) minmax(200px, 1.1fr); }
  body[data-layout="compact"] .web-card { grid-template-columns: minmax(200px, 1fr) minmax(280px, 1.5fr) minmax(240px, 1.3fr) minmax(180px, 1fr); }
  body:is([data-layout="rows"], [data-layout="compact"]) .web-card .web-ties { grid-column: auto; order: 0; }
}
@media (max-width: 1100px) {
  .crow { grid-template-columns: auto 1fr auto; gap: 8px 16px; }
  .crow-contact, .crow-apps { grid-column: 2 / -1; }
  .crow-stat { grid-column: 2; flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .crow-go { grid-row: 1; grid-column: 3; }
}

/* The client form's logo picker. */
.logo-field { display: flex; align-items: center; gap: 18px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 14px; }
.logo-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.logo-title { font-weight: 600; }
.form label.logo-pick { display: inline-flex; cursor: pointer; }
.logo-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.form .color-field input[type="color"] { width: 64px; height: 36px; padding: 2px; border-radius: 8px; cursor: pointer; }

/* A client's page: a hero in their color, headline numbers, charts, robots, then two columns. */
.client-hero {
  position: relative; overflow: hidden; isolation: isolate; margin-bottom: 18px; padding: 30px; border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--c) 40%, var(--border));
  background:
    radial-gradient(700px 300px at 0% 0%, color-mix(in srgb, var(--c) 38%, transparent), transparent 70%),
    radial-gradient(500px 260px at 100% 100%, color-mix(in srgb, var(--c) 18%, transparent), transparent 70%),
    var(--surface);
  box-shadow: 0 30px 60px -42px var(--c);
}
.client-hero-glow { position: absolute; right: -40px; top: 50%; translate: 0 -50%; width: 340px; height: 340px; z-index: -1; pointer-events: none; opacity: 0.09; filter: blur(2px) grayscale(0.2); }
.client-hero-glow img { width: 100%; height: 100%; object-fit: contain; }
.client-hero-main { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.client-hero-text { flex: 1 1 320px; min-width: 0; }
.client-hero-text .dash-date { color: color-mix(in srgb, var(--c) 70%, var(--text)); }
.client-hero h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin: 0 0 8px; }
.client-health { margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text-2); }
.client-health-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.client-hero-good .client-health-dot { background: var(--good); box-shadow: 0 0 0 4px var(--good-bg), 0 0 12px var(--good); animation: client-pulse 2.4s ease-in-out infinite; }
.client-hero-warn .client-health-dot { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-bg), 0 0 12px var(--warning); }
.client-hero-bad .client-health-dot { background: var(--critical); box-shadow: 0 0 0 4px var(--critical-bg), 0 0 12px var(--critical); animation: client-pulse 1.2s ease-in-out infinite; }
@keyframes client-pulse { 50% { opacity: 0.45; } }
.client-contacts { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.client-contacts li { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: 0.86rem; background: color-mix(in srgb, var(--surface-2) 80%, transparent); border: 1px solid var(--border); }
.client-contacts span { color: color-mix(in srgb, var(--c) 70%, var(--text)); }
.client-contacts a { color: var(--text); text-decoration: none; }
.client-contacts a:hover { color: var(--accent); }
.client-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-self: flex-start; }
.client-hero .cmark-xl { --size: 112px; }

.cstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; margin-bottom: 18px; }
.cstat {
  position: relative; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); transition: border-color 0.15s, transform 0.15s;
}
.cstat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; border-radius: 16px 16px 0 0; background: linear-gradient(90deg, var(--c), transparent); }
.cstat-good::before { background: linear-gradient(90deg, var(--good), transparent); }
.cstat-warn::before { background: linear-gradient(90deg, var(--warning), transparent); }
.cstat-bad::before { background: linear-gradient(90deg, var(--critical), transparent); }
.cstat:has(.tile-link):hover { border-color: color-mix(in srgb, var(--c) 55%, var(--border)); transform: translateY(-2px); }
.cstat-label { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.cstat-icon { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 0.8rem; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 85%, #fff), color-mix(in srgb, var(--c) 80%, #000)); }
.cstat-big { margin: 10px 0 2px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.cstat-num { font: 700 1.9rem/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cstat-good .cstat-num { color: var(--good-ink); }
.cstat-warn .cstat-num { color: var(--warning-ink); }
.cstat-bad .cstat-num { color: var(--critical-ink); }
.cstat-unit { color: var(--text-2); font-size: 0.85rem; }
.cstat-sub { margin: 0; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-page .viz-row { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.client-page .robots { margin-bottom: 18px; }
.viz-svg path.viz-col { fill: var(--viz-line); }
.viz-svg rect.viz-col-none { fill: var(--border-strong); }

.client-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.client-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1000px) { .client-grid { grid-template-columns: 1fr; } }
.cpanel { padding: 18px 20px; border-radius: 16px; border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface)); min-width: 0; }
.cpanel-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.cpanel-head > div { flex: 1; min-width: 0; }
.cpanel-head h2 { margin: 0; font-size: 1.02rem; }
.cpanel-more { font-size: 0.84rem; text-decoration: none; white-space: nowrap; }
.cpanel-more:hover { text-decoration: underline; }
.cpanel-acts { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 12px; }
.cpanel-acts .button { white-space: nowrap; }
.cempty { margin: 0; padding: 14px; border-radius: 12px; background: var(--bg); color: var(--muted); font-size: 0.9rem; }
.clist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.clist > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 0.9rem; }
.clist > li:first-child { border-top: 0; padding-top: 2px; }
.clist time { flex: none; font-size: 0.8rem; color: var(--muted); }
.clist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.clist-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.clist-meta { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cstatus { flex: none; width: 118px; font-size: 0.72rem; font-weight: 650; padding: 3px 8px; border-radius: 999px; text-align: center; background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.cstatus-warn { background: var(--warning-bg); color: var(--warning-ink); border-color: transparent; }
.cstatus-progress { background: var(--info-bg); color: var(--info-ink); border-color: transparent; }
.cstatus-hold, .cstatus-off { color: var(--muted); }
.cstatus-up { background: var(--good-bg); color: var(--good-ink); border-color: transparent; }
.cstatus-dismissed { color: var(--muted); text-decoration: line-through; }
/* The To-dos panel's status strip (lib/clients.mjs todoList). */
.ctodo-strip { margin-bottom: 12px; }
.ctodo-strip button[hidden], .clist > li[hidden] { display: none; }
.cmsg-av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 80%, #fff), color-mix(in srgb, var(--c) 75%, #000)); }
.cmsg-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tag-bad { background: var(--critical-bg); border-color: transparent; color: var(--critical-ink); }
.ctimeline { list-style: none; margin: 0 0 0 5px; padding: 0 0 0 16px; border-left: 2px solid color-mix(in srgb, var(--c) 45%, var(--border)); display: flex; flex-direction: column; gap: 12px; }
.ctimeline > li { position: relative; }
.ctimeline > li::before { content: ""; position: absolute; left: -22px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--surface); }
.ctl-day { margin: 0 0 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: color-mix(in srgb, var(--c) 65%, var(--text)); }
.ctimeline ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ctl-item { display: flex; gap: 10px; font-size: 0.88rem; }
.ctl-time { flex: none; width: 64px; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; padding-top: 1px; }
.cjob-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.cjob-fail .cjob-dot { background: var(--critical); box-shadow: 0 0 8px var(--critical); }
.cjob-side { flex: none; font-size: 0.8rem; color: var(--muted); display: flex; gap: 6px; }
.cmoney-big { margin: 0 0 8px; font: 700 1.8rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--good-ink); }
.cmoney-big .muted { font: 500 0.9rem var(--font); }
.cmoney-amt { flex: none; font-weight: 650; color: var(--good-ink); font-variant-numeric: tabular-nums; }
.cfeed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cfeed-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.87rem; }
.cfeed-list time { flex: none; font-size: 0.78rem; color: var(--muted); padding-top: 3px; }
.cfeed-icon { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 0.8rem; background: var(--bg); border: 1px solid var(--border); color: var(--text-2); }
.cfeed-good .cfeed-icon { background: var(--good-bg); color: var(--good-ink); border-color: transparent; }
.cfeed-warn .cfeed-icon { background: var(--warning-bg); color: var(--warning-ink); border-color: transparent; }
.cfeed-bad .cfeed-icon { background: var(--critical-bg); color: var(--critical-ink); border-color: transparent; }
.cfeed-list .clist-main { display: block; color: var(--text-2); padding-top: 3px; }
.cfeed-list .clist-main strong { color: var(--text); }
/* A website's setup checklist (lib/sitechecklist.mjs): one row per step, its findings under it. */
.wcheck-run { display: contents; }
.wcheck { margin-top: 16px; }
.cov-linked .cov-facts + h2 { margin-top: 18px; }
.cov-check { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cov-check li { display: flex; align-items: flex-start; gap: 10px; }
.cov-check .cfeed-icon { width: 24px; height: 24px; font-size: 0.75rem; }
.cov-check-text { font-size: 0.85rem; color: var(--text-2); }
.cov-check-all { padding: 0; }
.wcheck-list li { gap: 12px; }
.wcheck-text { min-width: 0; padding-top: 3px; }
.wcheck-text p { margin: 0 0 4px; color: var(--text-2); overflow-wrap: anywhere; }
.wcheck-text strong { color: var(--text); }
.wcheck-word { font-size: 0.75rem; color: var(--muted); margin-left: 6px; }
.wcheck-good .cfeed-icon { background: var(--good-bg); color: var(--good-ink); border-color: transparent; }
.wcheck-warn .cfeed-icon { background: var(--warning-bg); color: var(--warning-ink); border-color: transparent; }
.wcheck-bad .cfeed-icon { background: var(--critical-bg); color: var(--critical-ink); border-color: transparent; }
.wcheck-warn .wcheck-word { color: var(--warning-ink); }
.wcheck-bad .wcheck-word { color: var(--critical-ink); }
.cabout-list { margin: 0 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.cabout-list dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.cabout-list dd { margin: 2px 0 0; font-size: 0.9rem; }
.cnotes { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--bg); white-space: pre-wrap; font-size: 0.9rem; color: var(--text-2); border-left: 3px solid var(--c); }
.capps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.capp { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.capp-warn { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.capp-fail, .capp-down { border-color: color-mix(in srgb, var(--critical) 50%, var(--border)); }
.capp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.capp-head h3 { margin: 0 0 4px; font: 650 1rem/1.2 var(--font-display); text-transform: none; letter-spacing: 0; color: var(--text); }
.capp-links { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 0.8rem; color: var(--muted); }
.capp-links a { color: var(--text-2); text-decoration: none; }
.capp-links a:hover { color: var(--accent); }
.capp-edit { font-size: 0.82rem; }
.capp-server { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.capp-server-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.capp-server-head a { color: var(--text); text-decoration: none; }
.capp-server-head a:hover { color: var(--accent); }
.capp-stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; }
.capp-stats dt { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.capp-stats dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.capp .strip { height: 16px; }
.capp-noserver { margin: 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
@media (max-width: 640px) {
  .client-hero { padding: 20px; }
  .client-hero .cmark-xl { --size: 76px; }
  .cstatus { width: auto; }
  .ctodo { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .client-health-dot { animation: none !important; } }
.cmsg-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmsg-unread .cmsg-who strong::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: var(--info); vertical-align: middle; }
@media (min-width: 1000px) {
  .client-page .viz-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-page .viz-row > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Client page: linking existing apps and servers. */
.cform { margin: 0; }
.clinks { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--border-strong); }
.clink { display: flex; align-items: flex-end; gap: 8px; }
.clink label, .capp-pick label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.clink select, .capp-pick select { min-width: 190px; max-width: 100%; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 0.88rem; font-weight: 400; }
.capp-kind { margin: 0 0 2px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: color-mix(in srgb, var(--c) 65%, var(--muted)); }
.capp-unlink { font-size: 0.82rem; color: var(--muted); }
.capp-unlink:hover { color: var(--critical-ink); }
.capp-pick { display: flex; align-items: flex-end; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.capp-pick label { flex: 1; }
.capp-pick select { min-width: 0; width: 100%; }
.js-autosubmit [data-autosubmit-button] { display: none; }

/* Client page: money from them, a compact card above their apps. */
.cmoney-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 6px; }
.cmoney .cmoney-big { margin: 0; font-size: 1.6rem; }
.cmoney-bars { display: grid; grid-template-columns: repeat(6, 26px); gap: 6px; height: 64px; }
.cmoney-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 16px; height: 100%; }
.cmoney-fill { width: 100%; border-radius: 4px 4px 0 0; background: var(--viz-in); transition: filter 0.15s; }
.cmoney-col:hover .cmoney-fill { filter: brightness(1.2); }
.cmoney-col:last-child .cmoney-fill { background: var(--c); }
.cmoney-m { position: absolute; bottom: 0; font-size: 0.68rem; color: var(--muted); }
.cmoney .clist > li { padding: 6px 0; }

/* Client page: no task running for them, the robot docked and standing by. */
.robots-idle .idle-bay { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; padding: 6px 4px 2px; }
.idle-dock { position: relative; width: 120px; height: 120px; flex: none; display: grid; place-items: center; }
.idle-robot { position: relative; z-index: 1; width: 58px; margin-bottom: 18px; }
.idle-robot .robot-svg { animation: idle-float 3.2s ease-in-out infinite; }
.idle-robot .r-eye { animation: idle-blink 5.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.idle-robot .r-foot { animation: none; }
.idle-robot .r-core { animation: core-pulse 3.4s ease-in-out infinite; }
.idle-pad { position: absolute; left: 50%; bottom: 14px; width: 84px; height: 22px; margin-left: -42px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--c) 55%, transparent), transparent); }
.idle-pad i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--c) 70%, transparent); animation: idle-ring 3.2s ease-out infinite; }
.idle-pad i + i { animation-delay: 1.6s; }
.idle-text { flex: 1 1 260px; min-width: 0; }
.idle-title { margin: 0 0 2px; display: flex; align-items: center; gap: 10px; font: 650 1.15rem/1.2 var(--font-display); }
.idle-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px var(--good-bg), 0 0 10px var(--good); }
.idle-text > p.small { margin: 0 0 12px; }
.idle-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 18px; }
.idle-facts dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.idle-facts dd { margin: 2px 0 0; font-size: 0.88rem; }
.idle-facts time { color: var(--muted); }
@keyframes idle-float { 50% { transform: translateY(-4px); } }
@keyframes idle-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.15); } }
@keyframes idle-ring { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .idle-robot .robot-svg, .idle-robot .r-eye, .idle-robot .r-core, .idle-pad i { animation: none !important; }
}

/* Client page tabs: the big tiles pick what shows underneath them. */
.client-page .cstats { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); margin-bottom: 16px; }
a.cstat { display: flex; flex-direction: column; color: var(--text); text-decoration: none; cursor: pointer; }
a.cstat .cstat-label { display: flex; }
a.cstat .cstat-big { display: flex; }
a.cstat .cstat-sub { display: block; }
a.cstat:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--border)); transform: translateY(-2px); }
a.cstat:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
a.cstat[aria-current="page"] {
  border-color: var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, var(--surface-2)), var(--surface));
  box-shadow: 0 0 0 1px var(--c), 0 16px 34px -22px var(--c);
}
a.cstat[aria-current="page"] .cstat-label { color: var(--text); }
a.cstat[aria-current="page"]::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; margin-left: -7px; rotate: 45deg;
  background: var(--surface); border-right: 1px solid var(--c); border-bottom: 1px solid var(--c);
}
.ctab-panel { display: flex; flex-direction: column; gap: 16px; }
.ctab-panel.ctab-enter { animation: ctab-in 0.18s ease-out; }
.ctab-panel[hidden] { display: none; }
.ctab-row { display: grid; }
@keyframes ctab-in { from { opacity: 0; transform: translateY(4px); } }

/* The Overview tab: one card. */
.coverview { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; padding: 22px 24px; }
.coverview h2 { margin: 0 0 10px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-family: var(--font); font-weight: 650; }
.cov-side h2:not(:first-child) { margin-top: 18px; }
.cov-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cov-facts li + li { border-top: 1px solid var(--border); }
.cov-facts a { display: grid; grid-template-columns: 30px 92px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 6px; color: var(--text); text-decoration: none; border-radius: 10px; }
.cov-facts a:hover { background: color-mix(in srgb, var(--c) 10%, transparent); }
.cov-facts a:hover .cov-go { color: var(--accent); transform: translateX(3px); }
.cov-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 0.85rem; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 85%, #fff), color-mix(in srgb, var(--c) 80%, #000)); }
.cov-label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.cov-text { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cov-warn { color: var(--warning-ink); }
.cov-bad { color: var(--critical-ink); }
.cov-go { color: var(--muted); transition: transform 0.15s, color 0.15s; }
.cov-needs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.cov-clear { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--good-bg); color: var(--good-ink); font-weight: 600; }
.coverview .cnotes { margin-top: 2px; }
@media (max-width: 900px) {
  .coverview { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .cov-facts a { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .cov-label { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ctab-panel.ctab-enter { animation: none; } }
@media (min-width: 1180px) {
  .client-page .cstats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .client-page .cstat { padding: 14px 14px; }
  .client-page .cstat-num { font-size: 1.6rem; }
}

/* Settings → Agent access: the API guide. */
.api-docs { margin-top: 22px; }
.api-docs h3 { margin: 0 0 8px; font-size: 1rem; }
.api-body { font-size: 0.92rem; }
.api-body li { margin-bottom: 6px; }
.api-section { margin: 6px 0; }
.api-section > summary { margin-bottom: 6px; }
.api-section > summary .muted { font-size: 0.85rem; }
.api-code { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre; font-size: 0.85rem; margin: 6px 0 10px; }
.api-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.api-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.api-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.api-table td:first-child { white-space: nowrap; }
.api-fields td:nth-child(2) { white-space: nowrap; overflow-wrap: normal; color: var(--text-2); }
@media (max-width: 600px) { .api-table td:first-child { white-space: normal; } }
/* At a glance: the Documents row (their Google Drive folder). */
.cov-facts .cov-row { display: grid; grid-template-columns: 30px 92px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 6px; }
.cov-none { color: var(--muted); font-weight: 500; }
@media (max-width: 520px) { .cov-facts .cov-row { grid-template-columns: 30px minmax(0, 1fr) auto; } }
/* Client page: Activity's feed and chart side by side; the link pickers behind a toggle. */
.ctab-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.ctab-two > * { margin: 0; }
@media (max-width: 900px) { .ctab-two { grid-template-columns: 1fr; } }
.clinks-toggle { margin: 0 0 14px; }
.clinks-toggle > summary {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; padding: 7px 14px; border-radius: 999px;
  font-size: 0.86rem; font-weight: 600; color: var(--text-2); background: var(--bg); border: 1px dashed var(--border-strong);
}
.clinks-toggle > summary::-webkit-details-marker { display: none; }
.clinks-toggle > summary::before { content: "+"; font-weight: 700; color: var(--c); }
.clinks-toggle[open] > summary::before { content: "−"; }
.clinks-toggle > summary:hover { color: var(--text); border-color: var(--c); }
.clinks-toggle > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.clinks-toggle .clinks { margin: 10px 0 0; }
.clink optgroup { font-style: normal; }
.clink-none { flex-direction: column; align-items: flex-start; gap: 4px; max-width: 320px; }
.clink-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }

/* Company logos on Accounts, Applications and Partners (lib/siteicons.mjs): initials
   on a color, and the site's own icon over them on a white tile once it loads. */
.name-cell { display: inline-flex; align-items: center; gap: 10px; }
.sicon > span { transition: opacity 0.2s; }
.sicon-img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 15%; box-sizing: border-box; object-fit: contain; background: #fff; opacity: 0; transition: opacity 0.2s; }
.sicon.has-logo { box-shadow: 0 0 0 1px var(--border-strong); }
.sicon.has-logo .sicon-img { opacity: 1; }
.sicon.has-logo > span { opacity: 0; }
.sicon-round { border-radius: 50%; }
.icon-link { display: inline-flex; align-items: center; gap: 6px; }
.cell-icon { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; opacity: 0.8; }

/* An application's page (lib/appview.mjs): the client page's hero and tiles, plus
   Links & docs tiles and the About it facts. */
.app-hero .cmark-xl { --size: 112px; }
.app-hero .sicon-img { padding: 14%; }
.app-hero-tags { margin: 10px 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.app-hero-client { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.app-hero-client a { color: var(--text); text-decoration: none; }
.app-hero-client a:hover { color: var(--accent); }
.app-hero .client-hero-actions { align-items: center; }
.alinks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.alinks-h { margin: 20px 0 10px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-family: var(--font); font-weight: 650; }
.alink {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; min-width: 0;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
a.alink:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--border)); transform: translateY(-2px); box-shadow: 0 16px 30px -22px var(--c); }
a.alink:hover .alink-go { color: var(--accent); transform: translate(2px, -2px); }
.alink .cmark-md { --size: 40px; }
.alink-icon { width: 40px; height: 40px; border-radius: 11px; font-size: 1.05rem; flex: none; }
.alink-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.alink-kind { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 650; }
.alink-text strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alink-host { font-size: 0.8rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alink-go { flex: none; color: var(--muted); transition: transform 0.15s, color 0.15s; }
.alink-none { border-style: dashed; background: transparent; }
.alink-none .alink-icon { filter: grayscale(0.7); opacity: 0.6; }
.alink-none strong { color: var(--text-2); font-weight: 600; }
.adetails { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 0 18px; }
.adetails > div { padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.adetails dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.adetails .wlogin { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; user-select: all; }
.adetails [data-show-password] { color: var(--accent); }
.adetails dd { margin: 3px 0 0; font-size: 0.92rem; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; overflow-wrap: anywhere; }
.adetail-add { font-size: 0.85rem; }
.adetail-add::before { content: "+ "; }
a.app-open { color: var(--text); text-decoration: none; }
a.app-open:hover strong { color: var(--accent); text-decoration: underline; }

/* The app and client forms: full width, numbered groups in two columns (one on narrow screens). */
.panel.app-form { margin: 8px 0 40px; }
/* The columns line up row by row: each group matches the one beside it, and a
   column with fewer groups stretches its last one (--rows: the longer column's count). */
.af-cols, .af-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.af-group { display: flex; flex-direction: column; }
.af-group > .logo-field + label { margin-top: 14px; }
.af-group > label:has(textarea) { flex: 1; }
.af-group > label > textarea { flex: 1; }
@media (min-width: 1001px) {
  .af-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 1), auto); }
  .af-col { display: grid; grid-row: 1 / -1; grid-template-rows: subgrid; }
  .af-col > :last-child:nth-child(1) { grid-row: 1 / -1; }
  .af-col > :last-child:nth-child(2) { grid-row: 2 / -1; }
  .af-col > :last-child:nth-child(3) { grid-row: 3 / -1; }
}
.af-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.af-head h1 { margin: 0 0 4px; }
.af-head p { margin: 0; }
.form.af { gap: 18px; }
.af-group { margin: 0; padding: 16px 18px 18px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); min-width: 0; }
.af-group legend { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-weight: 700; font-size: 0.95rem; }
.af-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; color: #fff; background: var(--brand); }
.af-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.af-grid .af-wide { grid-column: 1 / -1; }
.af-sub { display: block; margin: 16px 0 8px; font-weight: 600; font-size: 0.9rem; }
.af-links { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.af-links .af-sub { margin-bottom: 0; }
.af-link { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: 8px; }
.af-link[hidden] { display: none; }
.af-link-head { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.af-describe { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: -4px; }
.af-describe .button[disabled] { opacity: 0.6; cursor: progress; }
/* Generate's panel: what to focus on, and how long. */
.describe-panel { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.describe-panel textarea { width: 100%; }
.describe-lengths { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.describe-lengths legend { padding: 0; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
.form .describe-length { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--text) 22%, transparent); border-radius: 10px; cursor: pointer; }
.form .describe-length input { width: auto; margin: 0; }
.describe-length:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.describe-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.describe-actions .button[disabled] { opacity: 0.6; cursor: progress; }
.af-links [data-link-more] { align-self: flex-start; }
.af-links [data-link-more][hidden] { display: none; }
/* Client form: social pages and other websites under Website, a row each once added. */
.client-links { gap: 8px; }
.af-link.client-link { grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) auto; align-items: center; }
.link-remove { width: 30px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.link-remove:hover, .link-remove:focus-visible { color: var(--critical-ink); border-color: currentColor; }
.link-more { padding: 2px 0; border: 0; background: none; color: var(--brand); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.link-more:hover, .link-more:focus-visible { text-decoration: underline; }
.af-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.form label.af-check { gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; }
.form label.af-check:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--bg)); }
.af-check .cmark-sm { --size: 26px; }
.af-group textarea { width: 100%; box-sizing: border-box; }
@media (max-width: 640px) {
  .af-grid { grid-template-columns: 1fr; }
  .af-link { grid-template-columns: 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .af-link-head { display: none; }
  .af-link.client-link { grid-template-columns: minmax(0, 1fr) auto; padding-bottom: 0; border-bottom: 0; }
  .af-link.client-link > input[name$="Label"] { grid-row: 2; }
  .af-group { padding: 12px; }
}
/* Client page: the Documents tab (their Google Drive folder). */
.cdocs { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.cdocs th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.cdocs td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.cdocs tr:last-child td { border-bottom: 0; }
.cdocs td:first-child { width: 100%; white-space: normal; }
.cdocs tbody tr:hover { background: color-mix(in srgb, var(--c) 7%, transparent); }
.cdoc-name { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.cdoc-name:hover span:last-child { color: var(--accent); text-decoration: underline; }
/* The name on the left, its client/app badges on the same row at the far right (they wrap under it when narrow). */
.cdoc-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.cdoc-owners { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 6px; margin-left: auto; }
.cdoc-owners .tag { text-decoration: none; border-radius: 8px; }
.cdoc-owners .tag:hover { color: var(--accent); border-color: var(--accent); }
.cdocs td.cdoc-pin { padding: 4px 6px; text-align: right; }
.pin-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.pin-btn { opacity: 0.55; }
.cdocs tr:hover .pin-btn, .pin-btn:focus-visible { opacity: 1; }
.pin-btn.pinned { opacity: 1; color: #e0a400; }
.pin-btn.pinned svg { fill: currentColor; }
.drive-match { margin-top: 18px; }
.drive-match p { margin: 0 0 6px; }
.cdoc-kind { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 0.72rem; font-weight: 800; color: #fff; background: #64748b; }
.cdoc-kind svg { width: 16px; height: 16px; }
.cdoc-folder { background: #8a8f9c; }
.cdoc-shortcut { background: #5f6b7a; }
.cdoc-doc { background: #2f6fde; }
.cdoc-sheet { background: #1e8e4e; }
.cdoc-slides { background: #e0a400; }
.cdoc-pdf { background: #d93a2b; }
.cdoc-form { background: #7248b9; }
.cdoc-image { background: #c2417e; }
.cdoc-video { background: #b5305a; }
.cdoc-audio { background: #0f8b8d; }
.cdoc-archive { background: #8a6a3a; }
.cdoc-text { background: #4b5563; }
.cdocs-panel .cpanel-more.button, .cdocs-panel .cpanel-head .button { white-space: nowrap; }

/* Email reports (the envelope icon): the list, the form's day picks, the example. */
.report-failed { color: var(--critical-ink); }
.report-kind label.check { align-items: flex-start; }
.report-kind input { margin-top: 4px; }
.report-kind a { color: var(--accent); }
.day-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.day-presets { margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.reports-kinds-head { margin: 28px 0 4px; font-size: 1rem; }
.report-kinds dt { font-weight: 600; margin-top: 10px; }
.report-kinds dd { margin: 2px 0 0; }
.report-preview { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; font-size: 0.88rem; line-height: 1.5; overflow-x: auto; }

/* The pencil on an outside site's card (Websites): its edit panel's own summary hides once app.js runs. */
.mini-foot .foot-end { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; text-align: right; }
.mini-foot .foot-end .small { margin-left: 0; }
.mini-foot .foot-times { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.35; }
.edit-toggle { display: inline-grid; flex: none; place-items: center; width: 28px; height: 28px; margin-right: -6px; padding: 0; border-radius: 7px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.edit-toggle:hover, .edit-toggle[aria-expanded="true"] { color: var(--text); background: var(--bg); border-color: var(--border); }
.edit-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.edit-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }

/* Websites: each card leads with the site's icon (or a browser window). */
.site-head { align-items: center; gap: 12px; }
.site-head .site-name { flex: 1; min-width: 0; }
.sicon-webtile > span { display: grid; place-items: center; width: 100%; height: 100%; }
.sicon-web { width: 58%; height: 58%; fill: none; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
/* Documents: a tile per kind (Doc, Sheet, Slides, PDF, folder), and the Drive box. */
.doc-tile { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 85%, #fff), color-mix(in srgb, var(--c) 80%, #000)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 10px 26px -14px var(--c); align-content: center; }
.doc-tile svg { width: calc(var(--size) * 0.44); height: calc(var(--size) * 0.44); fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.doc-kind { font: 700 0.62rem/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; }
/* The Applications list: one card per app, like a site on the Websites tab.
   Every card has the same six parts (head, numbers, strip, facts, health,
   foot): in Grid they sit on shared rows (subgrid), so a row of cards lines
   up; One per row and Compact give them fixed columns, so cards line up down the page. */
.app-card.card-fail { border-color: var(--critical); }
.app-card .mini-reasons { margin: 0; }
.app-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.app-facts dd { font-size: 0.84rem; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-facts dd a { color: var(--text); text-decoration: none; }
.app-facts dd a:hover { color: var(--accent); }
.app-facts dd .muted { font-weight: 400; }
.app-facts .tag, .app-status .tag { font-size: 0.72rem; }
.app-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-linked { display: flex; gap: 4px; }
.link-mark { font-size: 0.68rem; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 999px; border: 1px dashed var(--border); color: var(--muted); text-decoration: none; white-space: nowrap; }
.link-mark.is-on { border: 1px solid transparent; background: var(--good-bg); color: var(--good-ink); }
.link-mark.is-on::before { content: "✓ "; }
a.link-mark.is-on:hover { border-color: var(--good); }
.app-health { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.app-health-k { margin: 0; }
.app-card .app-metrics { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.app-card .app-metrics dd { font-size: 0.92rem; }
body[data-layout="rows"] .app-card .app-metrics { flex: 1 1 100%; }
body[data-layout="compact"] .app-card .app-metrics { display: none; }
.app-health .lights { gap: 4px; }
.app-health .light { font-size: 0.74rem; padding: 1px 8px; }
.app-nohealth a { color: var(--accent); }
.app-foot { padding-top: 8px; border-top: 1px solid var(--border); flex-wrap: nowrap; }
.app-foot > .small { margin-left: 0; }
body[data-layout="grid"] .app-cards .app-card { display: grid; grid-row: span 6; grid-template-rows: subgrid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; }
body[data-layout="grid"] .app-cards .app-foot { align-self: end; }
@media (min-width: 900px) {
  body[data-layout="rows"] .app-cards .app-card,
  body[data-layout="compact"] .app-cards .app-card { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.8fr) minmax(0, 1.4fr) minmax(0, 0.8fr) 130px; align-items: center; gap: 10px 20px; }
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .host { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal; }
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .mini-stats dt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body[data-layout="rows"] .app-card .app-facts,
  body[data-layout="compact"] .app-card .app-facts { order: 1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; padding-top: 0; border-top: 0; }
  body[data-layout="rows"] .app-card .app-strip { order: 2; }
  body[data-layout="rows"] .app-card .app-foot,
  body[data-layout="compact"] .app-card .app-foot { order: 3; flex-direction: column; align-items: flex-end; gap: 2px; padding-top: 0; border-top: 0; text-align: right; }
  body[data-layout="rows"] .app-card .app-health { order: 4; grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding-top: 8px; border-top: 1px solid var(--border); }
  body[data-layout="compact"] .app-cards .app-card { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.8fr) minmax(0, 1.4fr) 130px; }
  body[data-layout="compact"] .app-card .app-health { order: 4; grid-column: 1 / -1; }
}
/* Not wide enough for five columns: two lines, still in columns. Name and
   numbers on top, the strip and facts under them, links and pencil at the end. */
@media (min-width: 900px) and (max-width: 1199px) {
  body:is([data-layout="rows"], [data-layout="compact"]) .app-cards .app-card { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr) 130px; }
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .mini-head { grid-area: 1 / 1; }
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .mini-stats:not(.app-facts) { grid-area: 1 / 2; }
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .app-foot { grid-area: 1 / 3 / span 2 / 4; }
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .app-strip { grid-area: 2 / 1; }
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .app-facts { grid-area: 2 / 2; }
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .app-health { grid-area: 3 / 1 / 4 / -1; }
}
@media (min-width: 900px) {
  body:is([data-layout="rows"], [data-layout="compact"]) .app-card .app-facts.has-worker { grid-template-columns: repeat(3, minmax(0, 1fr)) max-content; }
}
@media (min-width: 1200px) {
  body[data-layout="rows"] .app-cards .app-card:has(.has-worker) { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.7fr) minmax(0, 1.9fr) minmax(0, 0.7fr) 130px; }
  body[data-layout="compact"] .app-cards .app-card:has(.has-worker) { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.7fr) minmax(0, 1.9fr) 130px; }
}
/* One per row: the health line leads, and its checks and any warning fold out
   from the arrow at its end (app.js). The other layouts always show them. */
.app-health-more { display: none; }
body[data-layout="rows"] .app-health-more { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 4px; padding: 0; vertical-align: middle; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text-2); font-size: 0.8rem; line-height: 1; cursor: pointer; }
body[data-layout="rows"] .app-health-more:hover { color: var(--text); border-color: var(--accent); }
body[data-layout="rows"] .app-health-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
body[data-layout="rows"] .app-health-more span { transition: transform 0.15s; }
body[data-layout="rows"] .app-health-more[aria-expanded="true"] span { transform: rotate(90deg); }
body[data-layout="rows"] .app-card .app-health-k { order: -1; }
body[data-layout="rows"] .app-card .app-health:not(.is-open) :is(.mini-reasons, .lights) { display: none; }
body[data-layout="compact"] .app-card :is(.app-strip, .app-health-k, .lights) { display: none; }
body[data-layout="compact"] .app-card .app-health:not(:has(.mini-reasons)) { display: none; }
.apps-page .notice { margin-bottom: 10px; }

/* Email reports: the report and report-type forms use the full width, with the example beside them. */
.report-edit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.report-edit > .panel { margin: 0; }
.report-example h2 { margin: 0 0 4px; font-size: 1rem; }
@media (max-width: 900px) { .report-edit { grid-template-columns: 1fr; } }
.report-types { margin-top: 18px; }
.report-types .panel-head h2 { margin: 0; }


/* Clients and Applications lists (.crows) follow the layout switch. One per row
   is the rows above; grid makes each a card; compact keeps one tight line. */
body[data-layout="grid"] .crows { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
body[data-layout="grid"] .crow { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; align-content: start; gap: 12px 14px; padding: 16px 18px 16px 22px; }
body[data-layout="grid"] .crow > :is(.crow-contact, .crow-apps, .crow-stat) { grid-column: 1 / -1; }
body[data-layout="grid"] .crow-go { grid-row: 1; grid-column: 3; }
body[data-layout="grid"] .crow-stat { flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
body[data-layout="grid"] .crow-stat + .crow-stat { border-top: 0; padding-top: 0; margin-top: -6px; }
body[data-layout="compact"] .crows { gap: 6px; }
body[data-layout="compact"] .crow { padding: 8px 16px 8px 20px; gap: 14px; border-radius: 12px; }
body[data-layout="compact"] .crow::before { top: 8px; bottom: 8px; }
body[data-layout="compact"] .crow .cmark { --size: 34px; }
body[data-layout="compact"] .crow-id h2 { font-size: 0.98rem; margin: 0; }
body[data-layout="compact"] :is(.crow-apps, .crow-stat .dots, .crow-contact > :not(:first-child)) { display: none; }
body[data-layout="compact"] .crow-stat { flex-direction: row; align-items: baseline; gap: 6px; }
body[data-layout="compact"] .crow-num { font-size: 1rem; }
@media (min-width: 1101px) {
  body[data-layout="compact"] .crow { grid-template-columns: auto minmax(200px, 1.4fr) minmax(150px, 1fr); grid-auto-flow: column; grid-auto-columns: minmax(120px, 0.7fr); }
  body[data-layout="compact"] .crow-go { justify-self: end; }
}

/* A website's page (lib/websitepage.mjs): the app page's hero and tiles, plus the
   day in numbers, the certificate gauge and the check log. */
.web-hero .sicon-webtile .sicon-web { width: 54%; height: 54%; }
.wnums { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.wnums > div { padding: 14px 16px; border-radius: 14px; background: var(--bg); border: 1px solid var(--border); }
.wnums dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.wnums dd { margin: 6px 0 0; font: 700 1.7rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.wnums dd span { font: 500 0.85rem var(--font); color: var(--text-2); }
.wnums dd.wnums-small { font-size: 1.05rem; padding-top: 6px; }
.wspeed p, .wcert p { margin: 12px 0 0; }
.wcert-big { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.wcert-num { font: 700 3rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.wcert-unit { color: var(--text-2); font-weight: 600; }
.wcert-good .wcert-num { color: var(--good-ink); }
.wcert-warn .wcert-num { color: var(--warning-ink); }
.wcert-bad .wcert-num { color: var(--critical-ink); }
.wcert-bar { height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; margin-bottom: 16px; }
.wcert-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--good), color-mix(in srgb, var(--good) 60%, var(--c))); }
.wcert-warn .wcert-bar span { background: var(--warning); }
.wchecks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px 18px; }
button.alink { font: inherit; text-align: left; cursor: pointer; width: 100%; }
button.alink:hover { border-color: var(--c); }
.mini-head .host { color: var(--muted); text-decoration: none; }
.mini-head .host:hover { color: var(--accent); }

/* A server's page (lib/serverpage.mjs): round gauges for the machine, and the
   week's strip and sparkline at full width. */
.sgauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 14px; margin-bottom: 14px; }
.sgauge { padding: 16px 12px 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--border); text-align: center; }
.sgauge svg { width: min(130px, 100%); height: auto; display: block; margin: 0 auto; }
.sgauge-track { fill: none; stroke: var(--border); stroke-width: 9; }
.sgauge-fill { fill: none; stroke: var(--good); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray 0.4s; }
.sgauge-warn .sgauge-fill { stroke: var(--warning); }
.sgauge-num { font: 700 20px var(--font-display); fill: var(--text); }
.sgauge-label { margin: 8px 0 0; font-weight: 650; }
.sgauge-sub { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); }
.wnums-row { margin-top: 14px; }
.wspark .spark, .wspark svg { width: 100%; }
.wspark svg { height: 110px; }
.wweek .strip { height: 34px; }
.sreport-more .report-grid { margin: 0; }
.server-page .lights { margin: 0 0 12px; }
/* A website card on the Websites tab opens the site's dashboard page; its
   address, links and edit pencil sit above that and still do their own thing. */
.web-card { position: relative; cursor: pointer; }
.web-card:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: 0 14px 30px -22px var(--brand); }
.web-card-link { position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.web-card-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.web-card a:not(.web-card-link), .web-card button, .web-card details, .web-card summary { position: relative; z-index: 2; }
/* User logins (lib/people.mjs): a row per person (the Settings .conn rows) that opens to
   what they can open; the edit page is full width, their details on the left and what
   they can open on the right. */
.urow > summary .cmark-md { flex: none; }
.urow > summary strong { overflow-wrap: anywhere; }
.urow-seen { flex: none; white-space: nowrap; }
.urow-label { margin: 10px 0 4px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; font-weight: 600; }
.urow .actions { margin-top: 14px; }
@media (max-width: 600px) { .urow-seen { display: none; } }
.perms { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.perm { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 0.8rem; color: var(--text); background: color-mix(in srgb, var(--brand) 12%, var(--bg)); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border)); }
.perm-icon { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.perm-view { background: var(--bg); border-color: var(--border); color: var(--text-2); }
.perm-view .perm-icon { stroke: var(--muted); }
.perm-none { background: color-mix(in srgb, var(--critical) 9%, var(--bg)); border-color: color-mix(in srgb, var(--critical) 28%, var(--border)); color: var(--text-2); }
.perm-none .perm-icon { stroke: var(--critical-ink); opacity: 0.8; }
.perm-none .perm-note { color: var(--critical-ink); }
.perm-full .perm-note { color: var(--accent); }
.perm-note { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
/* An opened person's permissions: every row in the same order on the same even grid. */
.urow .perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 6px; }
.urow .perm { min-width: 0; white-space: nowrap; }
.urow .perm-note { margin-left: auto; flex: none; padding-left: 4px; }
.perm-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.panel.user-form { margin: 24px 0 40px; }
.uf-head { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.uf-head h1 { margin: 0 0 4px; }
.uf-head p { margin: 0; }
.uf-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 20px; align-items: stretch; }
.uf-group { margin: 0; padding: 16px 18px 18px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-2) 60%, transparent); min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.uf-group legend { padding: 0 6px; font-weight: 700; font-size: 0.95rem; }
.uf-group p { margin: 0; }
.uf select, .uf textarea { font: inherit; font-weight: 400; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.uf textarea { resize: vertical; }
.uf select:focus, .uf textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.uf .access-level select { padding: 7px 4px; }
@media (max-width: 1200px) { .uf-cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .uf-head .cmark-xl { --size: 72px; }
}

/* Email reports: the example email, as it arrives (framed) or as its plain text. */
.mail-views { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.mail-views .seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px; background: var(--bg); }
.mail-views .seg-btn { border: 0; background: none; color: var(--text-2); font: inherit; font-size: 0.85rem; font-weight: 600; padding: 4px 14px; border-radius: 999px; cursor: pointer; }
.mail-views .seg-btn[aria-pressed="true"] { background: var(--brand); color: #fff; }
.mail-views a { color: var(--accent); }
.mail-frame { display: block; width: 100%; height: 900px; border: 1px solid var(--border); border-radius: 12px; background: #f4f3f8; }
/* Overview card's third column: what the client has from us, a little card each. */
.coverview { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1200px) {
  .coverview { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .cov-has { grid-column: 1 / -1; }
}
@media (max-width: 900px) { .coverview { grid-template-columns: 1fr; } }
.cov-about-text { margin: 0; font-size: 0.875rem; line-height: 1.5; color: var(--text); }
.cov-about-text + .cov-about-text { margin-top: 0.8em; }
.cov-about-more { margin-top: 0.4em; }
.cov-about-more > summary { display: inline-block; list-style: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.cov-about-more > summary::-webkit-details-marker { display: none; }
.cov-about-more > summary::after { content: " ▾"; }
.cov-about-more[open] > summary { font-size: 0; }
.cov-about-more[open] > summary::before { content: "Show less"; font-size: 0.85rem; }
.cov-about-more[open] > summary::after { content: " ▴"; font-size: 0.85rem; }
.cov-about-more > summary:hover { text-decoration: underline; }
.cov-about-more > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.cov-about-more > .cov-about-text { margin-top: 0.8em; }
/* A website's About tab: two little tabs, About and What the AI knows. */
.wsub-tabs { display: inline-flex; gap: 4px; margin: 0 0 14px; padding: 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.wsub-tabs button { padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.wsub-tabs button:hover { color: var(--text); }
.wsub-tabs button[aria-selected="true"] { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--text); }
.wsub-tabs button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.wdossier .cal-facts-list { gap: 12px; }
.wdossier .cal-facts-list dd { font-size: 0.95rem; }
.wdesc-form { margin-top: 14px; }
.wdesc-form textarea { width: 100%; }
.cov-has-sum { margin: -4px 0 10px; font-size: 0.85rem; color: var(--text-2); }
.holds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
a.hold {
  display: flex; flex-direction: column; gap: 3px; height: 100%; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--c); transition: border-color 0.15s, transform 0.15s;
}
a.hold:hover { border-color: color-mix(in srgb, var(--c) 60%, var(--border)); transform: translateY(-1px); }
.hold-type { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: color-mix(in srgb, var(--c) 65%, var(--muted)); }
.hold-name { font-weight: 650; font-size: 0.92rem; line-height: 1.25; overflow-wrap: anywhere; }
.hold-line { display: flex; align-items: center; gap: 5px; font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hold-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.hold-up { background: var(--good); }
.hold-warn { background: var(--warning); }
.hold-down { background: var(--critical); }
/* What they have: one card per row, the full width of the column, each a single line
   (type and name on the left, health and address on the right). */
.holds { grid-template-columns: minmax(0, 1fr); gap: 6px; }
a.hold { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 12px; }
a.hold .hold-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
a.hold .hold-type { white-space: nowrap; }
a.hold .hold-line { justify-content: flex-end; max-width: 100%; }
@media (max-width: 520px) {
  a.hold { grid-template-columns: minmax(0, 1fr) auto; }
  a.hold .hold-type { grid-column: 1 / -1; }
}

/* A wide response chart (a website's or server's Speed tab): the short 1200 x 150
   drawing on wider screens, the usual shape on phones. */
.viz-svg.viz-wide { display: none; }
@media (min-width: 800px) {
  .viz-svg.viz-narrow { display: none; }
  .viz-svg.viz-wide { display: block; max-height: 170px; }
}

/* A website's overview: a third column with what it's linked to (client, app, server). */
.web-page .coverview { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 0.9fr); }
.cov-linked .cov-facts :is(a, .cov-row) { grid-template-columns: 30px minmax(0, 1fr) auto; }
.cov-linked .cmark { justify-self: center; }
.cov-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cov-stack .cov-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cov-stack .cov-text { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
@media (max-width: 1100px) { .web-page .coverview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .web-page .cov-linked { grid-column: 1 / -1; } }
@media (max-width: 760px) { .web-page .coverview { grid-template-columns: 1fr; } }

/* What they have: a view icon to the right of each card, opening that item's own page. */
.holds .hold-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: stretch; }
.hold-view {
  display: grid; place-items: center; width: 36px; border-radius: 10px; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border); transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.hold-view:hover { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--bg)); }
.hold-view:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Customer dashboard only (lib/people.mjs): the client picker shows and the rest of the access fades while it's ticked. */
.access-customer { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--border-strong); }
.access-customer:has(input[name="customer"]:checked) { border-style: solid; border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.access:has(input[name="customer"]:checked) .access-staff { opacity: 0.35; pointer-events: none; }
.access-staff { display: flex; flex-direction: column; gap: 10px; transition: opacity 0.15s; }
.perm-customer { background: color-mix(in srgb, var(--good, #10b981) 14%, var(--bg)); border-color: color-mix(in srgb, var(--good, #10b981) 40%, var(--border)); }

/* Email reports: the reports on the left half, the report types on the right, always the same height. */
.reports-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.reports-cols > .panel { margin: 0; min-width: 0; }
@media (max-width: 1000px) { .reports-cols { grid-template-columns: minmax(0, 1fr); } }

/* User logins: the position toggles over the rows. A hidden row's neighbours keep one line between them. */
.users-strip { margin: 4px 0 12px; }
.urows > .urow[hidden] { display: none; }
.urows > .urow { border-top: 0; }
.urows > .urow:not([hidden]) ~ .urow:not([hidden]) { border-top: 1px solid var(--border); }
.urows:not(:has(> .urow:not([hidden]))) { display: none; }
/* What the permission colors mean, above the rows. */
.perm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }

/* Finances: Summary and Transactions tabs, and the transaction list (lib/finances.mjs). */
.fin-tabs { display: flex; margin: 0 0 14px; }
.fin-tabs .seg { padding: 7px 16px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.fin-tabs .seg[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.fin-tabs .count { font-size: 0.75rem; padding: 0 7px; border-radius: 999px; background: rgba(127, 127, 127, 0.22); }
.fin-tx { margin-top: 0; }
.fin-tx-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.fin-tx-filter input[type="search"], .fin-tx-filter select, .fin-tx-filter input[type="date"] {
  font: inherit; padding: 8px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.fin-tx-filter input[type="search"] { flex: 1 1 240px; min-width: 0; }
.fin-tx-filter .button { padding-top: 7px; padding-bottom: 7px; }
/* A money bar's breakdown (lib/moneybreakdown.mjs): its total and month arrows, then the view and in/out toggles. */
.fin-bd-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px 16px; }
.fin-bd-head h1 { margin: 0; }
.fin-bd-switch { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 16px; }
.fin-bd-h { font-size: 0.95rem; margin: 18px 0 8px; }
/* The Register's own dates, under its account and period menus. */
.fin-register-days { margin-top: -6px; }
.fin-register-days label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--text-2); }
.fin-tx-add { margin-left: auto; font-weight: 650; color: var(--accent); text-decoration: none; white-space: nowrap; }
.fin-tx-add:hover { text-decoration: underline; }
.fin-tx-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.fin-tx-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.fin-tx-table th, .fin-tx-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.fin-tx-table thead th { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
.fin-tx-table tbody tr:hover td { background: var(--surface-2); }
.fin-tx-table tfoot th { border-bottom: 0; border-top: 2px solid var(--border-strong); font-weight: 650; background: var(--surface-2); }
.fin-tx-date { white-space: nowrap; color: var(--text-2); }
.fin-tx-name { display: block; font-weight: 600; }
.fin-tx-detail { display: block; font-size: 0.82rem; color: var(--muted); }
.fin-tx-acct { display: block; margin-top: 2px; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.fin-tx-num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 650; }
.fin-tx-amt-in { color: var(--money-in); }
.fin-tx-amt-out { color: var(--money-out); }
.fin-tx-act { text-align: right; white-space: nowrap; }
.fin-tx-act .fin-edit { margin-left: 0; }
.fin-tx-in td:first-child { box-shadow: inset 3px 0 0 var(--money-in); }
.fin-tx-out td:first-child { box-shadow: inset 3px 0 0 var(--money-out); }
@media (max-width: 700px) {
  .fin-tx-table th:nth-child(3), .fin-tx-table td:nth-child(3), .fin-tx-table th:nth-child(4), .fin-tx-table td:nth-child(4) { display: none; }
  .fin-tx-table tfoot th:first-child { white-space: normal; }
  .fin-tx-add { margin-left: 0; }
}
/* On a phone the amount sits under the name (the In and Out columns are hidden). */
.fin-tx-m { display: none; }
@media (max-width: 700px) {
  .fin-tx-m { display: block; text-align: left !important; margin-top: 2px; }
  .fin-tx-table th.fin-tx-num, .fin-tx-table td.fin-tx-num { display: none; }
  .fin-tie select { max-width: 9.5rem; }
}
/* A transaction's client (lib/clientmoney.mjs): a menu that saves on change. */
.fin-tx-client { white-space: nowrap; }
.fin-tie { display: flex; gap: 6px; align-items: center; margin: 0; }
.fin-tie select { max-width: 13rem; padding: 4px 8px; font: inherit; font-size: 0.85rem; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; }
.fin-tie select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.fin-tie select option { background: var(--surface); color: var(--text); }
/* Matched by name, not picked by hand. */
.fin-tie select[title] { border-style: dashed; }
.fin-tie-offer { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fin-tie-offer .cform { margin: 0; }
/* Finances Summary, By client: what each client paid against what they agreed to. */
.fin-clients { list-style: none; margin: 14px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 13px 24px; }
.fin-client-paid .fin-bd-meta { color: var(--good-ink); }
.fin-client-short .fin-bd-meta, .fin-client-missed .fin-bd-meta { color: var(--warning-ink); }
.fin-client-short .fin-bd-bar span, .fin-client-due .fin-bd-bar span { background: linear-gradient(90deg, #b45309, var(--warning)); }
/* A client's Money tab: agreed vs received, month by month. */
.cledger-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0 0 18px; }
.cledger-facts div { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.cledger-facts dt { font-size: 0.74rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.cledger-facts dd { margin: 4px 0 0; font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.cledger-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 130px; }
.cledger-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.cledger-track { position: relative; flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; }
.cledger-fill { width: 100%; border-radius: 4px 4px 0 0; background: var(--money-in); transition: filter 0.15s; }
.cledger-col:hover .cledger-fill { filter: brightness(1.2); }
.cledger-short .cledger-fill, .cledger-due .cledger-fill { background: var(--warning); }
.cledger-goal { position: absolute; left: -3px; right: -3px; height: 0; border-top: 2px dashed var(--text-2); opacity: 0.7; }
.cledger-missed .cledger-track { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--critical-bg) 5px 8px); border-radius: 4px 4px 0 0; }
.cledger-m { font-size: 0.68rem; color: var(--muted); }
.cledger-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 14px; }
.cledger-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cledger-key { display: inline-block; width: 12px; height: 10px; border-radius: 2px; }
.cledger-key-paid { background: var(--money-in); }
.cledger-key-short { background: var(--warning); }
.cledger-key-goal { height: 0; border-top: 2px dashed var(--text-2); border-radius: 0; }
.cledger-tx { display: flex; align-items: center; gap: 12px; }
.cledger-when { flex: none; width: 92px; font-size: 0.8rem; color: var(--muted); }
.cledger-tx .cform { margin: 0; }
.cledger-amt-in { color: var(--money-in); }
.cledger-amt-out { color: var(--money-out); }
.cledger-how { margin: 12px 0 0; }
.cledger-planned { margin-top: 12px; }
.cledger-planned summary { cursor: pointer; font-size: 0.88rem; color: var(--text-2); }
/* Finances Summary (lib/finsummary.mjs): four headline numbers, then chart cards two to a row. */
.fin-amt-in { color: var(--money-in); }
.fin-amt-out { color: var(--money-out); }
.fin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 0 16px; }
.fin-stat {
  position: relative; overflow: hidden; min-width: 0; padding: 18px 20px 16px; border-radius: 16px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
/* The Summary's tiles open the transactions behind them. */
a.fin-stat { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
a.fin-stat:hover { text-decoration: none; border-color: var(--c, var(--brand)); transform: translateY(-1px); }
a.fin-stat:focus-visible { outline: 2px solid var(--c, var(--brand)); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { a.fin-stat { transition: none; } a.fin-stat:hover { transform: none; } }
.fin-stat::before { content: "";position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--c, var(--brand)), transparent); }
.fin-stat-in { --c: var(--money-in); }
.fin-stat-out { --c: var(--money-out); }
.fin-stat-ytd { --c: var(--viz-line); }
.fin-stat-label { margin: 0; font-size: 0.72rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fin-stat-value { margin: 6px 0 8px; font: 700 1.85rem/1.1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-stat-in .fin-stat-value { color: var(--money-in); }
.fin-stat-out .fin-stat-value { color: var(--money-out); }
.fin-stat-sub { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-2); }
.fin-delta { font-weight: 650; white-space: nowrap; }
.fin-delta-good { color: var(--good-ink); }
.fin-delta-bad { color: var(--critical-ink); }
@media (max-width: 1000px) { .fin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .fin-stats { gap: 10px; } .fin-stat { padding: 14px; } .fin-stat-value { font-size: 1.45rem; } }
/* Running totals through the month. */
.viz-svg .fin-run-in, .viz-svg .fin-run-out { fill: none; stroke-width: 2.25; stroke-linejoin: round; }
.viz-svg .fin-run-in { stroke: var(--viz-in); }
.viz-svg .fin-run-out { stroke: var(--viz-out); }
.fin-run-dot-in, .fin-run-dot-out { stroke: var(--surface); stroke-width: 2; }
.fin-run-dot-in { fill: var(--viz-in); }
.fin-run-dot-out { fill: var(--viz-out); }
.viz-svg .fin-today { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.fin-today-label { font-weight: 600; }
/* Breakdowns: a row per category or name, with its share of the whole as a bar. */
.fin-bd { list-style: none; margin: 14px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.fin-bd-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.9rem; }
.fin-bd-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); text-decoration: none; }
a.fin-bd-name:hover { text-decoration: underline; }
.fin-bd-rest .fin-bd-name { font-weight: 500; color: var(--text-2); }
.fin-bd-amt { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fin-bd-bar { height: 8px; margin: 6px 0 4px; border-radius: 999px; background: var(--empty); overflow: hidden; }
.fin-bd-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #059669, var(--money-in)); }
.fin-bd-out .fin-bd-bar span { background: linear-gradient(90deg, var(--money-out), #be185d); }
.fin-bd-rest .fin-bd-bar span { opacity: 0.45; }
.fin-bd-meta { margin: 0; font-size: 0.76rem; color: var(--muted); }
/* Largest transactions and the regulars. */
.fin-rank { list-style: none; margin: 10px 0 4px; padding: 0; }
.fin-rank li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.fin-rank li:last-child { border-bottom: 0; }
.fin-rank-when { flex: none; width: 50px; font-size: 0.8rem; color: var(--muted); }
.fin-rank-what { flex: 1; min-width: 0; }
.fin-rank-name, .fin-rank-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-rank-name { font-weight: 600; font-size: 0.92rem; }
.fin-rank-sub { font-size: 0.78rem; color: var(--muted); }
.fin-rank-amt { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.fin-more { margin: 4px 0 2px; font-size: 0.84rem; color: var(--muted); }
.fin-more a { font-weight: 600; color: var(--accent); text-decoration: none; }
.fin-more a:hover { text-decoration: underline; }
.fin-reg-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 6px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.fin-reg-totals dt { font-size: 0.7rem; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.fin-reg-totals dd { margin: 2px 0 0; font: 700 1.15rem var(--font-display); font-variant-numeric: tabular-nums; }
/* Goals: the company's strategic goals, big cards grouped by horizon (lib/goals.mjs).
   Each card takes its horizon's color (--c); achieved ones turn green. */
.goals-hero .tally dd .unit { font-size: 1rem; margin-left: 1px; color: var(--muted); }
.goals-page > .notice { margin-bottom: 18px; }
/* Live or Archived, above the hero. */
.goals-page > .app-filter { margin-bottom: 16px; }
.goal-group { margin-bottom: 34px; }
.goal-group h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; font-size: 1.25rem; }
.goal-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent), 0 0 14px var(--c); }
.goal-hint { font-weight: 400; font-family: var(--font); }
.goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 36px; }
.goal {
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; gap: 16px; min-width: 0; container-type: inline-size;
  padding: 24px 26px 20px; border-radius: 20px; border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border));
  background:
    radial-gradient(520px 220px at 0% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: 0 26px 50px -38px var(--c);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.goal::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 30%, transparent)); }
.goal:hover { border-color: color-mix(in srgb, var(--c) 60%, var(--border)); box-shadow: 0 30px 60px -34px var(--c); transform: translateY(-2px); }
.goal-done { --c: var(--good); }
.goal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.goal-horizon { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: color-mix(in srgb, var(--c) 75%, var(--text)); }
.goal-status { font-size: 0.76rem; font-weight: 650; padding: 2px 10px; border-radius: 999px; border: 1px solid transparent; }
.goal-status-notstarted { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--text-2); border-color: var(--border-strong); }
.goal-status-planning { background: var(--info-bg); color: var(--info-ink); }
.goal-status-on { background: var(--good-bg); color: var(--good-ink); }
.goal-status-risk { background: var(--warning-bg); color: var(--warning-ink); }
.goal-status-behind { background: var(--critical-bg); color: var(--critical-ink); }
.goal-status-done { background: var(--good-bg); color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
/* Edit and Archive (or Restore), on the right of a goal's or deadline's header. */
.goal-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.goal-actions form { margin: 0; }
.goal-edit { font: inherit; background: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; padding: 3px 12px; border-radius: 8px; border: 1px solid var(--border-strong); color: var(--text-2); text-decoration: none; }
.goal-edit:hover { color: var(--text); border-color: var(--c); }
.goal-body { display: flex; align-items: flex-start; gap: 20px; }
.goal-text { flex: 1; min-width: 0; }
.goal h3 { margin: 0 0 8px; font: 700 clamp(1.3rem, 2vw, 1.6rem) / 1.2 var(--font-display); text-transform: none; letter-spacing: -0.01em; color: var(--text); overflow-wrap: anywhere; }
.goal-detail { margin: 0; color: var(--text-2); line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.goal-ring { position: relative; flex: none; width: 84px; height: 84px; display: grid; place-items: center; }
.goal-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; rotate: -90deg; }
.goal-ring circle { fill: none; stroke-width: 7; }
.goal-ring-track { stroke: color-mix(in srgb, var(--c) 14%, var(--empty)); }
.goal-ring-fill { stroke: var(--c); stroke-linecap: round; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--c) 60%, transparent)); }
.goal-ring span { font: 700 1.35rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.goal-ring small { font-size: 0.7rem; color: var(--muted); margin-left: 1px; }
.goal-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.goal-steps li { position: relative; padding-left: 22px; color: var(--text-2); font-size: 0.92rem; overflow-wrap: anywhere; }
.goal-steps li::before { content: ""; position: absolute; left: 4px; top: 0.45em; width: 8px; height: 8px; border-radius: 3px; border: 2px solid var(--c); }
.goal-done .goal-steps li::before { background: var(--c); }
/* A done step: a green check in place of its box, and a line through it. */
.goal-steps li.step-done { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--good) 70%, transparent); }
.goal-steps li.step-done::before { content: "✓"; left: 2px; top: 0; width: auto; height: auto; border: 0; background: none; color: var(--good); font-weight: 800; text-decoration: none; }
/* Key steps on the form: a row for each (done box, the step, ×), then the box to add the next. */
.key-steps { display: grid; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.step-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.step-rows:empty { display: none; }
.step-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.form .step-check { display: grid; place-items: center; width: 30px; height: 30px; cursor: pointer; }
.step-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--good); cursor: pointer; }
.step-row:has([data-step-check]:checked) input[name="step"] { text-decoration: line-through; color: var(--muted); }
.step-remove { font: inherit; font-size: 1.15rem; line-height: 1; width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.step-remove:hover { color: var(--critical); border-color: var(--border-strong); }
/* Other secrets, on the account form, and in the Keys column on the Accounts page (lib/accounts.mjs). */
.secret-rows-field { display: grid; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.secret-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.secret-rows:empty { display: none; }
.secret-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; align-items: center; gap: 8px; font-weight: 400; }
.secret-show .wlogin { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; user-select: all; }
.users-table .acct-secret { display: block; }
@media (max-width: 640px) { .secret-row { grid-template-columns: 1fr auto; } }
/* Client accounts on the client form (lib/clientlogins.mjs): a card each, its five boxes on a
   line (three, two, then one, as the screen narrows) with × in a column of its own beside them. */
.client-logins-field { display: grid; gap: 10px; }
.client-logins { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.client-logins:empty { display: none; }
.client-login { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.client-login-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 12px; min-width: 0; }
@media (max-width: 1180px) { .client-login-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .client-login-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .client-login-fields { grid-template-columns: minmax(0, 1fr); } }
/* Copy beside a username or password on show: the clipboard icon, a tick for a moment once copied. */
.secret-copy { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.secret-copy:hover { color: var(--text); border-color: var(--border-strong); }
.secret-copy.copied { color: var(--good-ink); background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.secret-copy svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.secret-copy .copy-done, .secret-copy.copied .copy-icon { display: none; }
.secret-copy.copied .copy-done { display: block; }
.step-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding-left: 38px; }
.goal-bar { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--c) 12%, var(--empty)); overflow: hidden; margin-top: auto; }
.goal-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 60%, transparent), var(--c)); }
.goal-foot { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); }
.goal-foot svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.goal-due, .goal-owner { display: inline-flex; align-items: center; gap: 6px; }
/* Potential income: a green chip under the goal's name (and on the Overview). */
.goal-income { display: inline-flex; align-items: center; gap: 5px; margin: 0 0 10px; padding: 3px 11px; border-radius: 999px; background: var(--good-bg); color: var(--good-ink); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); font-size: 0.86rem; white-space: nowrap; }
.goal-income strong { font-variant-numeric: tabular-nums; }
.goal-income svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.goal-income-note { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; margin-left: 2px; }
.goal-late { color: var(--critical-ink); font-weight: 600; }
.goals-empty { text-align: center; padding: 48px 24px; }
.goals-empty svg { width: 64px; height: 64px; fill: none; stroke: var(--accent); stroke-width: 1.5; filter: drop-shadow(0 0 12px var(--brand-glow)); }
.goals-empty h2 { margin: 12px 0 6px; }
.goals-empty .button { margin-top: 14px; }
@media (max-width: 560px) {
  .goal { padding: 20px 18px 16px; }
  .goal-body { flex-direction: column-reverse; gap: 12px; }
  .goal-ring { width: 72px; height: 72px; }
}

/* The goal form: a target mark, horizon and status as tiles, and a progress slider. */
.goal-mark { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--c) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--border)); }
.goal-mark svg { width: 30px; height: 30px; fill: none; stroke: var(--c); stroke-width: 1.8; }
.goal-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.form label.goal-option[style] { border-left: 4px solid var(--c); }
.goal-progress-field > span { display: flex; justify-content: space-between; }
.goal-progress-field output { font: 700 1rem var(--font-display); color: var(--accent); }
.form .goal-progress-field input[type="range"] { width: 100%; padding: 0; accent-color: var(--brand); border: 0; background: none; }

/* Goals in the layout switch. Grid with many per row: narrow cards put the ring above the title. */
@container (max-width: 330px) {
  .goal-body { flex-direction: column-reverse; gap: 12px; }
  .goal-ring { width: 68px; height: 68px; }
}
/* One per row: the goal on the left, its key steps in the middle, a big ring on the right. */
body[data-layout="rows"] .goals { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  body[data-layout="rows"] .goal {
    display: grid; gap: 12px 32px; align-items: start; padding: 24px 30px 20px;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
    grid-template-areas: "head head ring" "text steps ring" "bar bar ring" "foot foot ring";
  }
  body[data-layout="rows"] .goal:not(:has(.goal-steps)) { grid-template-areas: "head head ring" "text text ring" "bar bar ring" "foot foot ring"; }
  body[data-layout="rows"] .goal-body { display: contents; }
  body[data-layout="rows"] .goal-head { grid-area: head; }
  body[data-layout="rows"] .goal-text { grid-area: text; }
  body[data-layout="rows"] .goal-steps { grid-area: steps; padding-left: 24px; border-left: 1px solid var(--border); }
  body[data-layout="rows"] .goal-bar { grid-area: bar; margin-top: 4px; }
  body[data-layout="rows"] .goal-foot { grid-area: foot; }
  body[data-layout="rows"] .goal-ring { grid-area: ring; align-self: center; width: 112px; height: 112px; }
  body[data-layout="rows"] .goal-ring span { font-size: 1.8rem; }
}
/* Compact: one slim line per goal; the why and the steps stay on the full card. */
body[data-layout="compact"] .goals { grid-template-columns: 1fr; gap: 16px; }
body[data-layout="compact"] .goal { padding: 10px 18px; gap: 6px 20px; border-radius: 12px; box-shadow: none; }
body[data-layout="compact"] .goal::before { inset: 0 auto 0 0; width: 4px; height: auto; }
body[data-layout="compact"] :is(.goal-detail, .goal-steps) { display: none; }
body[data-layout="compact"] .goal h3 { margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-layout="compact"] .goal-ring { width: 46px; height: 46px; }
body[data-layout="compact"] .goal-ring circle { stroke-width: 9; }
body[data-layout="compact"] .goal-ring span { font-size: 0.9rem; }
body[data-layout="compact"] .goal-ring small { display: none; }
@media (min-width: 900px) {
  body[data-layout="compact"] .goal {
    display: grid; align-items: center;
    grid-template-columns: minmax(0, 1fr) auto auto 140px auto auto auto;
    grid-template-areas: "text horizon status bar foot ring edit";
  }
  body[data-layout="compact"] .goal-head { display: contents; }
  body[data-layout="compact"] .goal-horizon { grid-area: horizon; }
  body[data-layout="compact"] .goal-status { grid-area: status; justify-self: start; }
  body[data-layout="compact"] .goal-actions { grid-area: edit; margin: 0; }
  body[data-layout="compact"] .goal-body { display: contents; }
  body[data-layout="compact"] .goal-text { grid-area: text; min-width: 0; }
  body[data-layout="compact"] .goal-bar { grid-area: bar; margin: 0; }
  body[data-layout="compact"] .goal-foot { grid-area: foot; flex-wrap: nowrap; white-space: nowrap; }
  body[data-layout="compact"] .goal-owner { display: none; }
  body[data-layout="compact"] .goal-ring { grid-area: ring; }
}

/* How we work: the Request a document window, and the Categories page (lib/guides.mjs). */
.guide-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 24px 26px; border: 1px solid var(--border); border-top: 3px solid var(--brand); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6); }
.guide-dialog::backdrop { background: rgba(6, 4, 14, 0.6); backdrop-filter: blur(3px); }
.cat-list { list-style: none; margin: 14px 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; }
.cat-list li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.cat-list li:last-child { border-bottom: 0; }
.cat-row { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.cat-row input[name="name"] { flex: 1 1 160px; min-width: 0; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.cat-add { margin: 0 0 14px; }
.guide-dialog textarea { font: inherit; }
/* The request window's sections and dropdowns. */
.guide-dialog { width: min(720px, calc(100vw - 32px)); padding: 0; }
.rq { gap: 16px; padding: 24px 26px; }
.rq-head h2 { margin: 0 0 4px; font-size: 1.3rem; }
.rq-head p { margin: 0; color: var(--text-2); font-size: 0.9rem; }
.form .rq-field { gap: 6px; }
.rq-label { font-weight: 600; font-size: 0.85rem; }
.rq-hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.rq input, .rq textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg); color: var(--text); }
.rq textarea { resize: vertical; min-height: 120px; }
.rq-select { position: relative; display: block; }
.rq-select::after { content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.rq select { appearance: none; -webkit-appearance: none; width: 100%; font: inherit; font-weight: 500; padding: 10px 36px 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; text-overflow: ellipsis; }
.rq select:hover { border-color: var(--accent); }
.rq :is(select, input, textarea):focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.rq-template { display: grid; gap: 6px; padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--border)); }
.rq-template a { justify-self: start; color: var(--accent); }
.rq-links { border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px 16px; margin: 0; }
.rq-links legend { padding: 0 6px; font-weight: 600; font-size: 0.85rem; }
.rq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 560px) { .rq-grid { grid-template-columns: minmax(0, 1fr); } }
.rq-actions { justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 2px; }

/* A long dropdown's search panel (app.js bindSelectSearch): a search box over the choices, under the menu. */
.select-search {
  position: fixed; z-index: 1000; display: flex; flex-direction: column; max-height: min(340px, 60vh);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); overflow: hidden; font-size: 0.9rem; font-weight: 400;
}
.select-search input {
  margin: 8px; padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.select-search input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.select-search ul { list-style: none; margin: 0; padding: 0 6px 6px; overflow-y: auto; }
.select-search [role="option"] { padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--text); }
.select-search [role="option"][aria-selected="true"] { font-weight: 600; }
.select-search [role="option"][aria-selected="true"]::after { content: " ✓"; color: var(--brand); }
.select-search [role="option"].active { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.select-search [role="option"][aria-disabled="true"] { color: var(--muted); cursor: default; }
.select-search-group { padding: 8px 10px 3px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
.select-search-none { margin: 0; padding: 4px 16px 12px; color: var(--text-2); }

/* The New to-do form in a window over a client's, app's, server's or website's page (app.js
   bindTodoModal). Solid, not glass, so the page doesn't show through; no transform, so the
   menus' search popups (position: fixed) stay where they're put. */
.todo-modal {
  width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: auto;
  border: 1px solid var(--border); border-radius: 14px; background: var(--bg-2); color: var(--text);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6);
}
.todo-modal::backdrop { background: rgba(6, 4, 14, 0.6); backdrop-filter: blur(3px); }
.todo-modal[open] { animation: todo-modal-in 0.16s ease-out; }
@keyframes todo-modal-in { from { opacity: 0; } }
.todo-modal .todo-add { margin: 0; border: 0; border-top: 3px solid var(--brand); border-radius: 0; }
@media (prefers-reduced-motion: reduce) { .todo-modal[open] { animation: none; } }
/* A yes-or-no question (app.js ask): the dashboard's own window, in place of the browser's confirm box. */
.ask-dialog { width: min(440px, calc(100vw - 32px)); padding: 22px 24px 20px; border: 1px solid var(--border); border-top: 3px solid var(--brand); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6); }
.ask-dialog::backdrop { background: rgba(6, 4, 14, 0.6); backdrop-filter: blur(3px); }
.ask-dialog[open] { animation: ask-in 0.16s ease-out; }
@keyframes ask-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.ask-text { margin: 0 0 20px; font-size: 1rem; line-height: 1.5; }
.ask-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.ask-dialog .button.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.ask-dialog .button.danger:hover { filter: brightness(1.08); }
@media (prefers-reduced-motion: reduce) { .ask-dialog[open] { animation: none; } }

/* Account form: small ticks beside a field's name (Signs in with Google / Facebook, Approximate). */
/* The field's label lays out flat, so the ticks sit on its name's line and wrap under it when narrow. */
.af-field { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 10px; min-width: 0; font-weight: 600; font-size: 0.9rem; }
.form .af-field > label { display: contents; }
.af-field > label > input { order: 3; flex: 1 0 100%; min-width: 0; }
.af-field > label > .field-error { order: 4; flex: 1 0 100%; }
.af-minis { order: 2; display: flex; flex-wrap: wrap; gap: 2px 10px; }
/* A website's password box: Show on its name's line, the saved password (once shown) under it. */
.af-field > [data-toggle-password] { order: 2; }
.af-field > .secret-copy { order: 2; }
.af-field > .pw-saved { order: 4; flex: 1 0 100%; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 400; user-select: all; overflow-wrap: anywhere; }
.form label.af-mini { flex-direction: row; align-items: center; gap: 4px; font-weight: 500; font-size: 0.78rem; color: var(--text-2); cursor: pointer; }
.form label.af-mini input { margin: 0; width: 13px; height: 13px; accent-color: var(--brand); }
.form label.af-mini:has(input:checked) { color: var(--text); }

/* The Workers tab's two pages (lib/connectionsview.mjs workersSubnav) */
.subtabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--border); }
.subtabs a { padding: 8px 14px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 0.92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a:hover { color: var(--text); }
.subtabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* Connections: one card per app the ADS Worker works for */
.ccards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; margin-top: 14px; }
.ccard { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.ccard header { display: flex; align-items: center; gap: 10px; }
.ccard header h2 { margin: 0; font-size: 1.1rem; }
.ccard-state { margin-left: auto; font-size: 0.82rem; font-weight: 600; }
.ccard h3 { margin: 14px 0 4px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ccard p { margin: 4px 0; overflow-wrap: anywhere; }
.cspecial { background: var(--info-bg); border-left: 3px solid var(--info); padding: 8px 10px; border-radius: 6px; font-size: 0.9rem; }
.ckinds { display: flex; flex-wrap: wrap; gap: 6px; }
.chow, .creach { margin: 4px 0; padding-left: 18px; font-size: 0.9rem; }
.creach { list-style: none; padding-left: 0; }
.creach li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 0; }
.cwhy { flex-basis: 100%; padding-left: 16px; overflow-wrap: anywhere; }
.clight { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.creach .clight { width: 8px; height: 8px; }
.clight-on { background: var(--good); }
.clight-part { background: var(--warning); }
.clight-off { background: var(--critical); }
.clink-on { color: var(--good-ink); }
.clink-part { color: var(--warning-ink); }
.clink-off { color: var(--critical-ink); }
.clink-muted { color: var(--muted); }
.cfix { background: var(--warning-bg); border-left: 3px solid var(--warning); padding: 8px 10px; border-radius: 6px; margin-top: 8px; }
/* One per row: a full-width card; from tablet width up, its three parts side by side. */
body[data-layout="rows"] .ccards { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  body[data-layout="rows"] .ccard-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(260px, 1fr); gap: 0 22px; align-items: start; }
  body[data-layout="rows"] .ccard-body > section + section { border-left: 1px solid var(--border); padding-left: 22px; }
}
/* Compact: one slim line per app: name and state, address, what it sends (tags), each PC's light. */
body[data-layout="compact"] .ccards { grid-template-columns: 1fr; gap: 8px; }
body[data-layout="compact"] .ccard { padding: 8px 14px; }
body[data-layout="compact"] .ccard :is(h3, .cabout, .cspecial, .chowto, .cwhy) { display: none; }
body[data-layout="compact"] .ccard header h2 { font-size: 1rem; }
body[data-layout="compact"] .ccard .curl { margin: 0; }
body[data-layout="compact"] .ccard .ckinds { margin: 0; gap: 4px; }
body[data-layout="compact"] .ccard .creach { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; font-size: 0.85rem; }
body[data-layout="compact"] .ccard .creach li { padding: 0; gap: 5px; }
body[data-layout="compact"] .ccard .cpcs > p { margin: 0; }
body[data-layout="compact"] .ccard .cfix { margin: 6px 0 0; padding: 6px 10px; }
@media (min-width: 900px) {
  body[data-layout="compact"] .ccard { display: grid; grid-template-columns: minmax(220px, 1.1fr) minmax(170px, 0.9fr) minmax(200px, 1fr) minmax(240px, 1.3fr); align-items: center; gap: 4px 20px; }
  body[data-layout="compact"] .ccard-body { display: contents; }
  body[data-layout="compact"] .ccard header { grid-column: 1; }
  body[data-layout="compact"] .ccard .curl { grid-column: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body[data-layout="compact"] .ccard .csends { grid-column: 3; }
  body[data-layout="compact"] .ccard .cpcs { grid-column: 4; }
  body[data-layout="compact"] .ccard .cfix { grid-column: 1 / -1; }
}
.tally .t-agents dd { color: var(--good-ink); }
.tally .t-agents dd .unit { font-size: 1rem; margin-left: 2px; color: var(--muted); font-weight: 600; }

/* A worker's computer (lib/workerspecs.mjs): the line on its card and its warnings */
.wspecs { margin: 2px 0 6px; overflow-wrap: anywhere; }
.wwarn { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.wwarn-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.wok { color: var(--good-ink); margin: 0 0 8px; }

/* Add a worker: what to do when something isn't right, and the folded-away plain reporter */
.help-page .help-fixes { list-style: disc; padding-left: 1.3em; }
.help-page .help-fixes > li { padding: 0 0 10px; border: 0; }
.help-page .help-fixes > li + li { padding-top: 0; border-top: 0; }
.help-other { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.help-other summary { cursor: pointer; font-weight: 600; }
.help-other[open] summary { margin-bottom: 8px; }
/* Invoices (lib/invoices.mjs): the list's actions, an invoice's page and form, a client's invoices. */
.inv-tag-info { background: var(--info-bg); border-color: transparent; color: var(--info-ink); }
.inv-tag-good { background: var(--good-bg); border-color: transparent; color: var(--good-ink); }
.inv-tag-warn { background: var(--warning-bg); border-color: transparent; color: var(--warning-ink); }
.inv-tag-muted { color: var(--muted); font-weight: 500; }
.inv-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.inv-acts .cform { margin: 0; }
.inv-panel { margin-bottom: 18px; }
.inv-panel-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 4px; }
.inv-panel-head h1 .tag { font-size: 0.8rem; }
.inv-act-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 14px 0 10px; }
.inv-act-row .cform { margin: 0; }
.inv-send { display: flex; gap: 8px; align-items: center; }
.inv-send input { width: min(280px, 60vw); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: inherit; }
.inv-link { word-break: break-all; }
.inv-paper { max-width: 860px; }
.inv-form { max-width: 860px; }
.inv-form-top { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.inv-lines { border: 0; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.inv-lines legend { font-weight: 600; margin-bottom: 6px; }
.inv-line { display: grid; grid-template-columns: minmax(0, 1fr) 80px 140px; gap: 8px; }
.inv-line-head span { font-size: 0.74rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.inv-line input { min-width: 0; }
@media (max-width: 700px) {
  .inv-form-top { grid-template-columns: 1fr; }
  .inv-line { grid-template-columns: minmax(0, 1fr) 56px 100px; }
}
.inv-client { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.inv-client-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.inv-client-head h3 { margin: 0; font-size: 1rem; }
.inv-client-list li { display: flex; align-items: center; gap: 12px; }

/* Workers > Assignments: each worker's priority and assigned work (lib/routing.mjs). */
.wroute { margin: 2px 0 6px; }
.wroute a { color: var(--text-2); text-decoration: none; }
.wroute a:hover { text-decoration: underline; }
.wassign-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.wassign-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.wassign-table th, .wassign-table td { vertical-align: top; text-align: left; padding: 14px 16px; border-top: 1px solid var(--border); font-weight: 400; }
.wassign-table thead th { border-top: 0; background: var(--surface-2); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 10px 16px; }
.wassign-table tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.wassign-table thead th:nth-child(2) { width: 120px; }
.wassign-table thead th:nth-child(4) { width: 150px; }
.wassign-who { display: flex; gap: 10px; align-items: flex-start; padding-top: 2px; }
.wassign-who > span:last-child { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wassign-who strong { color: var(--text); font-weight: 600; }
.wassign-host { font-size: 0.78rem; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.wassign-status { font-size: 0.78rem; color: var(--text-2); }
.wassign-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: var(--muted); }
.wassign-dot-idle { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.wassign-dot-working { background: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.wassign-dot-offline { opacity: 0.6; }
/* Priority: a select drawn like the dashboard's other fields, with its own chevron. */
.form .wassign-select {
  appearance: none; -webkit-appearance: none; width: 100%; min-width: 84px; font: inherit; font-weight: 600; color: var(--text);
  padding: 8px 32px 8px 12px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer;
  background: var(--bg) no-repeat right 12px center / 10px 6px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form .wassign-select:hover:not(:disabled) { border-color: var(--accent); }
.form .wassign-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.form .wassign-select option { background: var(--surface); color: var(--text); }
.form .wassign-select:disabled { opacity: 0.6; cursor: default; }
/* Assigned work: a field-like button that opens the picker. */
.wassign { margin: 0; }
.wassign > summary { list-style: none; display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px 8px 7px 12px; min-height: 38px; box-sizing: border-box; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
.wassign > summary::-webkit-details-marker { display: none; }
.wassign > summary:hover { border-color: var(--accent); }
.wassign > summary:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.wassign[open] > summary { border-color: var(--brand); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.wassign-chosen { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.wassign-chosen .tag { font-size: 0.78rem; padding: 2px 9px; background: color-mix(in srgb, var(--brand) 14%, transparent); border-color: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--accent); }
.wassign-any { color: var(--muted); }
.wassign-edit { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; color: var(--text-2); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.wassign-edit::after { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform 0.15s; }
.wassign[open] .wassign-edit::after { transform: translateY(1px) rotate(-135deg); }
.wassign-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; padding: 12px; border: 1px solid var(--brand); border-top: 0; border-radius: 0 0 10px 10px; background: var(--surface-2); }
.wassign-groups fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.wassign-groups legend { padding: 0 0 6px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.wassign-items { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; padding-right: 2px; }
.form label.wpick { flex-direction: row; align-items: center; gap: 9px; margin: 0; padding: 6px 8px; border-radius: 8px; font-size: 0.88rem; font-weight: 400; color: var(--text-2); cursor: pointer; transition: background 0.12s, color 0.12s; }
.form label.wpick:hover { background: color-mix(in srgb, var(--brand) 9%, transparent); color: var(--text); }
.form label.wpick:has(input:checked) { color: var(--text); background: color-mix(in srgb, var(--brand) 13%, transparent); }
.form label.wpick input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--brand); cursor: pointer; }
/* Only this: a switch. */
.form label.wswitch { flex-direction: row; align-items: center; gap: 10px; margin: 0; min-height: 38px; font-weight: 500; font-size: 0.88rem; color: var(--text-2); cursor: pointer; position: relative; white-space: nowrap; }
.wswitch input { position: absolute; left: 0; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.wswitch-track { flex: none; position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background 0.15s; }
.wswitch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); transition: transform 0.15s; }
.wswitch input:checked + .wswitch-track { background: var(--brand); }
.wswitch input:checked + .wswitch-track::after { transform: translateX(16px); }
.wswitch input:checked ~ span:last-child { color: var(--text); }
.wswitch input:focus-visible + .wswitch-track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.wswitch input:disabled ~ span { opacity: 0.6; }
@media (max-width: 760px) {
  .wassign-table thead { display: none; }
  .wassign-table tr, .wassign-table th, .wassign-table td { display: block; width: auto; }
  .wassign-table tr { padding: 12px 14px; border-top: 1px solid var(--border); }
  .wassign-table tbody tr:first-child { border-top: 0; }
  .wassign-table th, .wassign-table td { border: 0; padding: 6px 0; }
  .wassign-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 5px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
  .wassign-table td[data-label="Only"]::before { display: none; }
  .form .wassign-select { width: 120px; }
}
/* An invoice's page: Download PDF beside the title, and the paper below. */
.inv-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; }
.inv-pdf { white-space: nowrap; }
.inv-paper { max-width: 816px; margin-bottom: 32px; }
/* QuickBooks setup (lib/qbpages.mjs): what connecting does, then four steps with commands to copy. */
.qb-why { padding-left: 1.2em; line-height: 1.6; margin: 0 0 14px; }
.qb-why li + li { margin-top: 6px; }
.qb-steps { margin-top: 10px; padding-left: 1.4em; }
.qb-steps > li { margin-bottom: 16px; }
.qb-steps > li::marker { font-weight: 700; color: var(--accent); }
.qb-steps h3 { font-size: 1.02rem; margin: 0 0 4px; }
.qb-steps p { margin: 6px 0; }
.qb-steps .code-copy { margin: 8px 0 10px; }
.qb-sub { font-size: 1.02rem; margin: 8px 0 4px; }
/* Commands show exactly as typed: no font ligatures turning << into one symbol. */
.code-copy pre, .code-copy code { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
/* Invoices made in QuickBooks (lib/invoices.mjs qbOnly): open ones, then paid and void folded away. */
.inv-qb { margin-top: 18px; }
.inv-qb h2 { font-size: 1.05rem; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.inv-qb-done { margin-top: 12px; }
.inv-qb-done summary { cursor: pointer; color: var(--text-2); margin-bottom: 8px; }
/* Who pays you (lib/payers.mjs): payers by name, untied first, with Create client and Tie. */
.payers h2 { font-size: 1.05rem; margin: 22px 0 6px; display: flex; align-items: center; gap: 8px; }
.payers-bulk { margin: 8px 0 10px; }
.payers-table td { vertical-align: middle; }
.payer-name { display: block; font-weight: 600; }
.payer-meta { display: block; font-size: 0.8rem; color: var(--muted); }
.payer-acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.payer-acts .cform { margin: 0; }
.payer-tie { display: flex; gap: 6px; align-items: center; }
.payer-tie select { max-width: 12rem; padding: 4px 8px; font: inherit; font-size: 0.85rem; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; }
.payers-generic { margin-top: 18px; }
.payers-generic summary { cursor: pointer; color: var(--text-2); }
.qb-history { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 6px; }
.qb-history label { margin: 0; }
.qb-history select { padding: 6px 10px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; }
.payers-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.payers-table th, .payers-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.payers-table thead th { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.payers-table .fin-tx-num { text-align: right; }
/* On a phone, a row's actions go under its name and amount. */
@media (max-width: 700px) {
  .payers-table tbody tr { display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .payers-table tbody td { border: 0; padding: 4px 8px; }
  .payers-table tbody td.payer-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .payers-table thead { display: none; }
}
/* A QuickBooks invoice's page: Download PDF and Open in QuickBooks side by side. */
.inv-head-acts { display: flex; flex-wrap: wrap; gap: 8px; }
/* A client's Edit page: Merge into another client (lib/clientmerge.mjs). */
.client-merge label { display: block; margin-bottom: 8px; }
.client-merge-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.client-merge-row select { padding: 7px 10px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border-strong); border-radius: 8px; }
