:root, html[data-theme="dark"]{
  --bg:#0a0c0f; --surface:#111419; --surface-2:#161a20; --surface-3:#1c212a;
  --hover:#20262f; --border:#252b34; --border-2:#333b47;
  --text:#e8ebf0; --text-2:#98a1ae; --text-3:#69717d;
  --value:#38d38a; --value-2:#25b877; --value-bg:rgba(56,211,138,.11); --value-border:rgba(56,211,138,.34);
  --warn:#e9b45f; --warn-bg:rgba(233,180,95,.11); --warn-border:rgba(233,180,95,.32);
  --danger:#f0736b; --danger-bg:rgba(240,115,107,.11); --danger-border:rgba(240,115,107,.32);
  --focus:#5b8def; --discord:#5865F2;
  --pos-gk:#e2a95d; --pos-df:#6f9be8; --pos-mf:#b98be0; --pos-fw:#e084a6;
  --font-sans:system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --font-mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  --r-sm:6px; --r:9px; --r-lg:13px;
  --sh-1:0 1px 2px rgba(0,0,0,.4); --sh-2:0 8px 24px -6px rgba(0,0,0,.55);
}
html[data-theme="light"]{
  --bg:#eef1f5; --surface:#ffffff; --surface-2:#f6f8fa; --surface-3:#eceff3;
  --hover:#e6eaef; --border:#e3e7ec; --border-2:#cdd3db;
  --text:#161b22; --text-2:#586170; --text-3:#8b93a0;
  --value:#0f9d58; --value-2:#0c8a4d; --value-bg:rgba(15,157,88,.10); --value-border:rgba(15,157,88,.30);
  --warn:#b47818; --warn-bg:rgba(180,120,24,.12); --warn-border:rgba(180,120,24,.30);
  --danger:#d64840; --danger-bg:rgba(214,72,64,.09); --danger-border:rgba(214,72,64,.28);
  --focus:#3366e0;
  --pos-gk:#b47818; --pos-df:#3f6fd4; --pos-mf:#8a52c9; --pos-fw:#c74d80;
  --sh-1:0 1px 2px rgba(24,39,75,.06); --sh-2:0 10px 30px -10px rgba(24,39,75,.16);
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{background:var(--bg);color:var(--text);font-family:var(--font-sans);-webkit-font-smoothing:antialiased;line-height:1.45;}
a{color:var(--focus);text-decoration:none;}
a:hover{color:#7ba6ff;}
html[data-theme="light"] a:hover{color:#5b82e8;}
h1,h2,h3,p{margin:0;}
.mono{font-family:var(--font-mono);font-variant-numeric:tabular-nums;}
:focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:4px;}

/* ── layout ── */
.oh-app{min-height:100vh;display:flex;flex-direction:column;}
.oh-container{max-width:1440px;margin:0 auto;width:100%;padding:0 24px;}
.oh-page{padding:24px 0 64px;}
.oh-page__title{font-size:20px;font-weight:700;letter-spacing:-.01em;}
.oh-page__sub{font-size:12.5px;color:var(--text-2);margin-top:3px;}

/* ── topbar ── */
.oh-topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;height:56px;padding:0 24px;border-bottom:1px solid var(--border);background:var(--surface-2);}
.oh-topbar__left{display:flex;align-items:center;gap:28px;}
.oh-logo{display:flex;align-items:center;gap:9px;font-weight:700;font-size:15px;letter-spacing:-.01em;color:var(--text);}
.oh-logo__mark{width:22px;height:22px;border-radius:6px;border:1.5px solid var(--value);display:flex;align-items:center;justify-content:center;}
.oh-logo__dot{width:7px;height:7px;border-radius:50%;background:var(--value);box-shadow:0 0 8px var(--value);}
.oh-nav{display:flex;align-items:center;gap:2px;}
.oh-nav__item{padding:7px 12px;border-radius:var(--r-sm);font-size:13px;font-weight:500;color:var(--text-2);}
.oh-nav__item:hover{color:var(--text);background:var(--hover);}
.oh-nav__item--active{font-weight:600;color:var(--text);background:var(--surface-3);}
.oh-topbar__right{display:flex;align-items:center;gap:10px;}
.oh-userchip{display:flex;align-items:center;gap:9px;padding:4px 10px 4px 4px;border:1px solid var(--border);border-radius:999px;background:var(--surface);cursor:pointer;font-size:12.5px;font-weight:600;color:var(--text);}
.oh-avatar{width:26px;height:26px;border-radius:50%;background:linear-gradient(135deg,#3a4658,#242c38);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;color:var(--text-2);}
/* .oh-btn below sets display:inline-flex at equal specificity and would win
   on source order, so this needs the extra class to actually hide it. */
.oh-btn.oh-menu-btn{display:none;}

/* ── buttons ── */
.oh-btn{display:inline-flex;align-items:center;gap:8px;height:36px;padding:0 15px;border-radius:var(--r);font-size:13px;font-weight:600;cursor:pointer;border:1px solid transparent;background:none;color:var(--text);font-family:inherit;}
.oh-btn--primary{background:var(--surface-3);border-color:var(--border-2);}
.oh-btn--primary:hover{background:var(--hover);}
.oh-btn--secondary{border-color:var(--border-2);}
.oh-btn--secondary:hover{background:var(--hover);}
.oh-btn--danger{color:var(--danger);border-color:var(--border-2);}
.oh-btn--danger:hover{background:var(--danger-bg);}
.oh-btn--discord{background:var(--discord);color:#fff;box-shadow:0 8px 24px -8px rgba(88,101,242,.55);border:none;}
.oh-btn--discord:hover{filter:brightness(1.07);}
/* Google sign-in: neutral white button per Google brand, works in both themes. */
.oh-btn--google{background:#fff;color:#1f1f1f;border:1px solid #dadce0;}
.oh-btn--google:hover{background:#f7f8f8;}
.oh-btn--google svg{flex-shrink:0;}
.oh-btn--icon{width:32px;height:32px;padding:0;justify-content:center;border-color:var(--border);color:var(--text-2);}
.oh-btn--icon:hover{background:var(--hover);color:var(--text);}
.oh-btn--lg{height:44px;padding:0 24px;font-size:14.5px;border-radius:var(--r);}

/* ── badges ── */
.oh-badge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:700;letter-spacing:.03em;border-radius:999px;padding:2px 9px;font-family:var(--font-mono);}
.oh-badge--value{color:var(--value);background:var(--value-bg);border:1px solid var(--value-border);}
.oh-badge--warn{color:var(--warn);background:var(--warn-bg);border:1px solid var(--warn-border);}
.oh-badge--danger{color:var(--danger);background:var(--danger-bg);border:1px solid var(--danger);}
.oh-badge--neutral{color:var(--text-2);border:1px solid var(--border-2);}
.oh-tag{font-size:9px;font-weight:700;letter-spacing:.04em;border-radius:4px;padding:1px 5px;font-family:var(--font-mono);}
.oh-tag--value{color:var(--value);background:var(--value-bg);border:1px solid var(--value-border);}
.oh-tag--owner{color:var(--warn);background:var(--warn-bg);border:1px solid var(--warn-border);}
.oh-pos{font-size:9px;font-weight:700;letter-spacing:.03em;border-radius:4px;padding:1px 4px;font-family:var(--font-mono);background:transparent;}
.oh-pos--gk{color:var(--pos-gk);border:1px solid var(--pos-gk);}
.oh-pos--df{color:var(--pos-df);border:1px solid var(--pos-df);}
.oh-pos--mf{color:var(--pos-mf);border:1px solid var(--pos-mf);}
.oh-pos--fw{color:var(--pos-fw);border:1px solid var(--pos-fw);}

/* ── status dot (never rely on colour alone: always paired with label) ── */
.oh-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;display:inline-block;}
.oh-dot--ok{background:var(--value);box-shadow:0 0 6px var(--value);}
.oh-dot--wait{background:var(--warn);}
.oh-dot--none{background:var(--border-2);}
.oh-dot--live{animation:livePulse 2s ease-in-out infinite;}
.oh-status{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--text-3);}

/* ── cards / panels ── */
.oh-card{border:1px solid var(--border);border-radius:var(--r-lg);background:var(--surface-2);padding:20px;}
.oh-card--value{border-color:var(--value-border);background:linear-gradient(180deg,var(--value-bg),transparent);}
.oh-card--warn{border-color:var(--warn-border);}
.oh-card__label{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-2);}
.oh-grid{display:grid;gap:16px;}
.oh-panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);box-shadow:var(--sh-2);overflow:hidden;}

