/* GistPay Staff Office — one stylesheet, tokens on :root */
:root {
  --primary: #4f46e5; --primary-d: #4338ca; --primary-soft: #eef2ff; --primary-ink: #312e81;
  --accent: #059669; --accent-d: #047857; --accent-soft: #ecfdf5;
  --ink: #0b1020; --ink-2: #131a33; --ink-3: #1e1b4b;
  --text: #0f172a; --text-2: #334155; --muted: #64748b; --line: #e6e8f0; --line-2: #d6dae5;
  --bg: #f5f6fb; --card: #ffffff; --hover: #f8f9fd;
  --warn: #b45309; --warn-soft: #fef3c7; --bad: #dc2626; --bad-soft: #fef2f2; --info: #0369a1; --info-soft: #e0f2fe;
  --gold: #f59e0b; --silver: #94a3b8; --bronze: #c2703d;
  --r: 16px; --r-sm: 10px; --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06); --shadow-lg: 0 18px 50px rgba(15,23,42,.16);
  --side: 264px; --top: 68px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
.ic { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 16px; }
.mono { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(79,70,229,.45); outline-offset: 2px; border-radius: 8px; }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.img-fail { background: linear-gradient(135deg, var(--ink-3), var(--primary)); color: transparent; font-size: 0; min-height: 120px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--ink-2) 0 var(--side), var(--bg) var(--side)); }
.side { position: sticky; top: 0; height: 100vh; background: radial-gradient(120% 60% at 0% 0%, #1e1b4b 0%, rgba(30,27,75,0) 60%), linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%); color: #c7d2fe; display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #10b981); color: #fff; box-shadow: 0 6px 18px rgba(99,102,241,.4); }
.brand b { display: block; font-size: 16px; letter-spacing: -.02em; }
.brand small { display: block; font-size: 11px; color: #a5b4fc; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: #6b74a8; padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 500; color: #c7d2fe; transition: background .18s var(--ease), color .18s; min-height: 42px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: linear-gradient(90deg, rgba(99,102,241,.35), rgba(99,102,241,.12)); color: #fff; box-shadow: inset 3px 0 0 #818cf8; }
.nav a span { flex: 1; }
.nav a em, .tabbar em { font-style: normal; font-size: 11px; font-weight: 700; background: #ef4444; color: #fff; border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; }
.side-card { margin: 16px 4px 12px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); display: grid; gap: 10px; }
.side-card small { color: #8b93c7; font-size: 11.5px; }
.side-prog { height: 6px; border-radius: 9px; background: rgba(255,255,255,.1); overflow: hidden; }
.side-prog span { display: block; height: 100%; background: linear-gradient(90deg, #818cf8, #34d399); border-radius: 9px; }
.pill-live { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: #fff; }
.pill-live i { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.2); }
.pill-live.counting i { background: #fbbf24; box-shadow: 0 0 0 4px rgba(251,191,36,.2); }
.pill-live.closed i, .pill-live.upcoming i { background: #94a3b8; box-shadow: none; }
.side-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.04); color: #fff; }
.side-me:hover { background: rgba(255,255,255,.08); }
.side-me > span:not(.av) { flex: 1; min-width: 0; }
.side-me b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-me small { color: #a5b4fc; font-size: 12px; }
.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(245,246,251,.86); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line); }
.top-title { flex: 1; min-width: 0; }
.top-title h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title p { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.icon-btn:hover { background: var(--hover); border-color: var(--line-2); }
.me-btn { border: 0; background: none; padding: 4px; border-radius: 999px; }
.dot-count { position: absolute; top: 4px; right: 4px; font-style: normal; font-size: 10px; font-weight: 700; color: #fff; background: #ef4444; border-radius: 99px; padding: 0 5px; min-width: 17px; height: 17px; display: grid; place-items: center; border: 2px solid #fff; }
.chip-phase { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 8px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-d); }
.chip-phase.counting { background: var(--warn-soft); color: var(--warn); } .chip-phase.closed, .chip-phase.upcoming { background: #eef0f5; color: var(--muted); }
.content { padding: 24px 28px 48px; width: 100%; max-width: 1360px; margin: 0 auto; }
.banner { display: flex; align-items: center; gap: 8px; padding: 10px 28px; font-size: 13px; font-weight: 500; }
.banner.info { background: var(--primary-soft); color: var(--primary-ink); } .banner.warn { background: var(--warn-soft); color: var(--warn); }
.only-m { display: none; }
.tabbar { display: none; }

/* ---------- dropdowns ---------- */
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 50; }
.dd.open .dd-menu { display: block; animation: pop .16s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dd-menu a, .dd-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 10px; font-size: 14px; text-align: left; min-height: 42px; }
.dd-menu a:hover, .dd-menu button:hover { background: var(--hover); }
.dd-menu form { margin: 0; }
.dd-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dd-head small { color: var(--muted); font-size: 12px; width: 100%; }
.dd-head a { font-size: 12.5px; color: var(--primary); font-weight: 600; padding: 0; min-height: 0; width: auto; }
.notif-menu { width: 360px; max-width: calc(100vw - 24px); }
.notif-items { max-height: 380px; overflow-y: auto; }
.notif { display: flex !important; gap: 12px; align-items: flex-start !important; }
.notif .n-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.notif b { display: block; font-size: 13.5px; font-weight: 600; }
.notif small { display: block; color: var(--muted); font-size: 12.5px; }
.notif.unread b::after { content: ''; display: inline-block; width: 7px; height: 7px; background: var(--primary); border-radius: 50%; margin-left: 6px; vertical-align: middle; }

/* ---------- avatar ---------- */
.av { position: relative; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 55% 32%); font-weight: 700; font-size: calc(var(--s) * .38); overflow: visible; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.av .dot { position: absolute; right: 0; bottom: 0; width: calc(var(--s) * .28); height: calc(var(--s) * .28); min-width: 9px; min-height: 9px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
.av .dot.on { background: #22c55e; }

/* ---------- cards + grid ---------- */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 16px; flex: 1; display: flex; align-items: center; gap: 8px; }
.card-h .muted { font-size: 13px; }
.card-b { padding: 18px 20px 20px; }
.card-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.section-title h2 { font-size: 18px; flex: 1; }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; color: #fff; background: linear-gradient(110deg, #0b1020 0%, #1e1b4b 45%, #3730a3 78%, #4f46e5 100%); box-shadow: var(--shadow); }
.hero::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.14) 1px, transparent 1px); background-size: 18px 18px; -webkit-mask-image: linear-gradient(90deg, transparent 40%, #000); mask-image: linear-gradient(90deg, transparent 40%, #000); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: #a5b4fc; }
.hero h2 { font-size: 28px; letter-spacing: -.035em; margin: 6px 0 6px; }
.hero p { color: #c7d2fe; max-width: 560px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.hero-grid > * { min-width: 0; }
.hero-stats { display: flex; gap: 28px; margin-top: 20px; flex-wrap: wrap; }
.hero-stats div { border-left: 2px solid rgba(165,180,252,.35); padding-left: 14px; }
.hero-stats b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 12.5px; color: #a5b4fc; }
.hero .ring .ring-bg { stroke: rgba(255,255,255,.14); } .hero .ring b { color: #fff; } .hero .ring small { color: #a5b4fc; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; gap: 14px; align-items: flex-start; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.kpi span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.dark { background: linear-gradient(135deg, var(--ink), var(--ink-3)); border-color: transparent; color: #fff; }
.kpi.dark span, .kpi.dark small { color: #a5b4fc; } .kpi.dark .kpi-ic { background: rgba(255,255,255,.1); color: #a5b4fc; }
.kpi.green .kpi-ic { background: var(--accent-soft); color: var(--accent); }
.kpi.amber .kpi-ic { background: var(--warn-soft); color: var(--warn); }
.kpi.red .kpi-ic { background: var(--bad-soft); color: var(--bad); }
.up { color: var(--accent); font-weight: 600; } .down { color: var(--bad); font-weight: 600; }

/* ring + bars */
.ring { position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: #e8eaf3; stroke-width: 12; }
.ring-fg { fill: none; stroke: url(#none); stroke: #10b981; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-txt b { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.ring-txt small { font-size: 12px; color: var(--muted); }
.bar-track { height: 8px; background: #edf0f7; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar-track span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), #10b981); transition: width .8s var(--ease); }
.bar-track.thin { height: 6px; }
.bar-track.lg { height: 12px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #eef0f6; } .chart .axis { font-size: 11px; fill: #94a3b8; font-family: var(--font); }
.chart .bar { fill: #c7d2fe; } .chart .bar:hover { fill: var(--primary); } .chart .bar.future { fill: #f1f3f9; }
.chart .line { fill: none; stroke: #10b981; stroke-width: 2.5; stroke-linejoin: round; } .chart .line-dot { fill: #10b981; stroke: #fff; stroke-width: 2; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 130px 1fr 70px; gap: 12px; align-items: center; font-size: 13.5px; }
.funnel-row .bar-track { height: 26px; border-radius: 8px; }
.funnel-row .bar-track span { border-radius: 8px; }
.funnel-row b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- buttons + forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .16s var(--ease), border-color .16s, box-shadow .16s, transform .08s; cursor: pointer; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,.28); } .btn-primary:hover { background: var(--primary-d); }
.btn-green { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(5,150,105,.25); } .btn-green:hover { background: var(--accent-d); }
.btn-dark { background: var(--ink); color: #fff; } .btn-dark:hover { background: var(--ink-3); }
.btn-ghost { background: var(--card); border-color: var(--line-2); color: var(--text); } .btn-ghost:hover { background: var(--hover); border-color: #c4c9d8; }
.btn-soft { background: var(--primary-soft); color: var(--primary-d); } .btn-soft:hover { background: #e0e7ff; }
.btn-danger { background: var(--bad-soft); color: var(--bad); } .btn-danger:hover { background: #fee2e2; }
.btn-wa { background: #25d366; color: #fff; } .btn-wa:hover { background: #1fb457; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-xs { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .lbl { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; font: inherit; font-size: 16px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79,70,229,.14); }
.field input[type=file] { font-size: 14px; padding: 10px; border: 1px dashed var(--line-2); border-radius: 12px; width: 100%; background: var(--hover); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form .input { width: auto; flex: 1; min-width: 160px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.seg { display: inline-flex; padding: 4px; background: #eceef5; border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg label { padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }
.seg a.on, .seg label:has(input:checked) { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg em { font-style: normal; font-size: 11.5px; background: #dfe3ee; border-radius: 99px; padding: 0 7px; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 40px; }

/* ---------- tables + lists ---------- */
.table-wrap { overflow-x: auto; }
.scroll-y { max-height: 640px; overflow-y: auto; }
.scroll-y thead th { position: sticky; top: 0; z-index: 1; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfe; white-space: nowrap; }
.t td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover { background: var(--hover); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t a.rowlink { font-weight: 600; }
.t th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person > div { min-width: 0; }
.list { display: grid; }
.li { display: flex; gap: 12px; align-items: center; padding: 13px 20px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li > div { flex: 1; min-width: 0; }
.li b { font-weight: 600; font-size: 14px; } .li small { display: block; color: var(--muted); font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: var(--accent-soft); color: var(--accent-d); } .pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); } .pill-info { background: var(--info-soft); color: var(--info); }
.pill-mute { background: #eef0f5; color: var(--muted); } .pill-indigo { background: var(--primary-soft); color: var(--primary-d); }
.flag { display: inline-flex; align-items: center; gap: 4px; color: var(--bad); font-size: 12px; font-weight: 600; }
.rank { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: #eef0f5; color: var(--text-2); flex: none; }
.rank.r1 { background: #fef3c7; color: #b45309; } .rank.r2 { background: #f1f5f9; color: #475569; } .rank.r3 { background: #fdebdd; color: #9a4b1d; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: grid; place-items: center; gap: 8px; }
.empty .ic { color: #c7cbe0; } .empty b { color: var(--text); font-size: 15px; } .empty p { font-size: 13.5px; max-width: 380px; }
.pager { display: flex; gap: 6px; justify-content: center; padding: 16px; }

/* ---------- flash + toast ---------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; font-weight: 500; animation: pop .2s var(--ease); }
.flash span { flex: 1; }
.flash-ok, .flash-success { background: var(--accent-soft); color: var(--accent-d); border: 1px solid #a7f3d0; }
.flash-error { background: var(--bad-soft); color: #b91c1c; border: 1px solid #fecaca; }
.flash-info { background: var(--primary-soft); color: var(--primary-ink); border: 1px solid #c7d2fe; }
.flash-x { border: 0; background: none; padding: 4px; opacity: .6; } .flash-x:hover { opacity: 1; }
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: pop .2s var(--ease); }
.toast .ic { color: #34d399; }

/* ---------- link box ---------- */
.linkbox { display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 14px; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); max-width: 560px; }
.linkbox code { flex: 1; min-width: 0; font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.linkbox.light { background: var(--hover); border-color: var(--line); } .linkbox.light code { color: var(--text); }
.qr-box { background: #fff; padding: 12px; border-radius: 14px; width: max-content; }
.qr-box canvas, .qr-box img { width: 148px !important; height: 148px !important; }

/* ---------- announcements, tasks, feed ---------- */
.ann { padding: 16px 20px; border-top: 1px solid var(--line); }
.ann:first-child { border-top: 0; }
.ann h4 { font-size: 15px; display: flex; gap: 8px; align-items: center; }
.ann p { color: var(--text-2); font-size: 14px; margin-top: 6px; white-space: pre-line; }
.ann .meta { font-size: 12px; color: var(--muted); margin-top: 8px; }
.pin-tag { display: inline-flex; gap: 4px; align-items: center; font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 99px; }
.task { display: flex; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line); align-items: flex-start; }
.task:first-child { border-top: 0; }
.task-check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; margin-top: 1px; color: transparent; }
.task.done .task-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.task.done h4 { text-decoration: line-through; color: var(--muted); }
.task > div { flex: 1; min-width: 0; }
.task h4 { font-size: 15px; }
.task p { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.task .meta { font-size: 12.5px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.due-late { color: var(--bad); font-weight: 600; }
.report { padding: 18px 20px; border-top: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.report:first-child { border-top: 0; }
.report .r-stats { display: flex; gap: 18px; margin: 8px 0; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.report .r-stats b { font-size: 16px; color: var(--text); margin-right: 4px; }
.report p { font-size: 14px; color: var(--text-2); }
.report img { border-radius: 12px; max-height: 220px; margin-top: 10px; }
.lead-note { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); font-size: 13.5px; color: var(--primary-ink); }

/* ---------- resources ---------- */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.res { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s; }
.res:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.res-media { aspect-ratio: 4/5; background: linear-gradient(135deg, var(--ink-3), var(--primary)); display: grid; place-items: center; color: #c7d2fe; overflow: hidden; }
.res-media img, .res-media video { width: 100%; height: 100%; object-fit: cover; }
.res-media.cap { aspect-ratio: auto; min-height: 180px; padding: 18px; place-items: start; background: linear-gradient(135deg, #eef2ff, #ecfdf5); color: var(--text); font-size: 14px; white-space: pre-line; line-height: 1.55; }
.res-b { padding: 14px 16px; display: grid; gap: 10px; flex: 1; align-content: space-between; }
.res-b h4 { font-size: 14.5px; }
.res-b small { color: var(--muted); font-size: 12.5px; }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - var(--top) - 48px); min-height: 520px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list-h { padding: 14px; border-bottom: 1px solid var(--line); }
.rooms { overflow-y: auto; flex: 1; }
.room { display: flex; gap: 12px; padding: 12px 14px; align-items: center; border-left: 3px solid transparent; cursor: pointer; }
.room:hover { background: var(--hover); }
.room.on { background: var(--primary-soft); border-left-color: var(--primary); }
.room > div { flex: 1; min-width: 0; }
.room b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room time { font-size: 11px; color: var(--muted); align-self: flex-start; margin-top: 2px; }
.room em { font-style: normal; font-size: 11px; font-weight: 700; color: #fff; background: var(--primary); border-radius: 99px; padding: 1px 7px; }
.team-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #10b981); color: #fff; flex: none; }
.thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread-h { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 66px; }
.thread-h > div { flex: 1; min-width: 0; }
.thread-h b { display: block; font-size: 15px; } .thread-h small { color: var(--muted); font-size: 12.5px; }
.msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; background: #f8f9fd; background-image: radial-gradient(#e7e9f3 1px, transparent 1px); background-size: 22px 22px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: #fff; border: 1px solid var(--line); padding: 9px 13px; border-radius: 16px 16px 16px 4px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; min-width: 0; box-shadow: 0 1px 1px rgba(15,23,42,.03); }
.msg.mine .bubble { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 16px 16px 4px 16px; }
.bubble .who { display: block; font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.bubble time { display: block; font-size: 10.5px; opacity: .6; margin-top: 3px; text-align: right; }
.bubble img { border-radius: 10px; max-width: 260px; max-height: 260px; margin: 2px 0 4px; cursor: zoom-in; }
.msg.broadcast .bubble { background: #fffbeb; border-color: #fde68a; color: var(--text); }
.msg.broadcast .bubble::before { content: 'Broadcast'; display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--warn); margin-bottom: 3px; }
.msg.mine.broadcast .bubble { background: #fef3c7; }
.msg + .msg:not(.mine) .av-sp, .msg-gap { margin-top: 8px; }
.day-sep { align-self: center; font-size: 11.5px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 3px 12px; border-radius: 99px; margin: 10px 0; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; background: #fff; }
.composer textarea { flex: 1; min-height: 46px; max-height: 140px; resize: none; border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 14px; font: inherit; font-size: 16px; line-height: 1.4; }
.composer textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
.attach-preview { padding: 8px 12px 0; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.attach-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 30px; }
.lightbox { position: fixed; inset: 0; background: rgba(11,16,32,.88); display: grid; place-items: center; z-index: 200; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 12px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; }
.auth-art { position: relative; overflow: hidden; padding: 48px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(80% 60% at 100% 100%, rgba(16,185,129,.35), transparent 60%), radial-gradient(70% 60% at 0% 0%, rgba(99,102,241,.45), transparent 60%), linear-gradient(160deg, #0b1020, #1e1b4b); }
.auth-art::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 20px 20px; -webkit-mask-image: linear-gradient(200deg, #000, transparent 70%); mask-image: linear-gradient(200deg, #000, transparent 70%); }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h2 { font-size: 40px; letter-spacing: -.045em; line-height: 1.08; max-width: 480px; }
.auth-art p { color: #c7d2fe; max-width: 440px; margin-top: 14px; font-size: 16px; }
.auth-points { display: grid; gap: 14px; margin-top: 28px; }
.auth-points div { display: flex; gap: 12px; align-items: center; color: #e0e7ff; font-size: 14.5px; }
.auth-points .ic { color: #34d399; }
.auth-mock { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 480px; }
.auth-mock div { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 14px; backdrop-filter: blur(6px); }
.auth-mock b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.03em; } .auth-mock span { font-size: 12px; color: #a5b4fc; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h1 { font-size: 30px; letter-spacing: -.04em; }
.auth-card .sub { color: var(--muted); margin: 8px 0 26px; }
.auth-card .brand { color: var(--text); padding: 0 0 28px; }
.auth-card .brand small { color: var(--primary); }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps span { flex: 1; height: 5px; border-radius: 9px; background: #e6e8f0; }
.steps span.on { background: linear-gradient(90deg, var(--primary), #10b981); }
.welcome-chip { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-d); font-size: 14px; margin-bottom: 18px; }
.pw-wrap { position: relative; } .pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 8px; min-height: 36px; }
.alt-link { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.alt-link a { color: var(--primary); font-weight: 600; }

/* ---------- profile + member ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { font-size: 22px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end; }
.pod { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 14px; text-align: center; display: grid; justify-items: center; gap: 6px; box-shadow: var(--shadow); }
.pod.p1 { padding-top: 30px; background: linear-gradient(180deg, #fffbeb, #fff); border-color: #fde68a; }
.pod b { font-size: 15px; } .pod .big { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.pod .medal { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; margin-top: -4px; }
.wa-queue { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.wa-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.wa-item > div { flex: 1; min-width: 0; }
.wa-item.sent { opacity: .55; }
.var-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.var-chips button { border: 1px dashed var(--line-2); background: var(--hover); border-radius: 8px; font-size: 12.5px; padding: 4px 9px; font-family: ui-monospace, monospace; min-height: 30px; }
.picker { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.picker label { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.picker label:first-child { border-top: 0; }
.picker label:hover { background: var(--hover); }
.code-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 14px; letter-spacing: .04em; background: var(--primary-soft); color: var(--primary-d); padding: 4px 10px; border-radius: 8px; }
details.more summary { cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; color: var(--primary); display: inline-flex; gap: 6px; align-items: center; min-height: 36px; }
details.more summary::-webkit-details-marker { display: none; }
.note-box { padding: 12px 14px; border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; font-size: 13.5px; color: #78350f; display: flex; gap: 10px; }
.note-box .ic { color: var(--warn); margin-top: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; background: var(--bg); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; transform: translateX(-100%); transition: transform .25s var(--ease); }
  body.side-open .side { transform: none; box-shadow: var(--shadow-lg); }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(11,16,32,.5); z-index: 35; }
  .only-m { display: grid; } .hide-m { display: none !important; }
  .top { padding: 0 16px; }
  .content { padding: 18px 16px 100px; }
  .banner { padding: 10px 16px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { position: relative; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); border: 0; background: none; padding: 6px 0; min-height: 52px; }
  .tabbar a.on { color: var(--primary); }
  .tabbar em { position: absolute; top: 2px; left: 50%; margin-left: 6px; font-size: 10px; padding: 0 5px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - var(--top) - 96px - env(safe-area-inset-bottom)); border-radius: 14px; }
  .chat.in-thread .chat-list { display: none; } .chat:not(.in-thread) .thread { display: none; }
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero .ring { width: 132px !important; height: 132px !important; justify-self: center; grid-row: 1; }
  .hero .ring-txt b { font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .kpis { gap: 10px; } .kpi { padding: 14px; gap: 10px; } .kpi b { font-size: 20px; } .kpi-ic { width: 36px; height: 36px; }
  .hero { padding: 20px; border-radius: 16px; } .hero h2 { font-size: 22px; } .hero-stats { gap: 16px; } .hero-stats b { font-size: 20px; }
  .card-h { padding: 16px 16px 0; } .card-b { padding: 16px; } .li, .task, .ann, .report { padding-left: 16px; padding-right: 16px; }
  .t th, .t td { padding: 11px 12px; }
  .msg { max-width: 88%; } .msgs { padding: 14px; }
  .funnel-row { grid-template-columns: 100px 1fr 54px; }
  .podium { grid-template-columns: 1fr; } .pod.p1 { order: -1; }
  .top-title h1 { font-size: 17px; }
  .hide-s { display: none !important; }
  .t.stack-m thead { display: none; }
  .t.stack-m tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
  .t.stack-m td { padding: 0; border: 0; }
  .t.stack-m td[data-l]::before { content: attr(data-l) ' '; color: var(--muted); font-size: 12px; }
  .t.stack-m td.full { grid-column: 1 / -1; }
}
@media (max-width: 420px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi { flex-direction: column; } .seg a, .seg label { padding: 8px 10px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
