/* dashboard.meshconnector.com: inherits meshconnector.com's world (css/site.css):
   ink navy, signal blue as the thread, Ginger red only for "needs you". */
:root {
  --ink: #0a1a33;
  --ink-2: #55627a;
  --ink-3: #8a94a6;
  --ground: #eef2f7;
  --paper: #ffffff;
  --rule: #dde3ec;
  --rule-strong: #c4cdda;
  --thread: #1f5eff;
  --thread-soft: #dfe8ff;
  --thread-bright: #4d8bff;
  --action: #e0332b;
  --action-soft: #fde4e2;
  --action-text: #b8231c;
  --ok: #158a5a;
  --band: #0b1730;
  --band-2: #13254a;
  --band-ink: #eef3ff;
  --band-ink-2: #9db8ea;
  --band-rule: rgba(157, 184, 234, 0.22);
  --hatch: rgba(10, 26, 51, 0.045);
  --shadow: 0 10px 30px -12px rgba(10, 26, 51, 0.28), 0 2px 6px -2px rgba(10, 26, 51, 0.12);

  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --gutter: clamp(16px, 3vw, 40px);
  --label-col: 232px;
  --total-col: 148px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8eef9;
    --ink-2: #a9b6cc;
    --ink-3: #7c89a1;
    --ground: #070f1f;
    --paper: #0d1a33;
    --rule: #1d2d4d;
    --rule-strong: #2a3d63;
    --thread: #5b8cff;
    --thread-soft: #17295a;
    --thread-bright: #7aa4ff;
    --action: #ff6b63;
    --action-soft: #3a1416;
    --action-text: #ff8a83;
    --ok: #3fbf86;
    --band: #050b18;
    --band-2: #0c1830;
    --hatch: rgba(232, 238, 249, 0.04);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e8eef9; --ink-2: #a9b6cc; --ink-3: #7c89a1; --ground: #070f1f; --paper: #0d1a33;
  --rule: #1d2d4d; --rule-strong: #2a3d63; --thread: #5b8cff; --thread-soft: #17295a;
  --thread-bright: #7aa4ff; --action: #ff6b63; --action-soft: #3a1416; --action-text: #ff8a83; --ok: #3fbf86;
  --band: #050b18; --band-2: #0c1830; --hatch: rgba(232, 238, 249, 0.04);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--thread-bright); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--paper); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.linkish { background: none; border: 0; padding: 4px 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ------------------------------------------------ gate */
.gate { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 80% at 50% 0%, var(--band-2), var(--band)); color: var(--band-ink); }
.gate-form { width: min(380px, 100%); display: grid; gap: 14px; }
.gate-mark { width: 44px; height: 44px; color: var(--band-ink); }
.gate h1 { font-size: 30px; line-height: 1.1; }
.gate p { margin: 0; color: var(--band-ink-2); }
.gate input { font: 600 20px/1 var(--font-mono); letter-spacing: 0.08em; padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--band-rule); background: rgba(255,255,255,0.06); color: var(--band-ink); width: 100%; }
.gate input::placeholder { color: rgba(157, 184, 234, 0.55); }
.gate input:focus { outline: 2px solid var(--thread-bright); outline-offset: 1px; }
.gate button { padding: 14px; border: 0; border-radius: 10px; background: var(--thread); color: #fff; font-weight: 600; cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease); }
.gate button:hover { background: #3a73ff; }
.gate button:active { transform: translateY(1px); }
.gate button[disabled] { opacity: .6; cursor: progress; }
.gate-error { min-height: 1.5em; color: #ffb3ae !important; }

/* ------------------------------------------------ band (header + ledger) */
.band { background: linear-gradient(180deg, var(--band) 0%, var(--band-2) 100%); color: var(--band-ink); }
.band-inner { max-width: 1480px; margin: 0 auto; padding: 18px var(--gutter) 30px; }
.topline { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 17px/1 var(--font-display); letter-spacing: -0.01em; }
.brand svg { width: 28px; height: 28px; }
.weeknav { display: flex; align-items: center; gap: 6px; }
.weeknav button { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--band-rule);
  background: transparent; cursor: pointer; transition: background .2s var(--ease); }
.weeknav button svg { width: 18px; height: 18px; }
.weeknav button:hover:not([disabled]) { background: rgba(157, 184, 234, 0.14); }
.weeknav button[disabled] { opacity: .3; cursor: default; }
.weeklabel { min-width: 168px; text-align: center; display: grid; line-height: 1.2; }
.weeklabel strong { font: 600 16px/1.2 var(--font-body); }
.weeklabel span { font-size: 12px; color: var(--band-ink-2); }
.meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--band-ink-2); }
.meta .linkish { color: var(--band-ink); }