/* ── tables ── */
.oh-tablewrap{border:1px solid var(--border);border-radius:var(--r);overflow:hidden;}
.oh-tablescroll{overflow-x:auto;}
.oh-table{width:100%;border-collapse:collapse;}
.oh-table th{background:var(--surface-2);height:40px;font-size:11px;font-weight:600;color:var(--text-2);text-transform:uppercase;letter-spacing:.05em;text-align:left;padding:0 16px;border-bottom:1px solid var(--border);white-space:nowrap;}
.oh-table th.num{text-align:right;}
.oh-table th.oh-th--sortable{cursor:pointer;user-select:none;}
.oh-table th .arrow{color:var(--focus);font-size:9px;margin-left:3px;}
.oh-table td{height:46px;padding:0 16px;border-bottom:1px solid var(--border);font-size:13px;vertical-align:middle;}
.oh-table td.num{text-align:right;font-family:var(--font-mono);font-variant-numeric:tabular-nums;}
.oh-table tr:last-child td{border-bottom:none;}
.oh-table tbody tr{animation:rowIn .3s ease both;}
.oh-table tbody tr.is-value{background:var(--value-bg);box-shadow:inset 3px 0 0 var(--value);}
.is-value .ev,.is-value .kelly{color:var(--value);font-weight:700;}
.ev{color:var(--text-2);} .kelly{color:var(--text-3);}
.fair{color:var(--text-2);}
.oh-sel{display:flex;align-items:center;gap:9px;}
.oh-row-link{cursor:pointer;} .oh-row-link:hover td{background:var(--hover);}

