/* Dayline design system. Light by default; dark only when chosen in Settings.
   Desktop: sidebar + content. Phones and tablets (<= 960px): app header, bottom tab bar, bottom sheets, card lists. */
:root {
  --bg: #f1f4f0; --surface: #ffffff; --surface-2: #f4f6f3; --hover: #eef2ed; --line: #e6eae4; --line-2: #d3d9d1;
  --fg: #111827; --fg-2: #4b5563; --mut: #6b7280;
  --acc: #2f7a4d; --acc-2: #25633e; --acc-soft: #e6f2ea; --acc-fg: #ffffff;
  --ink: #111827; --ink-fg: #ffffff;
  --page-glow: radial-gradient(1200px 520px at 12% -10%, #e3efe4 0%, transparent 60%), radial-gradient(900px 480px at 100% 0%, #edf3ea 0%, transparent 55%);
  --good: #067647; --good-bg: #ecfdf3; --warn: #b54708; --warn-bg: #fffaeb; --bad: #b42318; --bad-bg: #fef3f2; --info-bg: #f2f4f7;
  --st-good: #0ca30c; --st-warn: #fab219; --st-serious: #ec835a; --st-bad: #d03b3b; --st-none: #e5e9e3; --st-now: #2f7a4d;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --grid: #edf0eb; --axis: #d3d9d1;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.04), 0 10px 28px -16px rgba(17, 24, 39, 0.14);
  --shadow-md: 0 4px 10px -2px rgba(17, 24, 39, 0.08), 0 2px 4px -2px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 24px 40px -8px rgba(17, 24, 39, 0.16), 0 8px 12px -6px rgba(17, 24, 39, 0.05);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 18px; --r-sm: 10px;
  --tabbar-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c111d; --surface: #161b26; --surface-2: #1f242f; --hover: #232936; --line: #2a303c; --line-2: #3a4150;
  --fg: #f5f5f6; --fg-2: #cecfd2; --mut: #94969c;
  --acc: #5fc48a; --acc-2: #86d6a7; --acc-soft: #15301f; --acc-fg: #0c111d;
  --ink: #f5f5f6; --ink-fg: #0c111d; --page-glow: none; --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
  --good: #47cd89; --good-bg: #0d2a1d; --warn: #fdb022; --warn-bg: #2f2210; --bad: #f97066; --bad-bg: #351616; --info-bg: #1f242f;
  --st-none: #2a303c; --st-now: #5fc48a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
  --grid: #242a35; --axis: #3a4150;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.35); --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acc); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.mut { color: var(--mut); }
.fg2 { color: var(--fg-2); }
.small { font-size: 12.5px; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.only-mobile { display: none !important; }

/* ---------- Shell: top navigation on desktop ---------- */
body { background: var(--page-glow), var(--bg); background-attachment: fixed; }
.shell { min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; color: var(--fg); text-decoration: none; flex: none; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--mut); letter-spacing: 0; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(150deg, #3f9a63, #24613c); display: grid; place-items: center; flex: none; box-shadow: var(--shadow-md); }
.logo svg { width: 18px; height: 18px; }
.topnav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 4px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); border-radius: 999px; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; color: var(--fg-2); text-decoration: none; font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.topnav a:hover { color: var(--fg); background: var(--hover); }
.topnav a.on { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: var(--shadow-md); }
.topnav a.on svg { color: var(--acc); }
.topnav svg, .tabbar svg, .sheet-nav svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topnav .count { margin-left: 2px; }
.count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
.count.neutral { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line); }
.me-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 4px 4px 4px 4px; border-radius: 999px; }
.me-chip:hover { background: var(--hover); }
.me-chip .who b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; }
.me-chip .who span { font-size: 12px; color: var(--mut); }
@media (max-width: 1240px) { .me-chip .who { display: none; } }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); padding-top: env(safe-area-inset-top, 0px); }
.topbar-in { display: flex; align-items: center; gap: 20px; min-height: 72px; max-width: 1440px; margin: 0 auto; width: 100%; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.topbar h1 { font-size: 17px; letter-spacing: -0.02em; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.topbar .back { margin-left: -8px; }
.clock { font: 500 13px var(--mono); color: var(--fg-2); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); white-space: nowrap; }
.clock i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--st-good); margin-right: 6px; vertical-align: 1px; }
.clock.off i { background: var(--mut); }
@media (max-width: 1240px) { .clock .date { display: none; } }
.content { padding-block: 8px 64px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); max-width: 1440px; width: 100%; margin: 0 auto; }
.page-title { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 22px; }
.page-title h1 { font-size: 28px; letter-spacing: -0.03em; font-weight: 600; }
.page-title p { color: var(--mut); margin-top: 4px; }
.tabbar { display: none; }

