:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e6e9f2;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-soft: #eef2ff;
  --good: #0aac23;
  --good-ink: #067a1a;
  --good-soft: #e7f8ea;
  --bad: #dc3c3d;
  --bad-ink: #c02627;
  --bad-soft: #fdecec;
  --warn: #f59e0b;
  --warn-ink: #a15c00;
  --warn-soft: #fff6e5;
  --c1: #257de0; --c2: #f47230; --c3: #00b894; --c4: #f2a600; --c5: #ee7fac; --c6: #6a4ce2;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .14);
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 12px; }
.bold { font-weight: 700; }
.good { color: var(--good-ink); }
.bad { color: var(--bad-ink); }
.warn { color: var(--warn-ink); }
.hide { display: none !important; }

/* ---------- boot / spinner ---------- */
.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side); flex-shrink: 0; position: fixed; inset: 0 auto 0 0; z-index: 30;
  background: linear-gradient(185deg, #141a3a 0%, #1e1b4b 55%, #2e1065 100%); color: #cbd5f5;
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #ec4899); box-shadow: 0 6px 18px rgba(236, 72, 153, .35); }
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: #a5b4fc; margin-top: -2px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #7c86b8; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: #c7cdf0; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; flex-shrink: 0; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(99, 102, 241, .55), rgba(139, 92, 246, .25)); color: #fff; box-shadow: inset 3px 0 0 #a5b4fc; }
.cur-switch { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 2px; font-size: 11.5px; color: #a5b4fc; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.seg.dark { background: rgba(255, 255, 255, .08); padding: 3px; }
.seg.dark button { color: #c7cdf0; padding: 5px 10px; font-size: 12px; text-transform: none; letter-spacing: 0; }
.seg.dark button.on { background: #fff; color: #1e1b4b; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); margin-top: 10px; }
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: 11.5px; color: #a5b4fc; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; color: inherit; cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.icon-btn svg { width: 18px; height: 18px; }

.main { flex: 1; margin-left: var(--side); min-width: 0; }
.topbar { display: none; }
.page { padding: 28px 32px 60px; max-width: 1480px; margin: 0 auto; animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.025em; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(230, 233, 242, .7); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.card-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.grid { display: grid; gap: 18px; }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt { margin-top: 18px; }
.mt-lg { margin-top: 26px; }

/* ---------- KPI period cards ---------- */
.kpi { position: relative; overflow: hidden; padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent, var(--primary)); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-title { font-weight: 700; font-size: 14px; }
.kpi-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kpi-chip { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--accent); flex-shrink: 0;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.kpi-chip svg { width: 19px; height: 19px; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.kpi-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.bar { height: 9px; background: #eef0f6; border-radius: 99px; overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--fill, var(--primary)); transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.bar .pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; border-radius: 2px; }
.bar.lg { height: 14px; }

/* status pills — always icon + label, never colour alone */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.pill svg { width: 13px; height: 13px; }
.pill.good { background: var(--good-soft); color: var(--good-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.neutral { background: #f1f5f9; color: var(--ink-2); }
.pill.primary { background: var(--primary-soft); color: var(--primary); }

.short-big { font-size: 22px; font-weight: 800; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 6px; }
.short-big.bad { color: var(--bad); }
.short-big.good { color: var(--good); }

/* per-member list inside KPI */
.mlist { display: flex; flex-direction: column; gap: 9px; margin-top: 2px; }
.mrow { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 9px; align-items: center; font-size: 13px; }
.mrow .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .amt { font-weight: 700; text-align: right; }
.mrow .bar { grid-column: 2 / 4; height: 6px; margin-top: -4px; }
.mrow .pct { font-size: 11px; font-weight: 700; margin-left: 6px; }

/* ---------- avatar ---------- */
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; flex-shrink: 0; background: var(--c, var(--primary)); }
.av.sm { width: 24px; height: 24px; font-size: 10.5px; }
.av.lg { width: 44px; height: 44px; font-size: 16px; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell b { display: block; font-weight: 600; }
.who-cell span { font-size: 12px; color: var(--ink-3); }
.who-cell span.av, span.av { color: #fff; font-size: 12px; }
.who-cell span.av.sm { font-size: 10.5px; }
.who-cell span.av.lg { font-size: 16px; }
.nowrap { white-space: nowrap; }

/* ---------- segmented / tabs ---------- */
.seg { display: inline-flex; background: #e9ecf5; border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 600; color: var(--ink-2); cursor: pointer; font-size: 13px; white-space: nowrap; }
.seg button svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; padding: 9px 15px; border-radius: 11px; font-weight: 600; cursor: pointer; color: var(--ink); transition: all .15s; white-space: nowrap; font-size: 13.5px; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: #cfd5e6; background: #fafbff; }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .3); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.success { background: linear-gradient(135deg, #10b981, #0aac23); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(10, 172, 35, .28); }
.btn.danger { color: var(--bad-ink); }
.btn.danger:hover { background: var(--bad-soft); border-color: #f5c2c2; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, .12); }
textarea.input { resize: vertical; min-height: 76px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; padding: 7px 13px; border-radius: 99px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 8px 0 -2px; grid-column: 1 / -1; }

/* stepper inputs for daily report */
.steppers { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.stepper { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #fff; transition: border-color .15s; }
.stepper:focus-within { border-color: #a5b4fc; }
.stepper .lbl { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.stepper .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--accent); }
.stepper .ic svg { width: 17px; height: 17px; }
.stepper .ctl { display: flex; align-items: center; gap: 8px; }
.stepper .ctl button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #f8fafc; cursor: pointer; font-size: 18px; font-weight: 700; color: var(--ink-2); }
.stepper .ctl button:hover { background: var(--primary-soft); color: var(--primary); }
.stepper .ctl input { flex: 1; text-align: center; font-size: 22px; font-weight: 800; border: 0; outline: none; width: 60px; background: transparent; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfe; position: sticky; top: 0; }
.t td { padding: 12px 14px; border-bottom: 1px solid #f0f2f8; vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover { background: #fafbff; }
.t .r { text-align: right; }
.t .c { text-align: center; }
.t tfoot td { font-weight: 800; background: #fafbfe; border-top: 1px solid var(--line); }
.t th.group { text-align: center; border-left: 1px solid var(--line); color: var(--ink-2); }
.t td.gl, .t th.gl { border-left: 1px solid var(--line); }
.clickable { cursor: pointer; }
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }

/* ---------- hero (personal dashboard) ---------- */
.hero {
  border-radius: 22px; padding: 26px 28px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(1200px 300px at 100% 0, rgba(236, 72, 153, .45), transparent 60%), linear-gradient(120deg, #312e81, #4f46e5 55%, #7c3aed);
  box-shadow: 0 18px 40px rgba(79, 70, 229, .28); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 28px; align-items: center;
}
.hero.is-bad { background: radial-gradient(900px 300px at 100% 0, rgba(248, 113, 113, .45), transparent 60%), linear-gradient(120deg, #312e81, #4f46e5 60%, #7c3aed); }
.hero h2 { margin: 0; font-size: 15px; font-weight: 600; opacity: .9; }
.hero .big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-top: 6px; }
.hero .of { opacity: .85; font-size: 14px; margin-top: 4px; }
.hero .verdict { text-align: right; }
.hero .verdict .label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; opacity: .85; font-weight: 700; }
.hero .verdict .val { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; padding: 6px 16px; border-radius: 14px; margin-top: 6px; display: inline-block; }
.hero .verdict .val.bad { background: #fff; color: var(--bad); box-shadow: 0 8px 24px rgba(220, 60, 61, .35); }
.hero .verdict .val.good { background: #fff; color: var(--good); box-shadow: 0 8px 24px rgba(10, 172, 35, .35); }
.hero .verdict .need { font-size: 13px; margin-top: 8px; opacity: .92; }
.ring { width: 118px; height: 118px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-txt { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 24px; line-height: 1; }
.ring .ring-txt small { display: block; font-size: 10.5px; font-weight: 600; opacity: .8; margin-top: 3px; letter-spacing: .05em; text-transform: uppercase; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.tile { padding: 16px; border-radius: 14px; background: #fff; border: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.tile .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, white); color: var(--accent); flex-shrink: 0; }
.tile .ic svg { width: 20px; height: 20px; }
.tile b { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.tile span { font-size: 12px; color: var(--ink-2); }

/* leaderboard */
.lb { display: flex; flex-direction: column; }
.lb-row { display: grid; grid-template-columns: 26px 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 22px; border-top: 1px solid #f2f4f9; }
.lb-row:first-child { border-top: 0; }
.lb-rank { font-weight: 800; color: var(--ink-3); text-align: center; }
.lb-rank.top { color: #fff; background: linear-gradient(135deg, #f59e0b, #f97316); border-radius: 8px; height: 24px; display: grid; place-items: center; font-size: 12px; }
.lb-name b { display: block; font-weight: 600; font-size: 13.5px; }
.lb-name .bar { height: 5px; margin-top: 5px; }

.feed-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 22px; border-top: 1px solid #f2f4f9; }
.feed-row b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row span { font-size: 12px; color: var(--ink-3); }

.chart-box { position: relative; height: 320px; padding: 10px 18px 18px; }
.chart-box.sm { height: 240px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); padding: 10px 22px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.line { height: 2px; width: 16px; border-radius: 2px; vertical-align: 3px; border-top: 2px dashed var(--ink); background: none; }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-weight: 500; }
.banner.warn { background: var(--warn-soft); color: var(--warn-ink); }
.banner.good { background: var(--good-soft); color: var(--good-ink); }
.banner.info { background: var(--primary-soft); color: #3730a3; }
.banner svg { width: 18px; height: 18px; flex-shrink: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .input { width: auto; padding: 8px 11px; }
.filters .grow { flex: 1; min-width: 180px; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); z-index: 60; display: grid; place-items: center; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 20px; width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .25s cubic-bezier(.2, .9, .3, 1.2); }
.modal.sm { width: min(480px, 100%); }
@keyframes pop { from { transform: scale(.96) translateY(10px); opacity: 0; } }
.modal-head { padding: 20px 24px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { padding: 14px 24px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-head .icon-btn:hover { background: #f1f5f9; }

/* ---------- toast ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: fadeUp .25s; max-width: 380px; }
.toast.good { background: #065f1b; }
.toast.bad { background: #991b1b; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100%; height: 100%; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(700px 400px at 80% 10%, rgba(236, 72, 153, .5), transparent 60%), radial-gradient(600px 400px at 10% 90%, rgba(14, 165, 233, .45), transparent 60%), linear-gradient(140deg, #1e1b4b, #4338ca);
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.03em; margin: 0 0 14px; max-width: 480px; }
.auth-art p { opacity: .85; max-width: 440px; font-size: 15px; }
.auth-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 520px; }
.auth-stats div { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); border-radius: 14px; padding: 14px; backdrop-filter: blur(6px); }
.auth-stats b { display: block; font-size: 22px; }
.auth-stats span { font-size: 12px; opacity: .8; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-form h2 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.err { background: var(--bad-soft); color: var(--bad-ink); padding: 10px 12px; border-radius: 10px; font-weight: 500; font-size: 13px; }

/* org tree */
.tree { padding: 8px 22px 18px; }
.tree ul { list-style: none; margin: 0; padding-left: 26px; border-left: 2px dashed #e2e6f1; margin-left: 14px; }
.tree > ul { border: 0; padding: 0; margin: 0; }
.tree li { margin: 8px 0; }
.tree .node { display: inline-flex; align-items: center; gap: 9px; padding: 7px 12px 7px 8px; border-radius: 12px; background: #fafbfe; border: 1px solid var(--line); }
.tree .node b { font-size: 13px; }
.tree .node span { font-size: 11.5px; color: var(--ink-3); }

.t.compact th, .t.compact td { padding: 10px 9px; }
.target-grid input { width: 82px; text-align: right; padding: 7px 8px; border-radius: 9px; border: 1.5px solid var(--line); font-weight: 600; }
.target-grid input:focus { border-color: #a5b4fc; outline: none; }
.target-grid input:disabled { background: transparent; border-color: transparent; color: var(--ink); }
.target-grid td { padding: 8px 8px; }
.target-grid .ach { font-size: 11px; font-weight: 700; margin-top: 3px; text-align: right; }
.target-grid .qcol { background: #f7f8fd; font-weight: 700; text-align: right; white-space: nowrap; }
.target-grid td { padding: 8px 5px; }

.copy-box { display: flex; gap: 8px; }
.copy-box .input { font-size: 12.5px; }

@media (max-width: 1200px) {
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #1e1b4b; color: #fff; position: sticky; top: 0; z-index: 20; }
  .page { padding: 20px 16px 50px; }
  .g-3, .g-2, .g-4 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; text-align: left; }
  .hero .verdict { text-align: left; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- targets page ---------- */
.fy-switch { display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 4px; box-shadow: var(--shadow); }
.fy-switch .icon-btn { width: 34px; height: 34px; color: var(--ink-2); }
.fy-switch .icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.fy-switch > div { text-align: center; min-width: 120px; line-height: 1.15; }
.fy-switch b { display: block; font-size: 15px; }
.fy-switch span { font-size: 11px; color: var(--ink-3); }

.tcards { display: flex; flex-direction: column; gap: 16px; }
.tcard { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.tcard-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tcard-sum { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.tcard-sum > div span { display: block; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.tcard-sum > div b { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.quarters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.qblock { background: #f8f9fd; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.qhead { display: flex; align-items: baseline; gap: 8px; padding: 0 4px 8px; font-size: 12px; color: var(--ink-2); }
.qhead b { font-size: 13px; color: var(--ink); }
.qhead em { margin-left: auto; font-style: normal; font-weight: 800; }
.mcells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mcell { background: #fff; border-radius: 10px; padding: 8px 9px; border: 1.5px solid transparent; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mcell .mlabel { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ink-3); }
.mcell .mt-val { font-weight: 800; font-size: 14px; }
.mcell .mach { font-size: 11.5px; color: var(--ink-2); }
.mcell em { font-style: normal; font-size: 11px; font-weight: 800; color: #6a4ce2; white-space: nowrap; }
.mcell .mbar { height: 4px; background: #eef0f6; border-radius: 4px; overflow: hidden; margin-top: 5px; }
.mcell .mbar i { display: block; height: 100%; border-radius: 4px; background: var(--ink-3); }
.mcell.hit { background: var(--good-soft); border-color: #bfe8c6; }
.mcell.hit .mbar i { background: var(--good); }
.mcell.short { background: var(--bad-soft); border-color: #f6caca; }
.mcell.short .mbar i { background: var(--bad); }
.mcell.current { border-color: #6a4ce2; box-shadow: 0 0 0 3px rgba(106, 76, 226, .12); }
.mcell.current .mbar i { background: #6a4ce2; }
.mcell.future { background: transparent; border: 1.5px dashed #dfe3ee; }
.mcell.future .mt-val { color: var(--ink-2); }

.savebar { position: fixed; left: calc(var(--side) + 50%); transform: translate(-50%, 140%); bottom: 22px; z-index: 40; display: flex; align-items: center; gap: 10px;
  background: #0f172a; color: #fff; padding: 10px 12px 10px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); transition: transform .25s cubic-bezier(.2, .9, .3, 1.2); margin-left: calc(var(--side) / -2); }
.savebar { visibility: hidden; opacity: 0; }
.savebar.show { transform: translate(-50%, 0); visibility: visible; opacity: 1; }
.savebar span { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; }
.savebar span svg { width: 16px; height: 16px; opacity: .8; }
.savebar .btn:not(.primary) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }

.money-in { position: relative; }
.money-in span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 700; pointer-events: none; }
.money-in .input { padding-left: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.quickfill { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px; background: var(--primary-soft); border-radius: 14px; margin-bottom: 18px; }
.mgrid { display: grid; grid-template-columns: 34px repeat(3, minmax(0, 1fr)); gap: 12px 12px; align-items: end; }
.mgrid-q { font-weight: 800; color: var(--primary); font-size: 13px; padding-bottom: 12px; }
.mtotal { margin-top: 16px; text-align: right; font-size: 15px; }
.bulk-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; max-height: 260px; overflow-y: auto; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }

.tgrid-wrap { max-height: 70vh; }
.tgrid { font-size: 13px; }
.tgrid th, .tgrid td { padding: 8px 6px; white-space: nowrap; }
.tgrid .sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; min-width: 150px; padding-left: 16px; box-shadow: 1px 0 0 var(--line); }
.tgrid thead .sticky-col { background: #fafbfe; z-index: 3; }
.tgrid tfoot .sticky-col { background: #fafbfe; }
.tgrid th.now { color: #6a4ce2; }
.tgrid td.now { background: rgba(106, 76, 226, .04); }
.cell-in { position: relative; display: flex; align-items: center; }
.cell-in input { width: 96px; padding: 8px 22px 8px 9px; border-radius: 9px; border: 1.5px solid transparent; background: #f5f7fb; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; outline: none; transition: all .12s; }
.cell-in input:hover { border-color: #dfe3ee; }
.cell-in input:focus { background: #fff; border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99, 102, 241, .14); }
.cell-in.changed input { background: #fff7e0; border-color: #f2c66d; }
.cell-in .fill { position: absolute; right: 3px; width: 18px; height: 22px; border: 0; background: none; color: var(--ink-3); cursor: pointer; border-radius: 5px; font-weight: 800; opacity: 0; transition: opacity .12s; }
.tgrid tr:hover .fill, .cell-in input:focus + .fill { opacity: 1; }
.cell-in .fill:hover { background: var(--primary-soft); color: var(--primary); }
.tgrid .qcol { background: #f4f5fb; font-weight: 700; text-align: right; color: var(--ink-2); }
.tgrid .ycol { background: #eef0fb; font-weight: 800; text-align: right; color: var(--primary); position: sticky; right: 0; box-shadow: -1px 0 0 var(--line); }
.tgrid thead .ycol, .tgrid thead .qcol { background: #eef0fb; }

@media (max-width: 1200px) { .quarters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .quarters { grid-template-columns: 1fr; }
  .savebar { left: 50%; margin-left: 0; }
  .mgrid { grid-template-columns: 1fr 1fr; } .mgrid-q { grid-column: 1 / -1; padding: 0; }
}

.page.has-savebar { padding-bottom: 110px; }
.mcell em.good { color: var(--good-ink); }
.mcell em.bad { color: var(--bad-ink); }

.ob-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px 22px 20px; }
.ob-step { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fafbfe; }
.ob-step b { display: block; font-size: 13.5px; }
.ob-step span:not(.pill) { display: block; font-size: 12px; color: var(--ink-2); }
.ob-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.ob-num svg { width: 16px; height: 16px; }
.ob-step.done { background: var(--good-soft); border-color: #bfe8c6; }
.ob-step.done .ob-num { background: var(--good); color: #fff; }
@media (max-width: 1200px) { .ob-steps { grid-template-columns: 1fr; } }