/* ── tabs ── */
.oh-tabs{display:flex;gap:4px;flex-wrap:wrap;border-bottom:1px solid var(--border);}
.oh-tab{display:flex;align-items:center;gap:7px;padding:9px 13px;font-size:13px;font-weight:500;color:var(--text-2);border-bottom:2px solid transparent;margin-bottom:-1px;cursor:pointer;white-space:nowrap;background:none;border-top:none;border-left:none;border-right:none;font-family:inherit;}
.oh-tab:hover{color:var(--text);}
.oh-tab--active{font-weight:600;color:var(--text);border-bottom-color:var(--value);}

/* ── forms ── */
.oh-field{display:block;}
.oh-label{font-size:12px;color:var(--text-2);display:block;margin-bottom:5px;}
.oh-input,.oh-select{width:100%;height:38px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r);color:var(--text);padding:0 12px;font-family:var(--font-mono);font-size:14px;font-variant-numeric:tabular-nums;}
.oh-input:focus{outline:none;border-color:var(--focus);box-shadow:0 0 0 3px rgba(91,141,239,.25);}
.oh-input--invalid{border-color:var(--danger);}
.oh-check{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--text-2);cursor:pointer;}
.oh-check__box{width:16px;height:16px;border-radius:4px;border:1px solid var(--border-2);display:flex;align-items:center;justify-content:center;color:var(--value);font-size:10px;flex-shrink:0;}
.oh-check--on .oh-check__box{background:var(--surface-3);}
.oh-check--on{color:var(--text);}
.oh-toggle{width:40px;height:22px;border-radius:999px;background:var(--surface-3);position:relative;flex-shrink:0;cursor:pointer;border:none;transition:background .15s;}
.oh-toggle::after{content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:var(--text-3);transition:transform .15s,background .15s;}
.oh-toggle--on{background:var(--value);}
.oh-toggle--on::after{transform:translateX(18px);background:#fff;}
.oh-seg{display:flex;gap:5px;}
.oh-seg__opt{flex:1;text-align:center;font-size:11.5px;padding:8px 0;border-radius:var(--r-sm);color:var(--text-2);border:1px solid var(--border);cursor:pointer;background:none;font-family:inherit;}
.oh-seg__opt--active{font-weight:600;color:var(--value);border-color:var(--value-border);background:var(--value-bg);}

/* ── pagination ── */
.oh-pagination{display:flex;align-items:center;gap:4px;}
.oh-pagination a,.oh-pagination span.pg{min-width:30px;height:30px;border-radius:var(--r-sm);display:flex;align-items:center;justify-content:center;font-size:12.5px;color:var(--text-2);}
.oh-pagination .pg--active{background:var(--surface-3);font-weight:600;color:var(--text);}
.oh-pagination .pg--nav{border:1px solid var(--border);}

/* ── empty / skeleton ── */
.oh-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:40px 20px;text-align:center;}
.oh-empty__icon{width:38px;height:38px;border-radius:10px;border:1px dashed var(--border-2);display:flex;align-items:center;justify-content:center;color:var(--text-3);font-size:18px;}
.oh-empty__title{font-size:13.5px;font-weight:600;}
.oh-empty__desc{font-size:12px;color:var(--text-2);max-width:300px;line-height:1.45;}
.oh-skel{border-radius:5px;background:var(--surface-3);animation:livePulse 1.4s ease-in-out infinite;}