/* ---------- Phone + tablet: native app layout ---------- */
@media (max-width: 960px) {
  .only-mobile { display: revert !important; }
  .only-desktop { display: none !important; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .page-title { margin: 6px 0 14px; } .page-title h1 { font-size: 21px; } .page-title:not(.greet) { display: none; }
  .topbar { background: color-mix(in srgb, var(--surface) 92%, transparent); }
  .topbar-in { min-height: 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .topbar h1 { font-size: 17px; }
  .content { padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding: 0 max(4px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(4px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--mut); font-size: 11px; font-weight: 500; text-decoration: none; padding: 6px 0; min-width: 0; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .on { color: var(--acc); }
  .tabbar .on svg { stroke-width: 2.1; }
  .tabbar .count { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 18px; line-height: 16px; font-size: 10px; padding: 0 5px; }
  .tabbar span.lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  .toasts { top: auto !important; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom, 0px)); left: 16px; right: 16px !important; align-items: stretch !important; }
  .toast { max-width: none !important; }
}

/* ---------- Building blocks ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c5 { grid-column: span 5; } .c4 { grid-column: span 4; }
@media (max-width: 1180px) { .c8, .c7, .c6, .c5, .c4 { grid-column: span 12; } }
.card { background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--r); box-shadow: var(--shadow-card); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px 12px; flex-wrap: wrap; }
.card-h h2 { font-size: 15px; }
.card-h .sub { font-size: 12.5px; color: var(--mut); }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-b { padding: 16px 20px 20px; }
.card-b.flush { padding: 0; }
.empty { padding: 32px 16px; text-align: center; color: var(--mut); }
.empty b { display: block; color: var(--fg-2); font-weight: 600; margin-bottom: 2px; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--fg-2); }
.page-head .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 960px) {
  .page-head { margin-bottom: 14px; }
  .page-head .right { margin-left: 0; width: 100%; }
  .page-head .right > select.in { flex: 1 1 140px; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 13.5px; line-height: 1.3; white-space: nowrap; text-decoration: none; box-shadow: var(--shadow); }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.pri { background: var(--ink); border-color: var(--ink); color: var(--ink-fg); }
.btn.pri:hover { background: color-mix(in srgb, var(--ink) 85%, var(--acc)); border-color: transparent; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--fg-2); box-shadow: none; }
.btn.ghost:hover { background: var(--hover); color: var(--fg); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.lg { padding: 12px 18px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { padding: 8px; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.link-btn { border: 0; background: none; padding: 0; color: var(--acc); font-weight: 600; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--fg-2); white-space: nowrap; }
.seg button.on { background: var(--ink); color: var(--ink-fg); }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.field small { color: var(--mut); font-size: 12px; }
.in, select.in { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 14px; width: 100%; min-width: 0; box-shadow: var(--shadow); }
.in:focus { outline: 3px solid color-mix(in srgb, var(--acc) 22%, transparent); border-color: var(--acc); }
textarea.in { min-height: 92px; resize: vertical; }
@media (max-width: 960px) { .in, select.in { font-size: 16px; padding: 11px 12px; } }
.code-in { font: 600 26px var(--mono); letter-spacing: 0.4em; text-align: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-grid .full { grid-column: 1 / -1; }
.err { color: var(--bad); font-weight: 500; font-size: 13px; min-height: 1.3em; }

/* Status chips: icon + label, never color alone */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--info-bg); color: var(--fg-2); line-height: 1.6; }
.chip .ic { font-size: 10px; line-height: 1; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.acc { background: var(--acc-soft); color: var(--acc); }
.chip.outline { background: transparent; border: 1px solid var(--line-2); }
.role { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line); }
.role.admin { background: var(--acc-soft); color: var(--acc); border-color: transparent; }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 16px; }
.kpi { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .lbl { font-size: 13px; color: var(--fg-2); font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .kic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc); flex: none; }
.kpi .kic.bad { background: var(--bad-bg); color: var(--bad); } .kpi .kic.warn { background: var(--warn-bg); color: var(--warn); }
.kpi .kic svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi .val { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.kpi .val small { font-size: 14px; color: var(--mut); font-weight: 500; margin-left: 2px; }
.kpi .foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--mut); min-height: 22px; flex-wrap: wrap; }
.kpi .val-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.delta { font-weight: 600; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 24px; }
  .kpi .val-row [data-chart] { display: none; }
  .grid { gap: 12px; }
}

