/* Clear Grid client portal styles. Builds on ../style.css tokens (light and dark). */
body.app, body.auth-page { background: var(--paper); min-height: 100vh; }
body.app { font-size: 1rem; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3 { margin: 0; }

/* ---------- sign in ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background:
  radial-gradient(900px 500px at 85% -10%, rgba(21, 88, 240, 0.14), transparent 60%),
  radial-gradient(700px 420px at -10% 110%, rgba(255, 107, 26, 0.14), transparent 60%); }
.auth-card { width: min(100%, 440px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 34px 30px; box-shadow: var(--shadow-l); display: grid; gap: 18px; }
.auth-card h1 { font-size: 1.9rem; }
.auth-sub { margin: -6px 0 0; color: var(--ink-2); }
.auth-note { background: var(--warn-bg); border: 1px dashed var(--orange); border-radius: var(--radius-m); padding: 14px 16px; font-size: 0.95rem; }
.auth-social { display: grid; gap: 10px; }
.auth-btn { background: var(--surface); border-color: var(--field-line); color: var(--ink); width: 100%; justify-content: center; }
.auth-btn:hover:not(:disabled) { border-color: var(--blue); }
.auth-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-tabs { display: grid; grid-auto-flow: column; gap: 6px; background: var(--mist); padding: 5px; border-radius: 12px; }
.auth-tabs button { border: 0; background: transparent; padding: 10px; border-radius: 9px; font: 600 0.95rem var(--body); color: var(--ink-2); cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(10, 27, 51, 0.15); }
.auth-form { display: grid; gap: 14px; }
.field label { display: block; font-weight: 600; font-size: 0.93rem; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--field-line); border-radius: 10px; padding: 12px 14px; min-height: 48px; }
.field textarea { min-height: 130px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(21, 88, 240, 0.35); border-color: var(--blue); }
.auth-msg { margin: 0; min-height: 1.3em; font-size: 0.93rem; color: var(--ink-2); }
.auth-msg.ok { color: var(--good-text); }
.auth-msg.bad { color: #c2310b; }
:root[data-theme="dark"] .auth-msg.bad { color: #ff9a7a; }
.auth-demo { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 8px; }
.auth-demo .btn { width: 100%; }
.auth-security summary { cursor: pointer; font-weight: 600; font-size: 0.93rem; }
.auth-security p { color: var(--ink-2); font-size: 0.93rem; margin: 10px 0 0; }

/* ---------- shell ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--ink-2); }
.gate .bad { color: #c2310b; }
.claim { width: min(100%, 440px); display: grid; gap: 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 30px; box-shadow: var(--shadow-l); }
.claim form { display: grid; gap: 12px; }
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px; background: var(--navy); color: #fff; }
.side .brand { color: #fff; padding: 0 8px; }
.side .brand:hover { color: #fff; }
.nav-side { display: grid; gap: 4px; }
.nav-side a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #b8c8e8; text-decoration: none; font-weight: 550; position: relative; transition: background 0.15s, color 0.15s; }
.nav-side a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-side a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-side a[aria-current="page"] { background: rgba(255, 255, 255, 0.14); color: #fff; }
.nav-side a[aria-current="page"]::before { content: ""; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--orange); }
.count { margin-left: auto; font-style: normal; background: var(--orange); color: var(--navy); font-weight: 700; font-size: 0.75rem; border-radius: 999px; padding: 2px 8px; }
.dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: #3be19a; box-shadow: 0 0 0 4px rgba(59, 225, 154, 0.2); }
.side-foot { margin-top: auto; padding: 0 8px; font-size: 0.9rem; }
.side-foot a { color: #9fb2d6; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; background: var(--header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { font: 650 1.05rem var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions .theme-toggle { width: 42px; height: 42px; }
.ads-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; padding: 7px 14px; border-radius: 999px; background: var(--mist); color: var(--ink-2); border: 1px solid var(--line); }
.ads-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ads-chip.on { background: var(--live-bg); color: var(--good-text); border-color: transparent; }
.ads-chip.on i { background: #12a373; animation: pulse 1.8s ease-out infinite; }
.view { padding: 28px; max-width: 1180px; outline: none; }

.vhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.vhead h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.vhead p { margin: 6px 0 0; color: var(--ink-2); max-width: 44em; }
.vact { display: flex; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 22px; margin-bottom: 18px; min-width: 0; }
.card h2 { font-size: 1.2rem; }
.card .sub { color: var(--muted); margin: 4px 0 16px; font-size: 0.95rem; }
.chead { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.chead p { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.fine { color: var(--muted); font-size: 0.85rem; margin: 10px 0 0; }
.empty, .good-note { color: var(--muted); padding: 10px 0; }
.good-note { color: var(--good-text); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.grid2tight { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 18px; display: grid; gap: 4px; align-content: start; }
.kpi .kl { color: var(--muted); font-size: 0.88rem; }
.kpi b { font: 700 1.9rem/1.1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi.strong { background: var(--navy); border-color: var(--navy); }
.kpi.strong .kl { color: #aebfe0; }
.kpi.strong b { color: #fff; }
.delta { font-size: 0.82rem; font-weight: 600; }
.delta.up { color: #12a373; }
.delta.down { color: #d6452a; }
.delta.flat { color: var(--muted); font-weight: 500; }
.kpi.strong .delta.flat { color: #aebfe0; }
.callout { display: block; background: var(--warn-bg); border: 1px dashed var(--orange); border-radius: var(--radius-m); padding: 14px 18px; margin-bottom: 18px; color: var(--ink); text-decoration: none; }
.callout u { color: var(--orange-deep); font-weight: 650; }
.callout:hover { background: var(--pill-or); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--field-line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: 600 0.9rem var(--body); cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.chip i { font-style: normal; opacity: 0.6; margin-left: 4px; }
.chip:hover { border-color: var(--blue); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- charts ---------- */
.chart { position: relative; min-height: 120px; }
.chart svg { display: block; overflow: visible; }
.tip { display: none; position: absolute; z-index: 5; pointer-events: none; background: var(--navy); color: #fff; border-radius: 10px; padding: 9px 12px; font-size: 0.82rem; line-height: 1.5; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); white-space: nowrap; }
.tip b { display: block; margin-bottom: 2px; }
.tip span { display: flex; align-items: center; gap: 7px; }
.tip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 0.88rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 18px; height: 4px; border-radius: 3px; margin-right: 7px; vertical-align: middle; }
.funnel { display: grid; gap: 12px; }
.frow { display: grid; grid-template-columns: 112px 1fr 56px minmax(0, 120px); gap: 10px; align-items: center; font-size: 0.92rem; }
.frow b { text-align: right; font-variant-numeric: tabular-nums; }
.frow em { font-style: normal; color: var(--muted); font-size: 0.8rem; }
.fbar { height: 12px; border-radius: 6px; background: var(--mist); overflow: hidden; }
.fbar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--blue), #4f86ff); transition: width 0.6s ease; }
.fbar.alt i { background: linear-gradient(90deg, var(--orange), #ff9a5c); }
.fbar.warn i { background: linear-gradient(90deg, #d6452a, #ff7a5c); }

/* ---------- insights ---------- */
.ins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 18px; }
.mini-ins { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.ins { background: var(--surface); border: 1px solid var(--line); border-left-width: 5px; border-radius: var(--radius-m); padding: 16px 18px; display: grid; gap: 8px; align-content: start; }
.ins.good { border-left-color: #12a373; }
.ins.ok { border-left-color: #e0a100; }
.ins.weak { border-left-color: #d6452a; }
.ins-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ins-top h3 { font-size: 1.02rem; flex: 1; min-width: 0; }
.ins-dot { display: none; }
.ins-tag { font-size: 0.74rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--mist); }
.ins.good .ins-tag { background: var(--pill-gr); color: var(--good-text); }
.ins.ok .ins-tag { background: #fff2cc; color: #7a5a00; }
.ins.weak .ins-tag { background: #ffe0d9; color: #a52a12; }
:root[data-theme="dark"] .ins.ok .ins-tag { background: #4a3a05; color: #ffd966; }
:root[data-theme="dark"] .ins.weak .ins-tag { background: #4a1a10; color: #ff9a7a; }
.ins-vals { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ins-vals b { font: 700 1.35rem var(--display); letter-spacing: -0.02em; }
.ins-vals span { color: var(--muted); font-size: 0.85rem; }
.ins p { margin: 0; font-size: 0.93rem; color: var(--ink-2); }
.ins .fix { color: var(--ink); }
.opp { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.opp div { background: var(--mist); border-radius: var(--radius-m); padding: 14px 16px; display: grid; gap: 4px; }
.opp b { font-family: var(--display); }
.opp em { font-style: normal; color: var(--good-text); font-weight: 600; }
.stbl { display: grid; font-size: 0.92rem; }
.srow { display: grid; grid-template-columns: 1.5fr repeat(5, 1fr); gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.srow.sh { color: var(--muted); font-size: 0.8rem; font-weight: 600; }

/* ---------- leads table ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.srch { width: min(100%, 300px); }
.srch input { min-height: 42px; padding: 9px 14px; }
.tbl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.tr { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr 1.6fr auto; gap: 12px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); font-size: 0.93rem; }
.tr:last-child { border-bottom: 0; }
.tr.th { color: var(--muted); font-size: 0.8rem; font-weight: 600; background: var(--mist); }
.who2 { display: grid; }
.who2 small { color: var(--muted); }
.money { color: var(--good-text); }
.due { font-style: normal; color: var(--orange-deep); font-size: 0.78rem; font-weight: 650; display: block; }
.st { display: inline-block; font-size: 0.78rem; font-weight: 650; padding: 4px 10px; border-radius: 999px; background: var(--mist); }
.st-won { background: var(--pill-gr); color: var(--good-text); }
.st-lost { background: #ffe0d9; color: #a52a12; }
.st-booked { background: var(--sky); color: var(--on-sky); }
.st-new { background: var(--pill-or); color: var(--orange-deep); }
.st-contacted { background: #efe3ff; color: #5a2ea6; }
.st-no_show { background: #fff2cc; color: #7a5a00; }
:root[data-theme="dark"] .st-lost { background: #4a1a10; color: #ff9a7a; }
:root[data-theme="dark"] .st-contacted { background: #2c1b52; color: #cdb2ff; }
:root[data-theme="dark"] .st-no_show { background: #4a3a05; color: #ffd966; }

/* ---------- ads ---------- */
.plat-grid { display: grid; gap: 18px; }
.pb { font-size: 0.8rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.pb.on { background: var(--live-bg); color: var(--good-text); }
.pb.pause { background: #fff2cc; color: #7a5a00; }
.pb.off { background: var(--mist); color: var(--muted); }
.pending { background: var(--warn-bg); border: 1px dashed var(--orange); border-radius: var(--radius-m); padding: 12px 14px; font-size: 0.92rem; margin-bottom: 14px; }
.linkbtn { background: none; border: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.pstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; padding: 14px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.pstats span { display: block; color: var(--muted); font-size: 0.8rem; }
.pstats b { font: 650 1.1rem var(--display); }
.pstats .spk small { display: block; color: var(--muted); font-size: 0.75rem; }
.pform { display: grid; gap: 16px; }
.switch { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 46px; height: 26px; border-radius: 999px; background: var(--field-line); position: relative; transition: background 0.2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch input:checked + span { background: #12a373; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
fieldset.strats { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.strats legend { font-weight: 600; font-size: 0.93rem; margin-bottom: 8px; padding: 0; }
.strat { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.strat:hover { border-color: var(--blue); }
.strat:has(input:checked) { border-color: var(--blue); background: var(--sky); }
.strat input { margin-top: 4px; accent-color: var(--blue); flex: none; width: 18px; height: 18px; }
.strat b { display: block; font-size: 0.98rem; }
.strat small { display: block; color: var(--ink-2); font-size: 0.86rem; margin-top: 2px; }
.budget label { font-weight: 600; font-size: 0.93rem; display: block; margin-bottom: 8px; }
.bin { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bin span { font: 650 1.2rem var(--display); }
.bin input { width: 140px; font: inherit; border: 1.5px solid var(--field-line); border-radius: 10px; padding: 10px 12px; background: var(--surface); color: var(--ink); min-height: 46px; }
.bin select { font: inherit; border: 1.5px solid var(--field-line); border-radius: 10px; padding: 10px 12px; background: var(--surface); color: var(--ink); min-height: 46px; }
.budget input[type="range"] { width: 100%; accent-color: var(--orange); }
.est { color: var(--ink-2); font-size: 0.9rem; margin: 8px 0 0; }
.pfoot { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- forecast ---------- */
.fcontrols { display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap; }
.fcontrols .field { flex: 1; min-width: 240px; }
.fcontrols input[type="range"] { accent-color: var(--blue); min-height: 0; padding: 0; border: 0; }
.assume { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 14px 0; }
.assume div { background: var(--mist); border-radius: var(--radius-m); padding: 12px 14px; display: grid; gap: 2px; }
.assume span { color: var(--muted); font-size: 0.82rem; }
.assume b { font: 700 1.25rem var(--display); }

/* ---------- requests, account, export ---------- */
.reqs { list-style: none; margin: 14px 0 0; padding: 0; display: grid; }
.reqs li { display: flex; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.reqs li:last-child { border-bottom: 0; }
.reqs span { color: var(--muted); font-size: 0.85rem; }
.reqs p { margin: 6px 0 0; color: var(--ink-2); font-size: 0.92rem; }
.rs { align-self: flex-start; font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--sky); color: var(--on-sky) !important; white-space: nowrap; }
.rs-done { background: var(--pill-gr); color: var(--good-text) !important; }
.req form { display: grid; gap: 14px; margin-top: 14px; }
.big { font: 650 1.4rem var(--display); margin: 8px 0 4px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.plain { padding-left: 1.1em; color: var(--ink-2); display: grid; gap: 8px; margin: 12px 0 0; }
#ef { display: grid; gap: 18px; max-width: 560px; }

/* ---------- dialog + toast ---------- */
.dlg { border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--ink); width: min(94vw, 480px); padding: 0; box-shadow: var(--shadow-l); }
.dlg::backdrop { background: rgba(5, 12, 28, 0.6); backdrop-filter: blur(3px); }
.dlg form { display: grid; gap: 16px; padding: 24px; }
.dhead { display: flex; justify-content: space-between; gap: 12px; }
.dhead h2 { font-size: 1.35rem; }
.dhead p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.x { border: 0; background: var(--mist); color: var(--ink); width: 36px; height: 36px; border-radius: 50%; font-size: 1.4rem; line-height: 1; cursor: pointer; flex: none; }
.dfoot { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 0.93rem; opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s; z-index: 200; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #b3321b; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 72px; }
  .side { position: fixed; z-index: 60; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 0; border-top: 1px solid rgba(255, 255, 255, 0.12); }
  .side .brand, .side-foot { display: none; }
  .nav-side { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; gap: 2px; }
  .nav-side a { flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 0.66rem; text-align: center; border-radius: 8px; }
  .nav-side a svg { width: 20px; height: 20px; }
  .nav-side a[aria-current="page"]::before { left: 20%; right: 20%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
  .count { position: absolute; top: 2px; right: 14%; margin: 0; padding: 1px 6px; font-size: 0.65rem; }
  .dot { position: absolute; top: 6px; right: 28%; margin: 0; width: 7px; height: 7px; }
  .topbar { padding: 10px 16px; }
  .view { padding: 20px 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .ads-chip { display: none; }
}
@media (max-width: 760px) {
  .tr.th { display: none; }
  .tr { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .tr > [data-l] { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; }
  .tr > [data-l]::before { content: attr(data-l); color: var(--muted); font-size: 0.82rem; }
  .tr .act { grid-column: 2; grid-row: 1; }
  .frow { grid-template-columns: 90px 1fr 44px; }
  .frow em { display: none; }
  .srow { grid-template-columns: 1.4fr repeat(5, 0.8fr); font-size: 0.82rem; }
  .ins-grid { grid-template-columns: 1fr; }
  .kpi b { font-size: 1.55rem; }
  .who b { max-width: 40vw; }
  .top-actions .btn { padding: 0 14px; }
  .auth-card { padding: 28px 20px; }
}
@media (prefers-reduced-motion: reduce) { .fbar i, .toast { transition: none; } }

/* ---------- admin ---------- */
.tabs { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; align-items: end; margin-bottom: 10px; }
.form-grid .btn { align-self: end; }
.rowbtns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stbl.clients .srow { grid-template-columns: 1.4fr 1.4fr 0.6fr 0.6fr 0.9fr auto; align-items: center; }
.srow small { display: block; color: var(--muted); font-size: 0.8rem; }
.secrets { background: var(--mist); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 18px; margin-top: 16px; }
.secrets h3 { font-size: 1.1rem; margin-bottom: 4px; }
.secrets dl { margin: 10px 0 0; display: grid; gap: 4px; }
.secrets dt { color: var(--muted); font-size: 0.82rem; margin-top: 8px; }
.secrets dd { margin: 0; overflow-wrap: anywhere; }
.secrets code, .card code { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; font-size: 0.88rem; }
.secrets pre { margin: 4px 0; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; font-size: 0.85rem; }
.mapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.mapgrid label { display: grid; gap: 4px; font-weight: 600; font-size: 0.88rem; }
.mapgrid select { font: inherit; font-weight: 400; border: 1.5px solid var(--field-line); border-radius: 10px; padding: 9px 10px; background: var(--surface); color: var(--ink); min-height: 42px; }
.stbl.prev .srow { grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; }
.pq-row { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pq-row:last-child { border-bottom: 0; }
.pq-row p { margin: 6px 0 0; color: var(--ink-2); font-size: 0.93rem; }
.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline input { flex: 1; min-width: 200px; }
.crmlist details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.crmlist summary { cursor: pointer; font-weight: 650; }
.crmlist p { color: var(--ink-2); margin: 8px 0 0; font-size: 0.93rem; }
.reqs select { font: inherit; border: 1.5px solid var(--field-line); border-radius: 10px; padding: 8px 10px; background: var(--surface); color: var(--ink); align-self: flex-start; }
@media (max-width: 760px) { .stbl.clients .srow { grid-template-columns: 1fr 1fr; } .stbl.clients .srow.sh { display: none; } .rowbtns { justify-content: flex-start; } }

/* ---------- navigation: website links, client switcher, More sheet ---------- */
.site-links { margin: 4px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 14px; }
.site-links summary { cursor: pointer; color: #9fb2d6; font-size: 0.8rem; font-weight: 650; list-style: none; padding: 4px 4px 8px; }
.site-links summary::-webkit-details-marker { display: none; }
.site-links summary::after { content: " ▾"; }
.site-links[open] summary::after { content: " ▴"; }
.site-links a { display: block; padding: 7px 4px; color: #b8c8e8; text-decoration: none; font-size: 0.93rem; border-radius: 6px; }
.site-links a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.side { overflow-y: auto; }
.more-btn { display: none; background: none; border: 0; color: #b8c8e8; font: inherit; cursor: pointer; }
.switch-wrap select { font: 650 1rem var(--display); color: var(--ink); background: var(--surface); border: 1.5px solid var(--field-line); border-radius: 10px; padding: 8px 12px; min-height: 42px; max-width: min(46vw, 320px); }
.sheet { padding: 22px; display: grid; gap: 14px; max-height: 80vh; overflow-y: auto; }
.sheet h3 { font-size: 0.85rem; color: var(--muted); margin: 6px 0 -4px; font-weight: 650; }
.sheet-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sheet-links a { display: block; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; background: var(--mist); }
.sheet-links a:hover { border-color: var(--blue); }
.sheet-foot { display: flex; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.pickcard { text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 18px; cursor: pointer; color: var(--ink); font: inherit; display: grid; gap: 4px; transition: border-color 0.15s, transform 0.15s; }
.pickcard:hover { border-color: var(--blue); transform: translateY(-2px); }
.pickcard b { font: 650 1.1rem var(--display); }
.pickcard span { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 960px) {
  .nav-side a.sec { display: none; }
  .more-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; font-size: 0.66rem; border-radius: 8px; }
  .more-btn svg { width: 20px; height: 20px; fill: currentColor; }
  .site-links { display: none; }
  .nav-side { grid-auto-columns: 1fr; }
}
@media (min-width: 961px) { .more-btn { display: none !important; } }

/* ---------- layout tidy-up: consistent grids, centered content, calmer toolbars ---------- */
.view { margin-inline: auto; width: 100%; }
.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1380px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
.toolbar .srch { order: -1; width: min(100%, 360px); }
.toolbar .chip { padding: 7px 12px; font-size: 0.86rem; }
.reqs li b { display: block; margin-bottom: 2px; }
.card + .grid2, .grid2 + .card, .kpis + .card, .callout + .kpis { margin-top: 0; }
.vhead { align-items: flex-start; }
.vhead h1 + p, .vhead div > p { margin-top: 6px; }
.plat-grid, .ins-grid { margin-bottom: 18px; }
.card .chead + .chart { margin-top: 4px; }
.tbl, .stbl { max-width: 100%; }
.toolbar .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.toolbar .chip { flex: none; white-space: nowrap; }
input[type="file"] { width: 100%; font: inherit; color: var(--ink-2); background: var(--surface); border: 1.5px dashed var(--field-line); border-radius: 10px; padding: 10px; }
input[type="file"]::file-selector-button { font: 650 0.9rem var(--body); background: var(--blue); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; margin-right: 12px; cursor: pointer; }

/* ---------- compact scorecard (Weak spots, Needs attention) ---------- */
.card.flush { padding: 6px 20px 8px; }
.tally { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 16px; }
.tally span { font-size: 0.88rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--mist); color: var(--ink-2); border: 1px solid var(--line); }
.tally b { font-family: var(--display); margin-right: 3px; }
.tally .t-weak { color: #d6452a; }
.tally .t-ok { color: #b57d00; }
.tally .t-good { color: var(--good-text); }
:root[data-theme="dark"] .tally .t-ok { color: #ffd966; }
:root[data-theme="dark"] .tally .t-weak { color: #ff9a7a; }
.ilist { display: grid; }
.ilabel { margin: 18px 0 2px; color: var(--muted); font-size: 0.8rem; font-weight: 650; }
.irow { border-bottom: 1px solid var(--line); }
.irow:last-child { border-bottom: 0; }
.irow summary { display: grid; grid-template-columns: 12px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.4fr) 104px; gap: 14px; align-items: center; padding: 13px 2px; cursor: pointer; list-style: none; font-size: 0.93rem; }
.irow summary::-webkit-details-marker { display: none; }
.irow summary:hover .it { color: var(--link); }
.idot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.irow.good .idot { background: #12a373; }
.irow.ok .idot { background: #e0a100; }
.irow.weak .idot { background: #d6452a; }
.irow.nodata .idot { background: transparent; border: 2px dashed var(--muted); width: 10px; height: 10px; }
.it { font-weight: 600; min-width: 0; }
.iv { font: 700 0.98rem var(--display); letter-spacing: -0.01em; }
.itg { color: var(--muted); font-size: 0.82rem; }
.itag { justify-self: end; font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--mist); color: var(--muted); white-space: nowrap; }
.irow.good .itag { background: var(--pill-gr); color: var(--good-text); }
.irow.ok .itag { background: #fff2cc; color: #7a5a00; }
.irow.weak .itag { background: #ffe0d9; color: #a52a12; }
:root[data-theme="dark"] .irow.ok .itag { background: #4a3a05; color: #ffd966; }
:root[data-theme="dark"] .irow.weak .itag { background: #4a1a10; color: #ff9a7a; }
.irow.nodata .iv, .irow.nodata .it { color: var(--muted); font-weight: 500; }
.ibody { padding: 0 2px 14px 26px; display: grid; gap: 6px; max-width: 62em; }
.ibody p { margin: 0; color: var(--ink-2); font-size: 0.92rem; }
.ibody .fix { color: var(--ink); }
.irow[open] summary .it { color: var(--ink); }
.srcnote { margin: -10px 0 16px; color: var(--muted); font-size: 0.9rem; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .irow summary { grid-template-columns: 10px minmax(0, 1fr) auto; gap: 4px 12px; }
  .irow .itg { display: none; }
  .irow .itag { grid-column: 3; grid-row: 1; }
  .irow .iv { grid-column: 2; grid-row: 2; font-size: 0.9rem; color: var(--ink-2); }
  .ibody { padding-left: 22px; }
  .kpis.three { grid-template-columns: 1fr; }
}

/* ---------- message button and chat ---------- */
.msg-fab { position: fixed; left: 16px; bottom: 16px; z-index: 70; display: inline-flex; align-items: center; gap: 10px; background: var(--orange); color: var(--navy); border: 0; border-radius: 999px; padding: 13px 20px 13px 16px; font: 650 0.95rem var(--display); cursor: pointer; box-shadow: 0 12px 28px -8px rgba(255, 107, 26, 0.7); transition: transform 0.18s, box-shadow 0.18s; }
.msg-fab:hover { transform: translateY(-2px); background: #ff7d36; }
.msg-fab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fab-badge { position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #d6452a; color: #fff; font: 700 0.75rem/22px var(--body); text-align: center; font-style: normal; border: 2px solid var(--paper); }
.side { padding-bottom: 88px; }
.chat { position: fixed; left: 252px; bottom: 16px; z-index: 80; width: min(380px, calc(100vw - 24px)); height: min(540px, 76vh); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-l); overflow: hidden; animation: chatIn 0.25s cubic-bezier(.2,.8,.2,1); }
@keyframes chatIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.chat header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; background: var(--navy); color: #fff; }
.chat header b { display: block; font: 650 1.02rem var(--display); }
.chat header span { color: #aebfe0; font-size: 0.82rem; }
.chat .x { background: rgba(255, 255, 255, 0.12); color: #fff; }
.clist { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--mist); }
.cempty { margin: auto; text-align: center; color: var(--muted); font-size: 0.93rem; max-width: 24em; }
.cmsg { display: flex; flex-direction: column; gap: 3px; max-width: 86%; }
.cmsg.me { align-self: flex-end; align-items: flex-end; }
.cb { padding: 10px 14px; border-radius: 16px; font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; }
.cmsg.me .cb { background: var(--blue); color: #fff; border-bottom-right-radius: 5px; }
.cmsg.them .cb { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.ct { font-size: 0.74rem; color: var(--muted); }
.cform { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.cform textarea { flex: 1; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--field-line); border-radius: 12px; padding: 10px 12px; resize: none; min-height: 44px; max-height: 120px; }
.cform textarea:focus { outline: 3px solid rgba(21, 88, 240, 0.35); border-color: var(--blue); }
.cerr { margin: 0; padding: 0 14px 8px; color: #c2310b; font-size: 0.85rem; min-height: 0; }
.cerr:empty { display: none; }
.cnote { margin: 0; padding: 0 14px 10px; color: var(--muted); font-size: 0.78rem; }
@media (max-width: 960px) {
  .msg-fab { bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; padding: 11px 16px 11px 13px; font-size: 0.88rem; }
  .chat { left: 10px; right: 10px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); height: min(70vh, 560px); }
  .side { padding-bottom: 6px; }
}

/* ---------- admin messages ---------- */
.msgwrap { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.msgwrap > .card { margin-bottom: 0; }
.trow { display: grid; gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 8px; cursor: pointer; color: var(--ink); font: inherit; border-radius: 8px; }
.trow:last-child { border-bottom: 0; }
.trow:hover, .trow.on { background: var(--mist); }
.trow span { color: var(--ink-2); font-size: 0.88rem; }
.trow small { color: var(--muted); font-size: 0.78rem; }
.tbadge { font-style: normal; background: var(--orange); color: var(--navy); font-weight: 700; font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.thread .clist { max-height: 52vh; min-height: 240px; border-radius: 12px; margin: 12px 0; }
.thread .cform { border: 0; padding: 0; background: none; }
@media (max-width: 760px) { .msgwrap { grid-template-columns: 1fr; } }

/* ---------- password field ---------- */
.pwbox { position: relative; }
.pwbox input { padding-right: 70px; }
.pw-eye { position: absolute; right: 6px; top: 6px; bottom: 6px; border: 0; background: var(--mist); color: var(--ink-2); border-radius: 8px; padding: 0 12px; font: 600 0.82rem var(--body); cursor: pointer; }
.pw-eye:hover { color: var(--ink); }
.pw-hint { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; }
#forgot { justify-self: start; }

/* ---------- my plan ---------- */
.planhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.planhead .kl { color: var(--muted); font-size: 0.85rem; }
.planhead h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 2px 0 4px; }
.planhead p { margin: 0; color: var(--ink-2); }
.pstat { font-size: 0.82rem; font-weight: 700; padding: 6px 14px; border-radius: 999px; background: var(--mist); }
.ps-active { background: var(--pill-gr); color: var(--good-text); }
.ps-trial { background: var(--sky); color: var(--on-sky); }
.ps-paused { background: #fff2cc; color: #7a5a00; }
.ps-cancelled { background: #ffe0d9; color: #a52a12; }
:root[data-theme="dark"] .ps-paused { background: #4a3a05; color: #ffd966; }
:root[data-theme="dark"] .ps-cancelled { background: #4a1a10; color: #ff9a7a; }
.planmeta { display: flex; gap: 30px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.planmeta span { display: block; color: var(--muted); font-size: 0.82rem; }
.planmeta b { font: 700 1.4rem var(--display); }
.svlist { display: grid; margin-top: 8px; }
.svrow { display: grid; grid-template-columns: minmax(0, 2.4fr) auto minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.svrow:last-child { border-bottom: 0; }
.svmain b { display: block; }
.svmain span { color: var(--ink-2); font-size: 0.9rem; }
.svst { font-size: 0.76rem; font-weight: 700; padding: 4px 11px; border-radius: 999px; background: var(--mist); white-space: nowrap; }
.sv-active { background: var(--pill-gr); color: var(--good-text); }
.sv-in_progress { background: var(--sky); color: var(--on-sky); }
.sv-completed { background: var(--mist); color: var(--ink-2); border: 1px solid var(--line); }
.sv-paused { background: #fff2cc; color: #7a5a00; }
.sv-cancelled { background: #ffe0d9; color: #a52a12; }
:root[data-theme="dark"] .sv-paused { background: #4a3a05; color: #ffd966; }
:root[data-theme="dark"] .sv-cancelled { background: #4a1a10; color: #ff9a7a; }
.svdate { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.svprice { text-align: right; font: 700 1rem var(--display); }
.svprice small { display: block; color: var(--muted); font: 500 0.78rem var(--body); }
@media (max-width: 760px) { .svrow { grid-template-columns: 1fr auto; gap: 6px 12px; } .svdate { grid-column: 1; } .svprice { grid-column: 2; grid-row: 2; } }

/* ---------- admin: accounts, plans, services ---------- */
.presets { margin: 4px 0 18px; }
.presets .strat { padding: 10px 14px; }
.stbl.clients .srow { grid-template-columns: 1.3fr 1.5fr 1.4fr 0.5fr 0.8fr auto; }
.ps-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.ps-dot.ps-active { background: #12a373; }
.ps-dot.ps-trial { background: var(--blue); }
.ps-dot.ps-paused { background: #e0a100; }
.ps-dot.ps-cancelled { background: #d6452a; }
.dlg:has(.mng) { width: min(96vw, 860px); }
.mng { padding: 24px; display: grid; gap: 22px; max-height: 86vh; overflow-y: auto; }
.mng section { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 12px; }
.mng h3 { font-size: 1.05rem; }
.svedit { display: grid; gap: 10px; }
.sve { display: grid; grid-template-columns: minmax(0, 1.6fr) 130px 138px 138px 96px 120px auto auto; gap: 8px; align-items: center; padding: 10px; background: var(--mist); border-radius: 12px; }
.sve small { display: block; color: var(--muted); font-size: 0.78rem; }
.sve select, .sve input, #sf select, #sf input, #pf select, #pf input, #lf input { font: inherit; border: 1.5px solid var(--field-line); border-radius: 8px; padding: 8px 9px; background: var(--surface); color: var(--ink); min-width: 0; width: 100%; min-height: 40px; }
.addsvc summary { cursor: pointer; font-weight: 650; color: var(--link); }
.addsvc form { margin-top: 12px; }
.loglist { display: grid; gap: 8px; }
.lg { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; background: var(--mist); border-radius: 12px; }
.lg > div { flex: 1; min-width: 180px; }
.lg small { display: block; color: var(--muted); font-size: 0.8rem; }
#lf { margin-top: 4px; }
@media (max-width: 960px) { .sve { grid-template-columns: 1fr 1fr; } .sve .svm { grid-column: 1 / -1; } .stbl.clients .srow { grid-template-columns: 1fr 1fr; } .stbl.clients .srow.sh { display: none; } }
