/* AC Command Center. One stylesheet, no framework.
   The look is a bento grid: rounded tiles on a soft grey page, numbers first and very few words.
   Light and dark follow the device. */

:root {
  --bg: #f5f5f7;
  --tile: #ffffff;
  --field: #f5f5f7;
  --btn: #e8e8ed;
  --btn-hover: #dedee3;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --hair: rgba(0, 0, 0, 0.08);
  --hover: rgba(0, 0, 0, 0.04);
  --track: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --on-blue: #ffffff;
  --bad: #d70015;
  --bad-bg: #ffe9e7;
  --warn: #b25000;
  --warn-bg: #fff1dc;
  --good: #248a3d;
  --good-bg: #e3f5e7;
  --light-good: #34c759;
  --light-warn: #ff9500;
  --light-bad: #ff3b30;
  --nav: rgba(245, 245, 247, 0.8);
  --accent: #0066d6;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --r-tile: 28px;
  --r-ctl: 12px;
  color-scheme: light dark;
}

/* Each business in its own brand color, used for its name and its bars (2026-11-19).
   Light mode uses the brand color itself, or its deeper step where the brand color is too pale
   to read on white. Dark mode uses the brand's own lighter step. Sources:
     Co-Create     #FF5412 logo orange, deeper #C63A05 (Cocreate/brand/cocreate-mark.svg, platform globals.css)
     Modern Human  #7C56CC Human Purple, #9B6CFF on dark (modern-human/css/styles.css, brand guide)
     Dailys        #0F4C81 Classic Blue, #6E9AD2 soft blue on dark (dailys-design-system.md)
     AC Media      black and off-white, no colored accent by Alec's rule (the-247-editor-kit/brand)
     Small Talk!   burnt orange estimated by eye from the logo photo, no brand file exists
     Tenfold, Personal and Family: no brand color anywhere. Placeholders until Alec picks one. */