/* ---------- Tables (become card lists on phones when .resp) ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--mut); padding: 10px 20px; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 13px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.num { font-variant-numeric: tabular-nums; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover td { background: var(--hover); }
.tbl tr.me td { background: var(--acc-soft); }
.person-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-cell b { font-weight: 600; display: block; }
.person-cell span { font-size: 12.5px; color: var(--mut); }
@media (max-width: 960px) {
  .tbl.resp thead { display: none; }
  .tbl.resp, .tbl.resp tbody, .tbl.resp tr, .tbl.resp td { display: block; width: 100%; }
  .tbl.resp tr { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; }
  .tbl.resp tr:last-child { border-bottom: 0; }
  .tbl.resp td { padding: 0; border: 0; text-align: left !important; min-width: 0; }
  .tbl.resp td[data-l]::before { content: attr(data-l); display: block; font-size: 11.5px; font-weight: 500; color: var(--mut); margin-bottom: 2px; }
  .tbl.resp td.wide { grid-column: 1 / -1; }
  .tbl.resp td.hide-m { display: none; }
  .tbl.resp td.act { grid-column: 1 / -1; }
  .tbl.resp td.act .row { justify-content: flex-start !important; }
}

/* Segment progress (one block per time block) */
.segs { display: flex; gap: 2px; height: 8px; min-width: 120px; }
.segs i { flex: 1; border-radius: 2px; background: var(--st-none); }
.segs i.done { background: var(--st-good); } .segs i.partial { background: var(--st-warn); }
.segs i.missed, .segs i.overdue, .segs i.rejected { background: var(--st-bad); }
.segs i.now { background: var(--st-now); }

.score-pill { display: inline-flex; align-items: baseline; gap: 1px; font-weight: 600; font-variant-numeric: tabular-nums; }
.score-pill small { color: var(--mut); font-weight: 500; font-size: 11px; }
.t-good { color: var(--good); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); }
.strikes { display: inline-flex; gap: 3px; vertical-align: middle; }
.strikes i { width: 8px; height: 8px; border-radius: 2px; border: 1px solid var(--line-2); }
.strikes i.on { background: var(--st-bad); border-color: var(--st-bad); }

/* ---------- Feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.feed .dot.good { background: var(--good-bg); color: var(--good); } .feed .dot.warn { background: var(--warn-bg); color: var(--warn); }
.feed .dot.bad { background: var(--bad-bg); color: var(--bad); } .feed .dot.info { background: var(--info-bg); color: var(--fg-2); }
.feed .txt { min-width: 0; overflow-wrap: anywhere; }
.feed .txt b { font-weight: 600; }
.feed time { font: 12px var(--mono); color: var(--mut); white-space: nowrap; }
.feed li.feed-day { display: block; padding: 8px 18px; font-size: 12px; font-weight: 600; color: var(--mut); background: var(--surface-2); }

.att { list-style: none; margin: 0; padding: 0; }
.att li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.att li:last-child { border-bottom: 0; }
.att .txt { min-width: 0; flex: 1; }
.att .txt b { font-weight: 600; }
.review-item { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.review-item:last-child { border-bottom: 0; }

/* ---------- Day ---------- */
.day-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; padding: 22px; }
.big-score { font-size: 56px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.big-score small { font-size: 18px; color: var(--mut); font-weight: 500; letter-spacing: 0; }
.day-hero .meta { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.day-hero .segs { height: 10px; }
.day-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-nav b { min-width: 0; }
.day-nav .cta { margin-left: auto; }
@media (max-width: 600px) {
  .day-hero { grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 16px; }
  .big-score { font-size: 42px; }
  .day-nav .cta { margin-left: 0; width: 100%; }
  .day-nav .cta.btn { min-height: 46px; font-size: 15px; }
}
.slots { list-style: none; margin: 0; padding: 0; }
.slot { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 4px 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); position: relative; }
.slot:last-child { border-bottom: 0; }
.slot::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.slot.now::before { background: var(--st-now); } .slot.done::before { background: var(--st-good); } .slot.partial::before { background: var(--st-warn); }
.slot.missed::before, .slot.overdue::before, .slot.rejected::before { background: var(--st-bad); }
.slot.now { background: color-mix(in srgb, var(--acc) 5%, var(--surface)); }
.slot.upcoming .body { opacity: 0.72; }
.slot time { font: 500 12.5px/1.55 var(--mono); color: var(--fg-2); }
.slot .body { min-width: 0; }
.slot h3 { font-size: 14.5px; font-weight: 600; }
.slot .deliv { color: var(--fg-2); font-size: 13px; }
.slot .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.slot .pts { font: 12px var(--mono); color: var(--mut); white-space: nowrap; }
.slot .extra { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 8px; }
.note-box { background: var(--surface-2); border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-box b { display: block; font-size: 11.5px; font-weight: 600; color: var(--mut); }
@media (max-width: 600px) {
  .slot { grid-template-columns: 50px minmax(0, 1fr); padding: 14px 16px; }
  .slot .side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
  .slot .extra { grid-column: 1 / -1; }
  .slot .extra .row .btn { flex: 1; }
}

.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r); padding: 12px 14px; margin-bottom: 16px; font-weight: 500; border: 1px solid; }
.banner.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.banner.info { background: var(--acc-soft); color: var(--acc-2); border-color: color-mix(in srgb, var(--acc) 18%, transparent); }