/* ── toast ── */
.oh-toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%) translateY(20px);opacity:0;pointer-events:none;display:flex;align-items:center;gap:9px;background:var(--surface-2);border:1px solid var(--value-border);border-radius:var(--r);box-shadow:var(--sh-2);padding:12px 16px;font-size:13px;z-index:60;transition:opacity .2s,transform .2s;}
.oh-toast--show{opacity:1;transform:translateX(-50%) translateY(0);pointer-events:auto;}

/* ── crest placeholder ── */
.oh-crest{width:20px;height:20px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;font-size:8.5px;font-weight:800;flex-shrink:0;background:var(--surface-3);color:var(--text-2);border:1px solid var(--border-2);}
.oh-crest--lg{width:48px;height:48px;border-radius:12px;font-size:16px;}

/* ── progress bar ── */
.oh-progress{height:6px;border-radius:999px;background:var(--surface-3);overflow:hidden;}
.oh-progress__fill{height:100%;border-radius:999px;background:var(--value);}

/* ── animations ── */
@keyframes rowIn{from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:none;}}
@keyframes livePulse{0%,100%{opacity:1;transform:scale(1);}50%{opacity:.45;transform:scale(.82);}}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important;}}

/* ── responsive ── */
@media (max-width:768px){
  .oh-container{padding:0 16px;}
  .oh-nav{position:fixed;top:56px;left:0;right:0;flex-direction:column;gap:0;background:var(--surface-2);border-bottom:1px solid var(--border);padding:8px;display:none;z-index:19;}
  .oh-nav--open{display:flex;}
  .oh-nav__item{padding:12px;border-radius:var(--r-sm);}
  .oh-btn.oh-menu-btn{display:inline-flex;}
  .oh-grid--2,.oh-grid--3,.oh-grid--4{grid-template-columns:1fr!important;}
  .oh-userchip span{display:none;}
}
.oh-grid--2{grid-template-columns:repeat(2,1fr);}
.oh-grid--3{grid-template-columns:repeat(3,1fr);}
.oh-grid--4{grid-template-columns:repeat(4,1fr);}

/* ── role gating (data-role on <html>, set by oh-boot.js) ── */
html[data-role="user"] .role-admin,
html[data-role="user"] .role-owner,
html[data-role="admin"] .role-owner{display:none!important;}
html[data-role="admin"] .role-user-only,
html[data-role="owner"] .role-user-only{display:none!important;}

/* ── auth screens (2FA / pending) reuse .oh-* system ── */
.oh-authwrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:32px 20px;}
.oh-authcard{width:100%;max-width:440px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);box-shadow:var(--sh-2);padding:28px;}
.oh-authcard--wide{max-width:520px;}
.oh-authcode{width:100%;height:52px;text-align:center;font-family:var(--font-mono);font-size:22px;font-weight:600;letter-spacing:.35em;text-indent:.35em;background:var(--surface-2);border:1px solid var(--border-2);border-radius:var(--r);color:var(--text);}
.oh-authcode:focus{outline:none;border-color:var(--focus);box-shadow:0 0 0 3px rgba(91,141,239,.25);}