.acc-co-create    { --accent: #C63A05; }
.acc-modern-human { --accent: #7C56CC; }
.acc-dailys       { --accent: #0F4C81; }
.acc-ac-media     { --accent: #111111; }
.acc-small-talk   { --accent: #C4501E; }
.acc-tenfold      { --accent: #4338ca; }
.acc-personal     { --accent: #2b8a3e; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --tile: #1c1c1e;
    --field: #2c2c2e;
    --btn: #2c2c2e;
    --btn-hover: #3a3a3c;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --hair: rgba(255, 255, 255, 0.12);
    --hover: rgba(255, 255, 255, 0.06);
    --track: rgba(255, 255, 255, 0.14);
    --blue: #0a84ff;
    --blue-hover: #409cff;
    --bad: #ff453a;
    --bad-bg: #3a1513;
    --warn: #ff9f0a;
    --warn-bg: #3a2a0c;
    --good: #30d158;
    --good-bg: #12301a;
    --light-good: #30d158;
    --light-warn: #ff9f0a;
    --light-bad: #ff453a;
    --nav: rgba(0, 0, 0, 0.72);
    --accent: #4da3ff;
  }
  .acc-co-create    { --accent: #FF5412; }
  .acc-modern-human { --accent: #9B6CFF; }
  .acc-dailys       { --accent: #6E9AD2; }
  .acc-ac-media     { --accent: #F3F1EE; }
  .acc-small-talk   { --accent: #E0703A; }
  .acc-tenfold      { --accent: #9aa5ff; }
  .acc-personal     { --accent: #69db7c; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.47 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }

h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }

.muted { color: var(--text-2); }
.small { font-size: 13px; }
.stale { color: var(--warn); }

.none { color: var(--text-3); }

/* ---- Page frame ---- */

.page { max-width: 1160px; margin: 0 auto; padding: 0 22px 90px; }
main { display: block; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 22px; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 6px 22px; flex-wrap: wrap;
  margin: 0 -22px 22px; padding: 12px 22px;
  background: var(--nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; }
.top nav { display: flex; gap: 2px; flex: 1; }
.top nav a { text-decoration: none; color: var(--text-2); font-size: 14px; padding: 6px 12px; border-radius: 999px; }
.top nav a:hover { color: var(--text); }
.top nav a.on { color: var(--text); background: var(--btn); font-weight: 600; }
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--text-2); }
.live { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.back { display: inline-block; margin: 0 0 14px 4px; color: var(--blue); text-decoration: none; font-size: 14px; }
.back:hover { text-decoration: underline; }

/* ---- Bento grid ---- */

.bento {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px; grid-auto-flow: dense; margin-bottom: 16px;
}
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: 1 / -1; }

.tile, .panel {
  background: var(--tile); border-radius: var(--r-tile); padding: 24px;
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
a.tile { text-decoration: none; transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
a.tile:hover { transform: scale(1.012); }
@media (prefers-reduced-motion: reduce) {
  a.tile { transition: none; }
  a.tile:hover { transform: none; }
}

/* Health lights: green, orange, red, or grey when there is nothing to judge. */
.health {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--btn); color: var(--text-2);
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; }
.health.good { background: var(--good-bg); color: var(--good); }
.health.warn { background: var(--warn-bg); color: var(--warn); }
.health.bad { background: var(--bad-bg); color: var(--bad); }
.good > .dot, .n.good .dot { background: var(--light-good); }
.warn > .dot, .n.warn .dot { background: var(--light-warn); }
.bad > .dot, .n.bad .dot { background: var(--light-bad); }

/* ---- Scoreboard ---- */

/* The line above the tiles: the date, how far into the month, and the count of each light. */
.strip { display: flex; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; margin: 0 4px 16px; }
.strip h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.lights { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; font-size: 13px; color: var(--text-2); }
.light { display: inline-flex; align-items: center; gap: 6px; }
.light b { color: var(--text); font-variant-numeric: tabular-nums; }

/* One business per tile: its name, its light, and its numbers in a row. */
.score { gap: 20px; container-type: inline-size; }
.biz-top { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; }
.score h2 { font-size: 19px; letter-spacing: -0.02em; color: var(--accent); }
.score:not([class*="acc-"]) h2 { color: var(--text); }
.nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: auto; }
.nums.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* One number: a tiny label, the figure, a bar toward its target, then the target and the arrow. */
.n { display: grid; gap: 3px; align-content: start; min-width: 0; }
/* A label may run to two lines. It sits on the bottom of a two-line box so the figures stay level. */
.n-label {
  display: flex; align-items: flex-end; gap: 6px; min-height: 30px;
  font-size: 12px; line-height: 1.25; font-weight: 600; color: var(--text-2); overflow-wrap: anywhere;
}
.n-label .dot { width: 8px; height: 8px; margin-bottom: 3px; }
/* A figure is sized to its own tile, so the longest one (₱142.5K) always fits its cell,
   whether the tile holds two numbers or four. The plain size is for browsers without cqw. */
.n-value {
  font-size: 24px; font-size: clamp(18px, calc((100cqw - 18px) / 7.9), 28px);
  line-height: 1.12; font-weight: 700; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.nums.n4 .n-value { font-size: 22px; font-size: clamp(18px, calc((100cqw - 54px) / 15.8), 28px); }
.n-value.none { color: var(--text-3); font-weight: 500; }
.n.old .n-value { color: var(--text-3); }
.n-sub {
  display: flex; flex-wrap: wrap; gap: 0 8px; min-height: 17px;
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.n-sub .stale { font-weight: 600; }
.delta { font-weight: 600; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }

.bar { height: 4px; border-radius: 4px; background: var(--track); overflow: hidden; margin: 3px 0 2px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.n.good .bar span { background: var(--light-good); }
.n.warn .bar span { background: var(--light-warn); }
.n.bad .bar span { background: var(--light-bad); }
.w0 { width: 1%; } .w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; }
.w25 { width: 25%; } .w30 { width: 30%; } .w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; }
.w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; }
.w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; } .w95 { width: 95%; }
.w100 { width: 100%; }

/* ---- Business page ---- */

.biz-head { gap: 6px; padding: 22px 24px; }
.biz-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--accent); }
.goal-line { font-size: 15px; color: var(--text-2); }

.kpi { display: flex; gap: 4px; min-height: 148px; container-type: inline-size; }
/* The label row is two lines tall whether or not the label wraps, so the figures in a row stay level. */
.kpi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; min-height: 34px; }
.kpi .n-label { font-size: 13px; min-height: 0; align-items: flex-start; }
.kpi .n-label .dot { margin: 4px 0 0; }
.kpi .n-value { font-size: 26px; font-size: clamp(20px, 15cqw, 32px); white-space: normal; overflow-wrap: anywhere; }
.kpi .age { margin-top: auto; padding-top: 8px; }
.kpi.extra { background: transparent; box-shadow: inset 0 0 0 1.5px var(--hair); }
.kpi.extra .n-value { font-size: 22px; font-size: clamp(18px, 13cqw, 24px); }
.kpi.locked { background: transparent; box-shadow: inset 0 0 0 1.5px var(--hair); justify-content: flex-end; }
.age.stale { color: var(--warn); }

a.work { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 16px; min-height: 148px; }

/* ---- Trend and splits ---- */

.trend, .split { gap: 14px; }
.trend .kpi-head, .split .kpi-head { min-height: 0; align-items: baseline; }
.trend h2, .split h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.trend-chart { display: block; width: 100%; height: 132px; margin-top: auto; }
.trend-bar { fill: var(--accent); opacity: 0.38; }
.trend-bar.now { opacity: 1; }
.trend-gap { fill: var(--track); }
.trend-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); font-size: 11px; color: var(--text-3); text-align: center; }

.parts { display: grid; gap: 12px; }
.parts li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(36px, 1fr) minmax(56px, auto) 36px; gap: 12px; align-items: center; font-size: 14px; }
.part-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parts .bar { margin: 0; height: 6px; }
.part-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.part-share { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; text-align: right; }
.asof { max-width: 420px; }

/* ---- Controls ---- */

button, .button, input, select, textarea { font: inherit; color: inherit; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 6px 16px; border-radius: 999px; border: 0;
  background: var(--btn); font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
button:hover, .button:hover { background: var(--btn-hover); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--blue); color: var(--on-blue); }
button.primary:hover { background: var(--blue-hover); }
button.small { min-height: 30px; padding: 3px 12px; font-size: 13px; }
button.link { min-height: 0; padding: 0; border-radius: 4px; background: none; color: var(--blue); font-weight: 400; }
button.link:hover { background: none; text-decoration: underline; }
button.link.danger { color: var(--bad); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--r-ctl);
  border: 1px solid transparent; background: var(--field);
}
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }

label { display: grid; gap: 5px; font-size: 13px; color: var(--text-2); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar { margin: 4px 0 16px; }
.form-error { color: var(--bad); font-size: 14px; }
.form-error:empty { display: none; }

.chip, .pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--btn); color: var(--text-2);
}
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.quiet { font-weight: 500; }
.row-title .pill { margin-left: 8px; vertical-align: 1px; }

.banner {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 18px; border-radius: 16px; margin-bottom: 16px; font-size: 14px;
}
.banner.local { background: var(--btn); color: var(--text-2); }
.banner.error { background: var(--bad-bg); color: var(--bad); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.ok { background: var(--good-bg); color: var(--good); }
.banner button.link { color: inherit; text-decoration: underline; }

/* ---- Panels and sign-in ---- */

.panel { margin: 0 0 16px; gap: 10px; scroll-margin-top: 96px; }
.panel > h2 { font-size: 22px; letter-spacing: -0.02em; }
.panel > h1 { font-size: 28px; letter-spacing: -0.03em; }
.login { width: min(400px, 100%); display: grid; gap: 10px; padding: 32px; margin: 0; }
.login h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.login h2 { font-size: 17px; }
.login button { margin-top: 8px; min-height: 42px; }
.login-wrap { display: grid; gap: 16px; width: min(400px, 100%); }
.qr { width: 196px; height: 196px; padding: 10px; border-radius: 16px; background: #ffffff; justify-self: center; }
.key { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; user-select: all; }
.login-wrap .login { width: 100%; }

/* ---- Lists ---- */

.list { gap: 8px; }
.list > h2 { display: flex; align-items: baseline; gap: 8px; }
.count { color: var(--text-3); font-weight: 500; font-size: 15px; }
.empty { padding: 6px 0 2px; }
.list > .link { align-self: flex-start; margin-top: 4px; }

.rows > li { border-top: 1px solid var(--hair); }
.rows > li:first-child { border-top: 0; }
.row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }

/* The row of business filters at the top of the Work tab. */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.filters a {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 13px; border-radius: 999px;
  background: var(--tile); color: var(--text-2); font-size: 14px; text-decoration: none;
}
.filters a:hover { color: var(--text); }
.filters a.on { background: var(--text); color: var(--bg); font-weight: 600; }
.filters .count { font-size: 12px; color: inherit; opacity: 0.7; }
.row-main {
  flex: 1; min-width: 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 2px 10px;
  align-items: baseline; justify-content: stretch; text-align: left; white-space: normal;
  background: none; border-radius: 12px; padding: 9px 8px; margin-left: -8px; min-height: 0; font-weight: 400;
}
.row-main:hover, .row.open .row-main { background: var(--hover); }
.row-title { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.row-meta { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.row-main .row-meta { grid-column: 2; }
.row-meta:empty { display: none; }
.row-edit { padding: 10px 0 18px; }

.due { justify-self: start; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.none { color: var(--text-3); }
.due.soon, .due.over { padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.due.soon { color: var(--warn); background: var(--warn-bg); }
.due.over { color: var(--bad); background: var(--bad-bg); }

/* ---- Forms ---- */

.stack { display: grid; gap: 10px; }
.item-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; max-width: 780px; }
.item-form .wide { grid-column: 1 / -1; }
.segs { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.seg {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px;
  background: var(--btn); font-size: 14px; color: var(--text); cursor: pointer;
}
.seg:has(input:checked) { background: var(--blue); color: var(--on-blue); }
.seg input { accent-color: var(--on-blue); }
.reminder { font-size: 13px; color: var(--text-2); background: var(--field); border-radius: var(--r-ctl); padding: 9px 12px; }
.history { grid-column: 1 / -1; font-size: 13px; }
.history ul { display: grid; gap: 4px; padding-top: 4px; }
.history:empty { display: none; }

.kpi-edit {
  display: grid; grid-template-columns: minmax(160px, 2fr) minmax(100px, 1fr) auto auto auto; gap: 10px 14px; align-items: end;
  padding: 12px 0; border-top: 1px solid var(--hair);
}
.kpi-edit .form-error { grid-column: 1 / -1; }
.kpi-edit .check { padding-bottom: 10px; }

/* ---- Numbers ---- */

.numbers { max-width: 860px; display: grid; gap: 16px; }
.numbers > h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
.num-group { gap: 0; padding-bottom: 10px; }
.num-group h2 { margin-bottom: 8px; font-size: 19px; }
.num-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 150px 200px; gap: 12px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--hair);
}
.num-row.auto { grid-template-columns: 1fr; }
.num-name { font-weight: 500; }
.num-name .pill { margin-left: 8px; }
.sticky {
  position: sticky; bottom: 0; padding: 14px 22px; margin: 0 -22px;
  background: var(--nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hair);
}

/* ---- Navigation on the left on wider screens. Phones keep the bar on top. ---- */

@media (min-width: 900px) {
  .page {
    max-width: none; margin: 0; padding: 0 22px 0 0;
    display: grid; grid-template-columns: 232px minmax(0, 1fr); column-gap: 24px; align-items: start;
  }
  .top {
    height: 100vh; margin: 0; padding: 22px 12px 20px 14px;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 4px;
    background: none; -webkit-backdrop-filter: none; backdrop-filter: none;
    border-bottom: 0; border-right: 1px solid var(--hair);
  }
  .brand { padding: 4px 10px 16px; white-space: nowrap; }
  .top nav { flex: none; flex-direction: column; margin-bottom: auto; }
  .top nav a { padding: 8px 10px; border-radius: 10px; font-size: 15px; }
  .live { padding: 0 10px 8px; }
  .who { flex-direction: column; align-items: flex-start; gap: 8px; padding: 0 10px; }
  main { width: 100%; max-width: 1160px; margin: 0 auto; padding: 22px 0 90px; }
}

/* ---- Narrower screens ---- */

@media (max-width: 1149px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3, .span-4 { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .page { padding: 0 14px 70px; }
  .top { margin: 0 -14px 16px; padding: 10px 14px; }
  .top nav { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
  .live { display: none; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
  .bento > .span-2, .bento > .span-3, .bento > .span-4 { grid-column: 1 / -1; }
  .nums.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .n-value, .nums.n4 .n-value { font-size: 26px; }
  .lights { margin-left: 0; flex-basis: 100%; }
  .kpi, a.work { min-height: 0; }
  .tile, .panel { padding: 20px; border-radius: 24px; }
  .row-main { grid-template-columns: 1fr; }
  .row-main .row-meta { grid-column: 1; }
  .item-form { grid-template-columns: 1fr; }
  .num-row { grid-template-columns: 1fr 1fr; }
  .num-row > div:first-child { grid-column: 1 / -1; }
  .kpi-edit { grid-template-columns: 1fr 1fr; }
  .kpi-edit label:first-child { grid-column: 1 / -1; }
  .sticky { margin: 0 -14px; padding: 12px 14px; }
}