.metric-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.metric-row:last-of-type { border-bottom: 0; }
.metric-row .bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.metric-row .bar i { display: block; height: 100%; border-radius: 3px; }

/* ---------- Kanban (swipeable columns on phones) ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.col { background: color-mix(in srgb, var(--surface) 55%, transparent); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-height: 220px; }
.col.drop { outline: 2px dashed var(--acc); outline-offset: -4px; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 600; font-size: 13.5px; }
.col-h .n { color: var(--mut); font-weight: 500; }
.col-h .bar { width: 8px; height: 8px; border-radius: 2px; }
.col-b { display: flex; flex-direction: column; gap: 8px; padding: 0 10px 10px; }
@media (max-width: 960px) {
  .board { grid-template-columns: repeat(4, 86%); scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px 8px; scroll-padding: 0 16px; gap: 10px; }
  .col { scroll-snap-align: start; }
}
.tcard { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); width: 100%; }
.tcard:hover { border-color: var(--line-2); }
.tcard[draggable="true"] { cursor: grab; }
.tcard.dragging { opacity: 0.5; }
.tcard h4 { font-size: 13.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.tcard .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--fg-2); }
.tcard .meta .due { margin-left: auto; font-family: var(--mono); font-size: 11.5px; }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--fg-2); }
.prio i { width: 6px; height: 6px; border-radius: 50%; background: var(--mut); }
.prio.high i { background: var(--st-serious); } .prio.urgent i { background: var(--st-bad); } .prio.medium i { background: var(--s1); }
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--fg-2); }
.flow b { color: var(--fg); font-weight: 600; }
.flow .arr { color: var(--mut); }

/* ---------- Drawer, modal; bottom sheets on phones ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(16, 24, 40, 0.5); display: flex; justify-content: flex-end; animation: fade 0.15s ease; }
.drawer { width: min(580px, 100%); height: 100%; background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); animation: slide-l 0.2s ease; }
.drawer-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-h h2 { font-size: 17px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
.modal { width: min(540px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 22px; display: flex; flex-direction: column; gap: 14px; animation: pop 0.16s ease; }
.modal h2 { font-size: 18px; }
.grabber { display: none; }
@media (max-width: 960px) {
  .overlay.center { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; border: 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom, 0px)); animation: sheet 0.22s ease; }
  .modal .row > .btn { flex: 1; }
  .grabber { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 4px; flex: none; }
  .drawer { width: 100%; border-left: 0; animation: sheet 0.22s ease; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } }
@keyframes sheet { from { transform: translateY(40px); opacity: 0.4; } }
@keyframes slide-l { from { transform: translateX(30px); opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .overlay, .modal, .drawer { animation: none; } }
.sheet-nav { display: flex; flex-direction: column; margin: 0 -8px; }
.sheet-nav a, .sheet-nav button { display: flex; align-items: center; gap: 14px; padding: 13px 10px; border-radius: 10px; border: 0; background: none; color: var(--fg); text-decoration: none; font-weight: 500; font-size: 15px; text-align: left; }
.sheet-nav a:hover, .sheet-nav button:hover { background: var(--hover); }
.sheet-nav .count { margin-left: auto; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--mut); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.log li { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 10px; }
.log li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-top: 6px; }
.log li.comment::before { background: var(--acc); }
.log li.approved::before { background: var(--st-good); } .log li.rejected::before { background: var(--st-bad); }
.log .meta { font-size: 12px; color: var(--mut); }
.log .text { overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font: 11px var(--sans); fill: var(--mut); }
.chart .lbl-strong { fill: var(--fg-2); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--fg-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .line-key { width: 14px; height: 2px; border-radius: 1px; }
.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--surface); color: var(--fg); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12.5px; min-width: 140px; max-width: 260px; }
.tip b { display: block; font-weight: 600; margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .r span { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); }
.tip .r em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }

.heat { display: grid; gap: 3px; align-items: center; min-width: max-content; }
.heat .h-name { font-size: 12.5px; font-weight: 500; padding-right: 10px; white-space: nowrap; color: var(--fg-2); }
.heat .h-day { font: 10.5px var(--mono); color: var(--mut); text-align: center; }
.heat .cell { width: 30px; height: 26px; border-radius: 4px; background: var(--st-none); display: grid; place-items: center; font: 600 10.5px var(--sans); font-variant-numeric: tabular-nums; color: #fff; }
.heat .cell.good { background: var(--st-good); } .heat .cell.warn { background: var(--st-warn); color: #0b0b0b; } .heat .cell.bad { background: var(--st-bad); }
.heat .cell.na { background: transparent; border: 1px dashed var(--line-2); color: var(--mut); }
.heat-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--fg-2); margin-top: 12px; }
.heat-legend span { display: inline-flex; align-items: center; gap: 6px; }

.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.mini { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mini h4 { font-size: 13px; font-weight: 600; }
.mini .sub { font-size: 12px; color: var(--mut); }

/* People cards */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
@media (max-width: 960px) { .people { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.pcard { text-align: left; background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-card); color: inherit; text-decoration: none; min-width: 0; }
.pcard:hover { border-color: var(--line-2); box-shadow: var(--shadow-md); }
.pcard.alert { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.pcard .top { display: flex; align-items: center; gap: 12px; }
.pcard .top .nm { min-width: 0; flex: 1; }
.pcard .top b { display: block; font-weight: 600; font-size: 15px; }
.pcard .top span { font-size: 12.5px; color: var(--mut); }
.pcard .sc { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pcard .cur { font-size: 13px; color: var(--fg-2); min-height: 38px; }
.pcard .foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--fg-2); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--acc); border-bottom-color: var(--acc); }
@media (max-width: 960px) { .tabs { position: sticky; top: calc(56px + env(safe-area-inset-top, 0px)); z-index: 5; background: var(--bg); margin: 0 -16px 14px; padding: 0 16px; } .tabs a { flex: 1; text-align: center; } }