/* ── auth screens (2FA/pending) ── */
.auth-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:32px 20px; position:relative; overflow:hidden; }
.auth-wrap::before { content:""; position:absolute; inset:0; background:radial-gradient(900px 440px at 50% -12%, rgba(56,211,138,.08), transparent 70%); pointer-events:none; }
.auth-card { position:relative; width:100%; max-width:440px; background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg); box-shadow:var(--sh-2); padding:28px 28px 24px; }
.auth-card--wide { max-width:520px; }
.auth-brand { display:flex; align-items:center; gap:9px; justify-content:center; margin-bottom:6px; }
.auth-brand .oh-brand__name { font-size:16px; }
.auth-title { text-align:center; font-size:18px; font-weight:700; letter-spacing:-.01em; margin-top:14px; }
.auth-sub { text-align:center; font-size:13px; color:var(--text-2); margin-top:6px; line-height:1.5; }
.auth-status { display:flex; flex-direction:column; gap:4px; margin:16px 0 4px; padding:10px 12px; border:1px solid var(--border); border-radius:var(--r); background:var(--surface-2); font-family:var(--font-mono); font-size:12px; color:var(--text-2); }
.auth-status .k { color:var(--text-3); }
.auth-status .ok { color:var(--value); }
.auth-status .wait { color:var(--warn); }
.auth-form { display:flex; flex-direction:column; gap:12px; margin-top:18px; }
.auth-code { width:100%; height:52px; text-align:center; font-family:var(--font-mono); font-size:22px; font-weight:600; letter-spacing:.35em; text-indent:.35em; background:var(--surface-2); border:1px solid var(--border-2); border-radius:var(--r); color:var(--text); outline:none; transition:border-color .12s, box-shadow .12s; }
.auth-code:focus { border-color:var(--focus); box-shadow:0 0 0 3px rgba(91,141,239,.25); }
.auth-err { text-align:center; font-size:12.5px; color:var(--danger); background:var(--danger-bg); border:1px solid var(--danger); border-radius:var(--r-sm); padding:8px 10px; }
.auth-actions { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:16px; font-size:12.5px; }
.auth-link { color:var(--text-3); }
.auth-link:hover { color:var(--danger); }
.auth-meta { text-align:center; margin-top:18px; font-family:var(--font-mono); font-size:11px; color:var(--text-3); letter-spacing:.03em; }
.auth-steps { display:flex; flex-direction:column; gap:14px; margin-top:18px; }
.auth-step { border:1px solid var(--border); border-radius:var(--r); background:var(--surface-2); padding:16px; }
.auth-step__h { display:flex; align-items:center; gap:9px; font-size:13px; font-weight:600; margin-bottom:12px; }
.auth-step__n { width:22px; height:22px; border-radius:6px; display:inline-flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:12px; font-weight:700; color:var(--value); background:var(--value-bg); border:1px solid var(--value-border); flex-shrink:0; }
.auth-qr { display:block; margin:0 auto 10px; width:190px; height:190px; border-radius:var(--r-sm); background:#fff; padding:8px; }
.auth-secret { text-align:center; font-family:var(--font-mono); font-size:12px; color:var(--text-3); word-break:break-all; }
.auth-recovery { display:grid; grid-template-columns:1fr 1fr; gap:6px 14px; margin:2px 0 10px; }
.auth-recovery code { font-family:var(--font-mono); font-size:13px; color:var(--value); background:transparent; padding:0; }
.auth-warn { font-size:11.5px; color:var(--warn); line-height:1.4; }

/* brand mark alias (used by auth screens) */
.oh-brand__mark{width:22px;height:22px;border-radius:6px;border:1.5px solid var(--value);display:inline-flex;align-items:center;justify-content:center;}
.oh-brand__mark i{width:7px;height:7px;border-radius:50%;background:var(--value);box-shadow:0 0 8px var(--value);display:block;}
.oh-brand__name{font-weight:700;font-size:16px;color:var(--text);}

/* nav items only for owner/admin (Status, Admin) */
html[data-role="user"] .role-priv{display:none!important;}

/* prepaid gate: a user with no paid days only gets the Billing tab */
html[data-access="none"] .oh-nav__item:not([href="/app/billing"]){display:none!important;}
html[data-access="none"] .oh-topbar__right [data-tax],
html[data-access="none"] .oh-topbar__right a[href="/app/settings"]{display:none!important;}