.summary { margin: 30px 0 22px; max-width: 30ch; font-size: clamp(26px, 3.4vw, 44px); line-height: 1.08; font-weight: 600; text-wrap: balance; }
.summary b { font-weight: 800; color: #fff; }
.summary .soft { color: var(--band-ink-2); font-weight: 500; }

.ledger-wrap { overflow-x: auto; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); scrollbar-width: thin; }
.ledger { border-collapse: collapse; width: 100%; min-width: 760px; }
.ledger th, .ledger td { text-align: left; padding: 12px 18px 12px 0; vertical-align: top; border-top: 1px solid var(--band-rule); }
.ledger thead th { border-top: 0; font: 500 12px/1 var(--font-body); color: var(--band-ink-2); padding-bottom: 10px; }
.ledger tbody th { font: 500 14px/1.3 var(--font-body); color: var(--band-ink); width: 26%; }
.ledger tbody th small { display: block; color: var(--band-ink-2); font-size: 12px; font-weight: 400; margin-top: 2px; }
.ledger .now { font: 700 26px/1 var(--font-mono); letter-spacing: -0.02em; color: #fff; }
.ledger .then { font: 500 16px/1.6 var(--font-mono); color: var(--band-ink-2); }
.ledger .unknown { font: 500 14px/1.5 var(--font-body); color: var(--band-ink-2); }
.delta { display: inline-flex; align-items: center; gap: 4px; font: 600 14px/1.6 var(--font-mono); white-space: nowrap; }
.delta svg { width: 12px; height: 12px; }
.band .delta.up { color: #6fe0a8; }
.band .delta.down { color: var(--band-ink-2); }
.band .delta.flat { color: var(--band-ink-2); }
.ledger .src { font-size: 12px; color: var(--band-ink-2); }

.needs { margin: 18px 0 0; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  background: rgba(224, 51, 43, 0.14); color: #ffd9d6; font-size: 14px; max-width: 920px; }
.needs svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: #ff8a83; }
.needs a { color: #fff; }
.needs .fixbtn { display: inline-block; margin-left: 6px; padding: 4px 10px; border-radius: 8px; background: var(--action); color: #fff;
  font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .2s var(--ease); }
.needs .fixbtn:hover { background: #c42a23; }

/* ------------------------------------------------ run-sheet */
.sheet-wrap { max-width: 1480px; margin: 0 auto; padding: 34px var(--gutter) 10px; }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; margin-bottom: 14px; }
.sheet-head h2 { font-size: 24px; }
.sheet-head p { margin: 0; color: var(--ink-2); font-size: 13px; }

.sheet { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--paper); border-radius: 14px;
  box-shadow: var(--shadow); table-layout: fixed; }
.sheet col.c-label { width: var(--label-col); }
.sheet col.c-total { width: var(--total-col); }
.sheet thead th { position: sticky; top: 0; z-index: 3; background: var(--paper); padding: 14px 10px 10px; text-align: left;
  font: 500 12px/1.2 var(--font-body); color: var(--ink-2); border-bottom: 1px solid var(--rule-strong); }
.sheet thead th:first-child { border-top-left-radius: 14px; padding-left: 20px; }
.sheet thead th:last-child { border-top-right-radius: 14px; text-align: right; padding-right: 20px; }
.sheet thead .dname { display: block; font: 600 13px/1.2 var(--font-body); color: var(--ink); }
.sheet thead th.today { color: var(--thread); }
.sheet thead th.today .dname { color: var(--thread); }
.sheet thead th.today::after { content: ""; display: block; height: 3px; margin-top: 8px; border-radius: 2px; background: var(--thread); }

.sheet tbody.group th.gname { padding: 22px 20px 8px; text-align: left; font: 700 15px/1 var(--font-display); letter-spacing: -0.01em;
  color: var(--ink); border-bottom: 1px solid var(--rule); }
.sheet tbody.group:first-of-type th.gname { padding-top: 16px; }

.lane > * { border-bottom: 1px solid var(--rule); }
.lane th { text-align: left; padding: 0; font-weight: 400; }
.lane-btn { display: grid; gap: 2px; width: 100%; height: 100%; min-height: 74px; padding: 12px 12px 12px 20px; border: 0; background: none; text-align: left; cursor: pointer;
  transition: background .2s var(--ease); }
.lane-btn:hover { background: var(--thread-soft); }
.lane-btn .lname { display: flex; align-items: center; gap: 8px; font: 600 14px/1.25 var(--font-body); }
.lane-btn .lname svg { width: 14px; height: 14px; color: var(--ink-3); transition: transform .25s var(--ease); flex: none; }
.lane-btn[aria-expanded="true"] .lname svg { transform: rotate(90deg); color: var(--thread); }
.lane-btn .lsub { font-size: 12px; color: var(--ink-2); }
.lane-btn .lfollow { font-size: 12px; color: var(--ink-2); }
.lane-btn .lfollow .num { color: var(--ink); font-weight: 700; }
.lane-btn .lfollow .gain { color: var(--ok); font-weight: 700; }

.day { position: relative; padding: 8px 8px 0; vertical-align: bottom; height: 82px; border-left: 1px solid var(--rule); cursor: default; }
.day.today { background: color-mix(in oklab, var(--thread-soft) 55%, transparent); }
.day.future { background-image: repeating-linear-gradient(135deg, var(--hatch) 0 6px, transparent 6px 12px); }
.day.lag .bar-slot::after { content: "pending"; position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--ink-3); }
.day:focus-visible { outline-offset: -2px; }
.marks { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 3px; }
.mark { width: 10px; height: 10px; border-radius: 2.5px; background: var(--ink); }
.mark.sched { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.mark.more { width: auto; height: 10px; background: none; font: 600 10px/10px var(--font-mono); color: var(--ink-2); padding-left: 1px; }
.bar-slot { position: relative; height: 46px; display: flex; align-items: flex-end; justify-content: center; }
.bar-slot::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--rule-strong); }
.bar { width: min(28px, 46%); border-radius: 4px 4px 0 0; background: var(--thread); transform-origin: bottom;
  transition: transform .7s var(--ease); }
.bar-val { position: absolute; left: 0; right: 0; text-align: center; font: 600 11px/1 var(--font-mono); color: var(--ink); }
.lane.no-metric .bar-slot::before { background: var(--rule); }

.total { padding: 10px 20px 10px 10px; text-align: right; vertical-align: middle; border-left: 1px solid var(--rule); }
.total .big { display: block; font: 700 19px/1.15 var(--font-mono); letter-spacing: -0.02em; }
.total .unit { display: block; font-size: 11px; color: var(--ink-2); }
.total .posts { display: block; font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.total .delta { font-size: 12px; }
.sheet .delta.up { color: var(--ok); }
.sheet .delta.down, .sheet .delta.flat { color: var(--ink-2); }
.sheet tbody:last-child .lane:last-child > * { border-bottom: 0; }

.lane.status-off th .lsub::after { content: " · not connected"; color: var(--action-text); }
.delta.flat { font-family: var(--font-body); font-weight: 500; }

/* detail row */
.detail td { padding: 0; border-bottom: 1px solid var(--rule); background: color-mix(in oklab, var(--ground) 60%, var(--paper)); }
.detail-body { padding: 22px 20px 26px; display: grid; gap: 26px 40px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); animation: open .45s var(--ease); }
@keyframes open { from { opacity: 0; transform: translateY(-6px); } }
.detail h3 { font-size: 16px; margin-bottom: 12px; }
.detail .note { color: var(--ink-2); font-size: 13px; margin: 8px 0 0; }
.trend { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; align-items: end; height: 150px; padding-bottom: 0; border-bottom: 1px solid var(--rule-strong); }
.trend .tcol { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; cursor: default; }
.trend .tbar { width: min(30px, 70%); background: color-mix(in oklab, var(--thread) 38%, var(--paper)); border-radius: 4px 4px 0 0; min-height: 0; }
.trend .tcol.sel .tbar { background: var(--thread); }
.trend .tval { font: 600 11px/1 var(--font-mono); margin-bottom: 4px; color: var(--ink-2); }
.trend .tcol.sel .tval { color: var(--ink); }
.trend-x { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.trend-x span { text-align: center; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.trend-x span.sel { color: var(--ink); font-weight: 600; }
.trend-x span small { display: block; font-size: 10px; color: var(--ink-3); }

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; border-top: 1px solid var(--rule); align-items: baseline; font-size: 13px; }
.list li:first-child { border-top: 0; }
.list .d { color: var(--ink-2); font-size: 12px; }
.list .t { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list .t a { text-decoration: none; }
.list .t a:hover { text-decoration: underline; text-underline-offset: 2px; }
.list .s { font: 500 12px/1.4 var(--font-mono); color: var(--ink-2); text-align: right; white-space: nowrap; }
.list .tag { font: 600 10px/1 var(--font-body); padding: 3px 6px; border-radius: 99px; background: var(--thread-soft); color: var(--thread); margin-left: 6px; white-space: nowrap; vertical-align: 1px; }
.empty { color: var(--ink-2); font-size: 13px; margin: 0; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px 20px; margin: 0 0 18px; }
.kv div { display: grid; gap: 2px; }
.kv dt { font-size: 12px; color: var(--ink-2); }
.kv dd { margin: 0; font: 700 18px/1.2 var(--font-mono); }

/* ------------------------------------------------ sources */
.sources { max-width: 1480px; margin: 0 auto; padding: 30px var(--gutter) 60px; }
.sources h2 { font-size: 18px; margin-bottom: 12px; }
.sources ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 32px; }
.sources li { display: grid; grid-template-columns: 14px 1fr; gap: 4px 10px; padding: 11px 0; border-top: 1px solid var(--rule); font-size: 13px; }
.sources .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; background: var(--ok); }
.sources .dot.off { background: var(--action); }
.sources .dot.wait { background: var(--ink-3); }
.sources .sname { font-weight: 600; }
.sources .sname span { font-weight: 400; color: var(--ink-2); }
.sources .snote { grid-column: 2; color: var(--ink-2); font-size: 12px; overflow-wrap: anywhere; }
.sources .sfix { grid-column: 2; color: var(--action-text); font-size: 12px; }

/* ------------------------------------------------ tooltip */
.tip { position: fixed; z-index: 40; max-width: 320px; padding: 11px 13px; border-radius: 10px; background: var(--band); color: var(--band-ink);
  box-shadow: 0 14px 34px -10px rgba(5, 11, 24, 0.55); font-size: 12px; line-height: 1.45; pointer-events: none; }
.tip strong { display: block; font-size: 13px; margin-bottom: 4px; }
.tip .tnum { font: 600 12px/1.4 var(--font-mono); color: #fff; }
.tip ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.tip li { color: var(--band-ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tip li b { color: var(--band-ink); font-weight: 600; }

/* ------------------------------------------------ motion: bars rise once per week change */
.sheet.rise .bar { transform: scaleY(0); }
@media (prefers-reduced-motion: reduce) {
  .bar, .detail-body { transition: none; animation: none; }
  .sheet.rise .bar { transform: none; }
}

/* ------------------------------------------------ narrow screens: each lane = label row + 7-day strip */
@media (max-width: 860px) {
  :root { --total-col: 0px; }
  .sheet, .sheet thead, .sheet tbody, .sheet tr { display: block; }
  .sheet colgroup { display: none; }
  .sheet thead tr { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); position: sticky; top: 0; z-index: 3; background: var(--paper); border-radius: 14px 14px 0 0; border-bottom: 1px solid var(--rule-strong); }
  .sheet thead th { position: static; border: 0; padding: 10px 2px 8px; text-align: center; font-size: 11px; }
  .sheet thead th:first-child, .sheet thead th:last-child { display: none; }
  .sheet thead .dname { font-size: 12px; }
  .sheet thead th.today::after { margin: 6px auto 0; width: 60%; }
  .sheet tbody.group th.gname { display: block; padding: 18px 14px 6px; }
  .lane { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .lane > * { border-bottom: 0; }
  .lane th { grid-column: 1 / -1; display: block; border-top: 1px solid var(--rule); }
  .lane-btn { min-height: 0; padding: 10px 14px 4px; grid-template-columns: 1fr auto; column-gap: 12px; }
  .lane-btn .lname { grid-column: 1; }
  .lane-btn .lsub, .lane-btn .lfollow { grid-column: 1; }
  .lane-btn .lside { grid-column: 2; grid-row: 1 / span 3; text-align: right; align-self: center; }
  .day { display: flex; flex-direction: column; justify-content: flex-end; height: 82px; padding: 4px 2px 0; border-left: 0; }
  .marks { left: 3px; right: 3px; top: 4px; gap: 2px; }
  .mark { width: 7px; height: 7px; border-radius: 2px; }
  .bar-slot { height: 48px; }
  .day.lag .bar-slot::after { content: "…"; font-size: 12px; }
  .sheet thead .tday { display: none; }
  .bar { width: 46%; }
  .bar-val { font-size: 10px; }
  .total { display: none !important; }
  .detail { display: block !important; }
  .detail td { display: block; }
  .detail-body { grid-template-columns: 1fr; padding: 18px 14px 22px; }
  .summary { margin-top: 22px; }
  .weeklabel { min-width: 140px; }
  /* ledger: one block per measure */
  .ledger-wrap { overflow: visible; margin: 0; padding: 0; }
  .ledger { min-width: 0; display: block; }
  .ledger thead { display: none; }
  .ledger tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .ledger tr { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 10px; padding: 12px 0; border-top: 1px solid var(--band-rule); }
  .ledger th, .ledger td { border: 0; padding: 0; }
  .ledger tbody th { grid-column: 1 / -1; width: auto; font-size: 13px; }
  .ledger tbody th small { display: none; }
  .ledger td:nth-child(3) { display: none; }
  .ledger td.src { display: none; }
  .ledger .now { font-size: 22px; }
}
@media (min-width: 861px) { .lane-btn .lside { display: none; } }
@media (max-width: 520px) {
  .topline { gap: 12px; }
  .brand span { display: none; }
  .meta #updated { display: none; }
  .list li { grid-template-columns: 52px minmax(0, 1fr); }
  .list .s { grid-column: 2; text-align: left; }
}