.plan-tbl input { background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0; }
.plan-tbl td { padding: 6px 8px; }
.plan-tbl .tm { width: 108px; } .plan-tbl .pt { width: 84px; }
@media (max-width: 960px) {
  .plan-tbl { min-width: 0 !important; }
  .plan-tbl thead { display: none; }
  .plan-tbl, .plan-tbl tbody { display: block; }
  .plan-tbl tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
  .plan-tbl td { padding: 0; border: 0; display: block; }
  .plan-tbl td.wide { grid-column: 1 / -1; }
  .plan-tbl .tm, .plan-tbl .pt { width: 100%; }
  .plan-tbl input { font-size: 16px; padding: 9px; }
}

/* ---------- Sign in ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.login-art { background: radial-gradient(700px 400px at 20% 0%, #dcecdd 0%, transparent 60%), linear-gradient(165deg, #eef5ec 0%, #f6f8f4 55%, #e8f1e8 100%); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; border-right: 1px solid var(--line); }
.login-art h1 { font-size: 40px; letter-spacing: -0.03em; line-height: 1.1; max-width: 15ch; }
.login-art p { color: var(--fg-2); max-width: 44ch; font-size: 15px; }
.login-art ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.login-art li { background: rgba(255, 255, 255, 0.75); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--fg-2); }
.login-art li b { display: block; color: var(--fg); font-size: 14px; margin-bottom: 2px; }
.login-form { display: grid; place-items: center; padding: calc(32px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
.login-in { width: min(400px, 100%); display: flex; flex-direction: column; gap: 20px; }
.login-in h2 { font-size: 26px; letter-spacing: -0.02em; }
.login-in .mobile-brand { display: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--mut); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
@media (max-width: 960px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .login-form { place-items: start center; padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
  .login-in .mobile-brand { display: flex; }
}

/* Toasts */
.toasts { position: fixed; top: calc(76px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { background: #101828; color: #fff; border-radius: 12px; padding: 11px 14px; max-width: min(420px, calc(100vw - 32px)); font-size: 13.5px; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: flex-start; animation: pop 0.16s ease; }
.toast .ic { font-weight: 700; }
.toast.bad .ic { color: #fda29b; } .toast.good .ic { color: #75e0a7; }

.skeleton { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2), var(--hover), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---------- Brand pieces ---------- */
.logo { background: linear-gradient(150deg, #3a9e66, #1b5534); position: relative; overflow: hidden; }
.logo::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.28), transparent 60%); }
.logo svg { width: 22px; height: 22px; position: relative; z-index: 1; }
.brand > span { font-size: 17px; letter-spacing: -0.03em; }
.empty-art { display: block; width: 104px; height: 73px; margin: 0 auto 12px; }
.hero-art { width: 100%; max-width: 520px; height: auto; margin-top: 10px; filter: drop-shadow(0 18px 30px rgba(27, 85, 52, 0.14)); }
.hero-art text { font-family: var(--sans); }

/* ---------- Interaction feedback ---------- */
.btn, .topnav a, .tabbar a, .tabbar button, .pcard, .tcard, .card, .seg button, .me-chip, .tbl tbody tr { transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.18s ease; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.pcard:hover, .tcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi:hover { transform: translateY(-1px); }
.tabbar a.on::before, .tabbar button.on::before { content: ""; position: absolute; top: 6px; left: 50%; width: 54px; height: 30px; margin-left: -27px; border-radius: 999px; background: var(--acc-soft); z-index: -1; animation: pill 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
.tabbar a, .tabbar button { z-index: 0; }
.tabbar a:active svg, .tabbar button:active svg { transform: scale(0.88); }
.tabbar svg { transition: transform 0.15s ease; }
.segs i { transition: background-color 0.4s ease; }
.metric-row .bar i { transition: width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.toast { animation: toast-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1); }
.count { animation: pop-in 0.3s cubic-bezier(0.3, 1.5, 0.5, 1); }

/* ---------- Page entrance (only when a page opens, never on live refresh) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .enter > *, .enter .kpis > *, .enter .grid > *, .enter .people > *, .enter .board > .col, .enter .slots > li, .enter .feed > li, .enter .att > li, .enter .review-item {
    animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .enter > :nth-child(2), .enter .kpis > :nth-child(2), .enter .grid > :nth-child(2), .enter .people > :nth-child(2), .enter .board > :nth-child(2), .enter .slots > :nth-child(2), .enter .feed > :nth-child(2), .enter .att > :nth-child(2) { animation-delay: 0.05s; }
  .enter > :nth-child(3), .enter .kpis > :nth-child(3), .enter .grid > :nth-child(3), .enter .people > :nth-child(3), .enter .board > :nth-child(3), .enter .slots > :nth-child(3), .enter .feed > :nth-child(3), .enter .att > :nth-child(3) { animation-delay: 0.1s; }
  .enter > :nth-child(4), .enter .kpis > :nth-child(4), .enter .grid > :nth-child(4), .enter .people > :nth-child(4), .enter .board > :nth-child(4), .enter .slots > :nth-child(4), .enter .feed > :nth-child(4), .enter .att > :nth-child(4) { animation-delay: 0.15s; }
  .enter .kpis > :nth-child(5), .enter .grid > :nth-child(5), .enter .people > :nth-child(5), .enter .slots > :nth-child(5), .enter .feed > :nth-child(5) { animation-delay: 0.2s; }
  .enter .grid > :nth-child(n+6), .enter .people > :nth-child(n+6), .enter .slots > :nth-child(n+6), .enter .feed > :nth-child(n+6) { animation-delay: 0.25s; }
  .enter .an-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.2s 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
  .enter .an-fade { animation: fade 0.9s 0.6s both; }
  .enter .an-up { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .enter .an-right { transform-box: fill-box; transform-origin: 0 50%; animation: grow-x 0.8s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .enter .segs i, .enter .metric-row .bar i { transform-origin: 0 50%; animation: grow-x 0.6s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .enter .heat .cell { animation: pop-in 0.4s cubic-bezier(0.3, 1.4, 0.5, 1) both; animation-delay: 0.2s; }
  .enter .big-score { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

  /* Sign-in screen */
  .login-in > * { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .login-in > :nth-child(2) { animation-delay: 0.06s; } .login-in > :nth-child(3) { animation-delay: 0.12s; } .login-in > :nth-child(4) { animation-delay: 0.18s; } .login-in > :nth-child(5) { animation-delay: 0.24s; }
  .login .logo-check { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.7s 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
  .login .logo-sun { transform-box: fill-box; transform-origin: center; animation: pop-in 0.5s 0.75s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
  .login-art > * { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .ha-card { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .ha-2 { animation-delay: 0.15s; } .ha-3 { animation-delay: 0.3s; }
  .ha-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
  .ha-fade { animation: fade 1s 1.4s both; }
  .ha-pop { transform-box: fill-box; transform-origin: center; animation: pop-in 0.5s 2s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
  .ha-ring { animation: ring 1.4s 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero-art .ha-card:nth-of-type(1) { }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.6); } }
@keyframes pill { from { opacity: 0; transform: scale(0.6); } }
@keyframes ring { from { stroke-dasharray: 0 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
@media (max-width: 960px) { @keyframes toast-in { from { opacity: 0; transform: translateY(12px); } } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

/* Phone: one Kanban column at a time, chosen with the switcher */
@media (max-width: 960px) {
  .col-seg { display: flex !important; width: 100%; margin-bottom: 12px; }
  .col-seg button { flex: 1; padding: 8px 6px; font-size: 12.5px; }
  .board { grid-template-columns: minmax(0, 1fr); overflow: visible; margin: 0; padding: 0; scroll-snap-type: none; }
  .board .col { display: none; min-height: 0; }
  .board[data-show="todo"] .col[data-col="todo"], .board[data-show="doing"] .col[data-col="doing"],
  .board[data-show="submitted"] .col[data-col="submitted"], .board[data-show="approved"] .col[data-col="approved"] { display: flex; }
  .board .col-h { display: none; }
  .board .col-b { padding: 10px; }
  .tbl.resp tr.me { background: var(--acc-soft); }
  .tbl.resp tr.me td { background: transparent; }
}

/* ---------- Sunny the mascot + profile photos ---------- */
.mascot { display: block; overflow: visible; }
.mascot.empty-art { width: 92px; height: 92px; margin: 0 auto 10px; }
.mascot.sm { width: 64px; height: 64px; flex: none; }
.mascot.login-mascot { width: 84px; height: 84px; margin: 0 0 -6px -6px; }
.done-hero { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 12px; border-radius: 14px; background: var(--acc-soft); }
.done-hero b { display: block; color: var(--acc-2); }
.avatar.photo { background: var(--surface-2); overflow: hidden; box-shadow: 0 0 0 2px var(--surface); }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
  .mascot .m-body { animation: float 3.2s ease-in-out infinite; transform-origin: 60px 100px; }
  .mascot .m-shadow { animation: shadow 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .mascot .m-rays { animation: spin 22s linear infinite; transform-origin: 60px 62px; }
  .mascot .m-wave { animation: wave 1.6s ease-in-out infinite; transform-origin: 91px 66px; }
  .mascot.cheer .m-body { animation: hop 1.4s cubic-bezier(0.3, 0, 0.3, 1) infinite; }
  .mascot .m-dots circle { animation: blink 1.8s ease-in-out infinite; }
  .mascot .m-dots circle:nth-child(2) { animation-delay: 0.2s; } .mascot .m-dots circle:nth-child(3) { animation-delay: 0.4s; }
}
@keyframes float { 50% { transform: translateY(-4px); } }
@keyframes shadow { 50% { transform: scaleX(0.85); opacity: 0.06; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 20% { transform: rotate(-16deg); } 40% { transform: rotate(10deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-8px) scale(1.02, 0.98); } 50% { transform: translateY(0) scale(1.03, 0.97); } }
@keyframes blink { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ---------- Customer brand (workspace logo) ---------- */
.org-mark { display: inline-flex; align-items: center; gap: 6px; min-width: 0; vertical-align: middle; }
.org-mark img { width: 16px; height: 16px; border-radius: 4px; object-fit: contain; background: #000; flex: none; }
.org-mark > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-mark.big { gap: 10px; font-weight: 600; font-size: 15px; color: var(--fg); }
.org-mark.big img { width: 36px; height: 36px; border-radius: 10px; box-shadow: var(--shadow-md); }
.made-for { display: flex; flex-direction: column; gap: 8px; }
.brand small .org-mark { font-size: 12px; }
.org-logo-prev { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #000; border: 1px solid var(--line); }
.org-logo-prev.empty { background: var(--surface-2); display: inline-block; }

/* ---------- Install + notification setup ---------- */
.setup-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin: 6px 0 4px; border-radius: var(--r); background: linear-gradient(120deg, var(--acc-soft), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--acc) 22%, transparent); box-shadow: var(--shadow-card); flex-wrap: wrap; }
.setup-card .txt { flex: 1; min-width: 200px; }
.setup-card .txt b { display: block; font-size: 15px; }
.setup-card .txt span { color: var(--fg-2); font-size: 13px; }
.kic.big { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--acc); color: #fff; flex: none; }
.kic.big svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.set-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.set-row > div:first-child { min-width: 0; flex: 1; }
.set-row b { display: block; }
.set-row span { font-size: 13px; color: var(--fg-2); }
.install-btn svg { color: var(--acc); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--fg-2); }

/* ---------- Messages ---------- */
.chat-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; height: calc(100vh - 200px); min-height: 480px; }
.chat-side, .chat-main { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-list { list-style: none; margin: 0; padding: 4px 8px 8px; overflow-y: auto; flex: 1; }
.chat-list a { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; }
.chat-list a:hover { background: var(--hover); }
.chat-list a.on { background: var(--acc-soft); }
.chat-list .mid { flex: 1; min-width: 0; }
.chat-list .top { display: flex; gap: 8px; align-items: baseline; }
.chat-list .top b { flex: 1; min-width: 0; font-weight: 600; }
.chat-list time { font: 11.5px var(--mono); color: var(--mut); flex: none; }
.chat-list .sub { font-size: 13px; color: var(--fg-2); }
.chat-list .count { margin-left: 0; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line); white-space: nowrap; }
.avatar.group { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line); }
.avatar.group svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.thread-h { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.thread-b { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.thread-empty { flex: 1; display: grid; place-items: center; }
.day-sep { text-align: center; margin: 10px 0 4px; }
.day-sep span { font-size: 11.5px; font-weight: 600; color: var(--mut); background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; }
.msg.mine { margin-left: auto; flex-direction: row-reverse; }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; box-shadow: var(--shadow); min-width: 0; }
.msg.mine .bubble { background: var(--acc); color: #fff; border-color: var(--acc); border-radius: 16px 16px 4px 16px; }
.msg.mine .bubble a { color: #fff; }
.bubble b { display: block; font-size: 12px; color: var(--acc); }
.bubble .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble time { display: block; text-align: right; font: 10.5px var(--mono); opacity: 0.65; margin-top: 2px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { min-height: 42px; max-height: 160px; resize: none; border-radius: 20px; padding: 10px 14px; }
.composer .btn.icon { width: 42px; height: 42px; border-radius: 50%; flex: none; }
.composer.closed { color: var(--mut); font-size: 13px; justify-content: center; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.pick-row:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); }
.pick-row input { width: 18px; height: 18px; accent-color: var(--acc); }
.pick-row span b { display: block; font-size: 14px; }
.pick-row span small { color: var(--mut); font-size: 12px; }
@media (max-width: 960px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 56px - var(--tabbar-h) - 60px - env(safe-area-inset-bottom, 0px)); min-height: 0; }
  .chat-layout.has-thread .chat-side { display: none; }
  .chat-layout:not(.has-thread) .chat-main { display: none; }
  .msg { max-width: 88%; }
}
