/* Keyfern dashboard, part 2: app shell, auth screens and page layouts. Components live in app.css. */

/* ---- auth ---- */
.auth { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); min-height: 100dvh; }
.auth-side { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: 40px clamp(32px, 5vw, 72px); color: #eaf2ee; background: #06100b; }
.auth-side::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(620px 420px at 12% 6%, rgba(61, 220, 151, .30), transparent 62%), radial-gradient(560px 420px at 96% 92%, rgba(90, 209, 230, .22), transparent 62%), linear-gradient(180deg, #07100c, #050b08); }
.auth-side .brand { color: #fff; }
.auth-copy h2 { font-size: clamp(28px, 3.2vw, 42px); line-height: 1.08; letter-spacing: -.035em; font-weight: 650; margin: 0 0 14px; background: linear-gradient(180deg, #fff 0%, #a9bfb4 100%); -webkit-background-clip: text; background-clip: text; color: transparent; max-width: 15ch; }
.auth-copy p { color: #b4c4bc; font-size: 15.5px; line-height: 1.6; max-width: 44ch; margin: 0; }
.auth-points { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 13px; }
.auth-points li { display: flex; gap: 11px; align-items: flex-start; color: #d3e0d9; font-size: 14.5px; line-height: 1.45; }
.auth-points .icon { color: #3ddc97; margin-top: 1px; }
.auth-art { width: 100%; max-width: 500px; margin: 0 auto; opacity: .95; }
.auth-fine { color: #7f948b; font-size: 12.5px; }
.auth-main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 56px 24px 32px; background: var(--bg); }
.auth-theme { position: absolute; top: 16px; right: 16px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .auth-mobile-brand { display: none; margin-bottom: 28px; }
.auth-box h1 { font-size: 24px; letter-spacing: -.03em; margin-bottom: 6px; }
.auth-box .sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.auth-box .btn.primary { width: 100%; height: 40px; font-size: 14px; }
.auth-box input { height: 40px; }
.auth-box .input-wrap input { padding-right: 44px; } .auth-box .pw-toggle { top: 6px; }
.auth-foot { margin: 20px 0 0; text-align: center; font-size: 13.5px; color: var(--muted); }
.auth-links { display: flex; justify-content: flex-end; margin: -6px 0 16px; font-size: 13px; }
.auth-legal { text-align: center; margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
.auth-back { font-size: 13px; }
.auth-back a { color: var(--muted); }
.auth-back a:hover { color: var(--text); }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-box .auth-mobile-brand { display: inline-flex; }
  .auth-main { justify-content: flex-start; padding-top: 72px; }
}

/* ---- shell ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 16px; letter-spacing: -.02em; text-decoration: none; }
.brand:hover { text-decoration: none; }
.logo-wrap { display: inline-flex; }
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100dvh; background: radial-gradient(900px 380px at 78% -6%, color-mix(in srgb, var(--brand), transparent 93%), transparent 70%), var(--bg); }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 16px; padding: 14px 12px; background: var(--bg-2); border-right: 1px solid var(--border); overflow-y: auto; z-index: 60; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 0; }
.side-close { display: none; }
.sw-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.sw-btn:hover { border-color: var(--border-strong); }
.sw-btn .sw-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sw-btn .sw-text small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.sw-btn .sw-text span { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-btn > .icon { color: var(--muted); }
.side .menu-wrap { width: 100%; }
.side .menu { left: 0; right: 0; min-width: 0; max-width: none; }
.menu-scroll { max-height: 260px; overflow-y: auto; margin: 0 -2px; padding: 0 2px; }
.nav-label { padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 11px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 13.5px; text-decoration: none; transition: background .15s, color .15s; }
.side-nav a .icon { color: var(--muted); transition: color .15s; }
.side-nav a:hover { background: var(--hover); color: var(--text); }
.side-nav a[aria-current='page'] { background: color-mix(in srgb, var(--brand), transparent 88%); color: var(--text); font-weight: 600; }
.side-nav a[aria-current='page'] .icon { color: var(--brand-on-bg); }
.side-nav a[aria-current='page']::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.side-nav .sep { height: 1px; background: var(--border); margin: 8px 4px; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.upgrade { padding: 14px; border-radius: 12px; background: linear-gradient(160deg, color-mix(in srgb, var(--brand), transparent 86%), color-mix(in srgb, var(--brand-2), transparent 93%)); border: 1px solid color-mix(in srgb, var(--brand), transparent 72%); }
.upgrade strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.upgrade p { margin: 0 0 10px; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.side-link { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12.5px; color: var(--muted); border-radius: 8px; }
.side-link:hover { color: var(--text); background: var(--hover); text-decoration: none; }
.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 clamp(16px, 3vw, 32px); background: var(--topbar-bg); backdrop-filter: blur(14px) saturate(1.5); -webkit-backdrop-filter: blur(14px) saturate(1.5); border-bottom: 1px solid var(--border); }
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: 13.5px; flex: 1; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs > span { overflow: hidden; text-overflow: ellipsis; }
.crumbs > span[aria-current] { color: var(--text); font-weight: 600; }
.crumbs .icon { color: var(--border-strong); }
.plan-chip { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px 0 8px; border: 1px solid var(--border); border-radius: 99px; background: var(--card); color: var(--text); font-size: 12.5px; text-decoration: none; white-space: nowrap; transition: border-color .15s; }
.plan-chip:hover { border-color: var(--border-strong); text-decoration: none; }
.plan-chip .meter { width: 56px; height: 5px; }
.plan-chip .pc-text { color: var(--muted); font-variant-numeric: tabular-nums; }
.acct-btn { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 3px; border: 1px solid transparent; border-radius: 99px; background: transparent; color: var(--muted); cursor: pointer; }
.acct-btn:hover { background: var(--hover); border-color: var(--border); }
.acct-btn .avatar { border-radius: 50%; }
.view { padding: 28px clamp(16px, 3vw, 32px) 96px; width: 100%; max-width: 1240px; margin: 0 auto; outline: none; flex: 1; }
.page { animation: rise .32s var(--ease); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; margin-bottom: 22px; }
.page-title { min-width: 0; }
.page-title h1 { font-size: 22px; letter-spacing: -.025em; margin: 0 0 4px; }
.page-title p { margin: 0; max-width: 68ch; font-size: 14px; line-height: 1.55; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(288px, 86vw); transform: translateX(-102%); transition: transform .26s var(--ease), visibility 0s .26s; visibility: hidden; box-shadow: 24px 0 60px -20px rgba(0, 0, 0, .6); }
  body.nav-open .side { transform: none; visibility: visible; transition: transform .26s var(--ease), visibility 0s; }
  .side-close { display: inline-flex; }
  .menu-btn { display: inline-flex; margin-left: -6px; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: var(--backdrop, rgba(2, 8, 5, .6)); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .2s; display: block; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
}
@media (max-width: 640px) { .plan-chip .pc-text, .plan-chip .meter { display: none; } .plan-chip { padding-right: 8px; } .view { padding-top: 20px; } }

/* ---- products ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pcard { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; color: var(--text); text-decoration: none; box-shadow: var(--card-shadow); transition: border-color .18s, transform .18s var(--ease), box-shadow .18s; }
.pcard:hover { border-color: color-mix(in srgb, var(--brand), transparent 55%); transform: translateY(-2px); box-shadow: 0 16px 40px -22px color-mix(in srgb, var(--brand), transparent 30%); text-decoration: none; }
.pcard-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pcard h3 { font-size: 15px; overflow-wrap: anywhere; }
.pcard .pid { font: 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.pcard .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard .go { position: absolute; right: 16px; top: 18px; color: var(--muted); transition: transform .18s var(--ease), color .18s; }
.pcard:hover .go { color: var(--brand-on-bg); transform: translate(2px, -2px); }
.pcard.new { align-items: center; justify-content: center; text-align: center; min-height: 128px; border-style: dashed; border-color: var(--border-strong); background: transparent; box-shadow: none; color: var(--text-2); font-weight: 550; cursor: pointer; font: inherit; }
.pcard.new .plus { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border); color: var(--brand-on-bg); }
.phead { display: flex; align-items: center; gap: 14px; min-width: 0; }
.phead h1 { font-size: 22px; letter-spacing: -.025em; overflow-wrap: anywhere; }
.phead .idrow { display: flex; align-items: center; gap: 2px; font: 12px var(--mono); color: var(--muted); margin-top: 2px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 24px; overflow-x: auto; scrollbar-width: none; }
.tabs a { position: relative; padding: 10px 12px; color: var(--muted); font-weight: 500; font-size: 13.5px; white-space: nowrap; text-decoration: none; border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
.tabs a:hover { color: var(--text); background: var(--hover); }
.tabs a[aria-current='page'] { color: var(--text); font-weight: 600; }
.tabs a[aria-current='page']::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad); }

/* ---- overview ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; } .stat { padding: 14px; } .stat-v { font-size: 24px; } .crumbs a, .crumbs > .icon { display: none; } }
.stat { min-width: 0; padding: 16px 18px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--card-shadow); transition: border-color .15s; }
.stat:hover { border-color: var(--border-strong); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-ic { --c: var(--muted); --ct: var(--text-2); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--ct); background: color-mix(in srgb, var(--c), transparent 87%); }
.stat-ic.ok { --c: var(--ok); --ct: var(--ok-t); } .stat-ic.warn { --c: var(--warn); --ct: var(--warn-t); } .stat-ic.bad { --c: var(--bad); --ct: var(--bad-t); } .stat-ic.brand { --c: var(--brand); --ct: var(--brand-on-bg); }
.stat-v { margin: 10px 0 8px; font-size: 28px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; color: var(--muted); font-size: 12.5px; }
.distbar { display: flex; gap: 2px; width: 100%; height: 6px; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--muted), transparent 82%); }
.distbar i { display: block; height: 100%; min-width: 0; }
.distbar .a { background: var(--ok); } .distbar .e { background: var(--warn); } .distbar .b { background: var(--bad); }
.spark { display: block; flex: none; overflow: visible; }
.spark-line { fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { fill: color-mix(in srgb, var(--brand), transparent 86%); }
.spark-dot { fill: var(--brand); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--ok-t); background: color-mix(in srgb, var(--ok), transparent 88%); white-space: nowrap; }
.delta.flat { color: var(--muted); background: color-mix(in srgb, var(--muted), transparent 88%); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1060px) { .ov-grid { grid-template-columns: minmax(0, 1fr); } }
.ov-grid .card { margin-bottom: 0; }
.chart-sum { display: flex; align-items: baseline; gap: 10px; }
.chart-sum strong { font-size: 24px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-empty { left: 30px; }
.chart .gridline { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .gridline.base { stroke: var(--border-strong); stroke-dasharray: none; }
.chart .axis-t { fill: var(--muted); font: 11px var(--font); }
.chart .bar-a { fill: var(--brand); }
.chart .bar-t { fill: var(--c2); }
.chart .bar-hit { fill: transparent; }
.chart .bar:hover .bar-hit { fill: var(--hover); }
.chart-tip { position: absolute; z-index: 3; transform: translateX(-50%); display: flex; flex-direction: column; gap: 3px; padding: 8px 11px; border-radius: 10px; background: var(--card); border: 1px solid var(--border-strong); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5); font-size: 12.5px; white-space: nowrap; pointer-events: none; }
.chart-tip strong { font-weight: 600; }
.chart-tip span { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.chart-empty { position: absolute; left: 30px; right: 0; top: 0; bottom: 26px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 24px; text-align: center; color: var(--muted); font-size: 13px; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.legend i, .chart-tip i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip i { margin-right: 0; }
.legend i.k1, .chart-tip i.k1 { background: var(--brand); } .legend i.k2, .chart-tip i.k2 { background: var(--c2); }
.rlist { list-style: none; margin: 0 -8px; padding: 0; display: grid; }
.rlist li { margin: 0; }
.ritem { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .12s; }
.ritem:hover { background: var(--hover); }
.ritem .rk { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ritem .rk code { background: none; border: 0; padding: 0; font: 550 12.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ritem .rk span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onb { position: relative; overflow: hidden; margin-bottom: 16px; }
.onb::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--grad); }
.onb-prog { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.onb-prog .meter { flex: 1; max-width: 280px; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.step { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 12px; border: 1px solid transparent; border-radius: 12px; }
.step.cur { background: color-mix(in srgb, var(--brand), transparent 93%); border-color: color-mix(in srgb, var(--brand), transparent 80%); }
.step-dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-strong); color: var(--muted); font-size: 12px; font-weight: 600; }
.step.cur .step-dot { border-color: var(--brand); color: var(--brand-on-bg); }
.step.done .step-dot { background: var(--grad); border-color: transparent; color: var(--on-brand); }
.step-title { font-weight: 600; font-size: 14px; }
.step.done .step-title { color: var(--muted); font-weight: 550; }
.step-desc { margin: 2px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.step-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) { .step { grid-template-columns: 24px minmax(0, 1fr); } .step-act { grid-column: 2; justify-content: flex-start; } }

/* ---- stripe / integrate / hooks ---- */
.howto { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 4px; }
.howto li { counter-increment: s; position: relative; padding: 4px 0 14px 42px; }
.howto li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 650; color: var(--brand-on-bg); background: color-mix(in srgb, var(--brand), transparent 86%); border: 1px solid color-mix(in srgb, var(--brand), transparent 70%); }
.howto li:not(:last-child)::after { content: ''; position: absolute; left: 12.5px; top: 32px; bottom: 2px; width: 1px; background: var(--border); }
.howto li strong { display: block; font-weight: 600; }
.howto li > span { color: var(--muted); font-size: 13.5px; }
.status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 18px; }
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.event { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-2); }
.event code { font-weight: 600; background: none; border: 0; padding: 0; color: var(--brand-on-bg); }
.event p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.secret { font: 12.5px var(--mono); color: var(--text-2); }
.act-code { font: 550 12px var(--mono); }
.int-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.int-grid .card { margin-bottom: 0; }

/* ---- billing ---- */
.plan-now { display: grid; gap: 20px; }
.plan-now-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plan-now h2 { font-size: 20px; letter-spacing: -.025em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.usage { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card-2); }
.usage .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.usage .top strong { color: var(--text); font-size: 18px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.plan { position: relative; display: flex; flex-direction: column; padding: 22px 20px 20px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--card-shadow); transition: border-color .18s, transform .18s var(--ease); }
.plan:hover { border-color: var(--border-strong); }
.plan.current { border-color: color-mix(in srgb, var(--brand), transparent 35%); box-shadow: var(--glow); }
.plan.popular { border-color: color-mix(in srgb, var(--brand-2), transparent 55%); }
.plan h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.plan .price { font-size: 34px; font-weight: 650; letter-spacing: -.04em; line-height: 1; }
.plan .price small { font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-left: 4px; }
.plan .psub { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; min-height: 18px; }
.plan ul { list-style: none; margin: 18px 0 20px; padding: 18px 0 0; border-top: 1px solid var(--border); display: grid; gap: 10px; flex: 1; align-content: start; }
.plan li { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; line-height: 1.4; }
.plan li .icon { color: var(--brand-on-bg); margin-top: 1px; }
.plan li.no { color: var(--muted); } .plan li.no .icon { color: var(--border-strong); }
.plan .btn { width: 100%; }
.plan .note { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.45; }
.billing-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 28px 0 14px; }
.billing-head h2 { font-size: 16px; }

/* ---- account / operator ---- */
.profile { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile .avatar { border-radius: 50%; }
.profile strong { display: block; font-size: 16px; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
.cols-2 .card { margin-bottom: 0; }
.cols-2 + .card, .cols-2 + .cols-2 { margin-top: 16px; }
.section-title { font-size: 16px; margin: 28px 0 12px; }
.plan-select { display: flex; align-items: center; gap: 8px; }
.plan-select select { width: auto; height: 30px; font-size: 13px; }

/* ---------- support chat (customer bubble) ---------- */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.chat-fab { position: relative; width: 54px; height: 54px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--brand-strong); color: #fff; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .45); }
.chat-fab:hover { filter: brightness(1.08); }
.chat.open .chat-fab { background: var(--card); color: var(--text); border: 1px solid var(--border-strong); }
.chat-count, .nav-count { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font: 700 11px/19px var(--font); text-align: center; }
.chat-fab .chat-count { position: absolute; top: -2px; right: -2px; box-shadow: 0 0 0 2px var(--bg); }
.nav-count { margin-left: auto; }
.chat-panel { width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 110px)); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--border); }
.chat-head strong { display: block; font-size: 15px; }
.chat-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.chat-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-2); }
.chat-empty { margin: auto; text-align: center; color: var(--muted); max-width: 260px; font-size: 13.5px; }
.chat-empty .ic { color: var(--brand-on-bg); }
.chat-note { margin: 0; padding: 8px 16px; font-size: 12.5px; color: var(--muted); background: var(--card-2); border-top: 1px solid var(--border); }
.msg { max-width: 82%; align-self: flex-start; }
.msg.mine { align-self: flex-end; }
.msg-body { padding: 9px 12px; border-radius: 14px 14px 14px 4px; background: var(--card); border: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.msg.mine .msg-body { border-radius: 14px 14px 4px 14px; background: var(--brand-strong); border-color: transparent; color: #fff; }
.msg-meta { margin-top: 3px; font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.msg.mine .msg-meta { text-align: right; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--border); background: var(--card); }
.composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 140px; font: inherit; font-size: 14px; }
.composer .send { width: 42px; height: 42px; padding: 0; flex: none; }
@media (max-width: 520px) { .chat { right: 12px; bottom: 12px; } .chat-panel { height: calc(100vh - 96px); } }

/* ---------- operator: tickets ---------- */
.tk { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 16px; min-height: 560px; }
.tk-list { display: flex; flex-direction: column; gap: 6px; max-height: 70vh; overflow-y: auto; }
.tk-item { position: relative; display: block; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); text-decoration: none; }
.tk-item:hover { background: var(--hover); }
.tk-item.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.tk-item.unread b { font-weight: 700; }
.tk-item .chat-count { position: absolute; right: 10px; bottom: 10px; }
.tk-item .badge { position: absolute; right: 10px; bottom: 10px; }
.tk-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.tk-top .dt { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tk-sub { font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-last { font-size: 12.5px; margin-top: 2px; padding-right: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-convo { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; min-height: 560px; max-height: 76vh; }
.tk-convo > .empty { margin: auto; }
.tk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
@media (max-width: 860px) { .tk { grid-template-columns: minmax(0, 1fr); } .tk-list { max-height: 260px; } }

/* ---------- operator: charts, drawers ---------- */
.bars { width: 100%; height: auto; display: block; margin-top: 8px; }
.bars .grid { stroke: var(--border); }
.bars .axis { fill: var(--muted); font: 11px var(--font); }
.bars .b1, .legend i.b1 { fill: var(--brand); background: var(--brand); }
.bars .b2, .legend i.b2 { fill: var(--c2, #2aa6c0); background: var(--c2, #2aa6c0); }
.card-head .legend { margin-top: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--hover); }
.drawer-sec { margin-top: 22px; }
.drawer-sec h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

/* ---------- product analytics (map) ---------- */
.an-bar .grow { flex: 1; }
.an-wrap { position: relative; }
.an-map { width: 100%; height: auto; display: block; }
.an-map path { fill: var(--card-2); stroke: var(--border-strong); stroke-width: .4; transition: fill-opacity .15s; }
:root[data-theme='light'] .an-map path { fill: #e6ece9; stroke: #ffffff; stroke-width: .6; }
.an-map path.on, :root[data-theme='light'] .an-map path.on { fill: var(--brand-strong); }
.an-tip { position: absolute; z-index: 3; min-width: 170px; padding: 9px 11px; border-radius: 10px; background: var(--card); border: 1px solid var(--border-strong); box-shadow: 0 10px 30px -12px rgba(0,0,0,.4); font-size: 12.5px; pointer-events: none; }
.an-tip b { display: block; margin-bottom: 4px; font-size: 13px; }
.an-tip div { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); }
.an-tip strong { color: var(--text); font-variant-numeric: tabular-nums; }
.an-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.an-scale { display: inline-block; width: 140px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--brand-strong) 18%, transparent), var(--brand-strong)); }
.an-legend .small { margin-left: 8px; }
.an-credit { margin-top: 4px; }
@media (max-width: 640px) { .an-bar .grow { display: none; } }

/* analytics map: zoom, pan, hover highlight */
.an-map { touch-action: none; cursor: grab; user-select: none; }
.an-wrap.dragging .an-map { cursor: grabbing; }
.an-map path { vector-effect: non-scaling-stroke; transition: fill .12s, fill-opacity .12s; }
.an-map path.hot { fill: color-mix(in srgb, var(--brand-strong) 30%, var(--card-2)); stroke: var(--brand-strong); stroke-width: 1.6; }
:root[data-theme='light'] .an-map path.hot { fill: color-mix(in srgb, var(--brand-strong) 30%, #e6ece9); stroke: var(--brand-strong); stroke-width: 1.6; }
.an-map path.on.hot, :root[data-theme='light'] .an-map path.on.hot { fill: var(--brand); fill-opacity: 1 !important; stroke: var(--text); stroke-width: 1.4; }
.an-zoom { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.an-zoom .iconbtn { background: var(--card); border: 1px solid var(--border-strong); box-shadow: 0 2px 6px -2px rgba(0,0,0,.25); }
.an-zoom .iconbtn:disabled { opacity: .45; cursor: default; }

/* keys table: days left in bold, exact date under it */
.exp { line-height: 1.25; }
.exp b { display: block; font-weight: 600; font-size: 13px; }
.exp small { display: block; color: var(--muted); font-size: 11.5px; }
.exp.soon b { color: var(--warn-ink, var(--warn)); }
.exp.past b { color: var(--bad-ink, var(--bad)); }
.exp.muted b { color: var(--text-2); font-weight: 500; }
.exp-row { align-items: end; }
/* a field switched off by another option (e.g. Perpetual): clearly greyed out */
.field.off, .sw-row.off, .switch-row.off { opacity: .4; pointer-events: none; }
.field.off input { background: var(--card-2); }
