/* Shared theme for login.html / client.html / admin.html */
:root {
    --bg: #050505; --surface: #111111; --surface-2: #1a1a1a; --surface-3: #222222;
    --border: rgba(255,255,255,.08); --border-glow: rgba(255,255,255,.2);
    --white: #ffffff; --white-dim: rgba(255,255,255,.6); --white-muted: rgba(255,255,255,.3); --white-faint: rgba(255,255,255,.05);
    --lime: #4ade80; --amber: #fbbf24; --red: #f87171; --blue: #60a5fa; --violet: #a78bfa;
    --text: #f0f0f0; --text-dim: rgba(240,240,240,.5); --text-muted: rgba(240,240,240,.25);
    --r-sm: 12px; --r-md: 18px; --r-lg: 22px; --r-xl: 28px; --nav-h: 72px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
body { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
a { color: var(--white); }
.mono { font-family: 'JetBrains Mono', monospace; }
.mut { color: var(--text-muted); }
.hidden { display: none !important; }

/* layout */
.shell { max-width: 1100px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); margin-bottom: 16px; position: relative; }
.brand-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--white); display: flex; align-items: center; justify-content: center; font-size: 20px; color: #000; flex-shrink: 0; }
.brand-name-main { font-size: 18px; font-weight: 900; letter-spacing: -.2px; color: var(--white); }
.brand-sub { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.page-title { text-align: center; font-size: 22px; font-weight: 900; letter-spacing: 2px; margin: 8px 0 22px; text-transform: uppercase;
    background: linear-gradient(90deg, #fff, #888, #fff); background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: gloryShine 3s linear infinite; }
@keyframes gloryShine { to { background-position: 200% center; } }
h2.sec { font-size: 15px; font-weight: 800; color: var(--white); margin: 6px 0 12px; display: flex; align-items: center; gap: 8px; }
p.sub { color: var(--text-dim); font-size: 13px; margin: -6px 0 16px; line-height: 1.5; }

/* tabs (desktop) + bottom nav (mobile) */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); font-size: 12px; font-weight: 700; cursor: pointer; transition: .2s; display: inline-flex; align-items: center; gap: 8px; }
.tab:hover { border-color: var(--border-glow); color: var(--white); }
.tab.active { background: var(--white); color: #000; border-color: transparent; }
.page { display: none; animation: slideDown .3s ease; }
.page.active { display: block; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.mobile-nav { display: none; }

/* buttons */
.btn { padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 700 12px Inter, sans-serif; cursor: pointer; transition: .2s; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-3); border-color: var(--border-glow); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { border-color: transparent; color: #000; background: var(--white); }
.btn-primary:hover { background: #e8e8e8; }
.btn-success { border-color: rgba(74,222,128,.25); color: var(--lime); background: rgba(74,222,128,.08); }
.btn-danger { border-color: rgba(248,113,113,.25); color: var(--red); background: rgba(248,113,113,.08); }
.btn-warn { border-color: rgba(251,191,36,.25); color: var(--amber); background: rgba(251,191,36,.08); }
.btn-sm { padding: 7px 10px; font-size: 11px; border-radius: 10px; }
.btn-block { width: 100%; padding: 15px; font-size: 13px; }

/* cards / stats */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 20px; margin-bottom: 16px; }
.card h3 { font-size: 15px; font-weight: 800; color: var(--white); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { padding: 18px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); transition: .2s; }
.stat-card:hover { border-color: var(--border-glow); }
.stat-label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; }
.stat-value { font-size: 24px; font-weight: 900; color: var(--white); line-height: 1; margin-bottom: 6px; letter-spacing: -.5px; }
.stat-foot { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.slots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 20px; }
.slot-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 20px; transition: .3s; }
.slot-card:hover { border-color: var(--border-glow); transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.slot-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.slot-title { font-size: 16px; font-weight: 800; color: var(--white); }
.slot-meta { font-size: 11px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; line-height: 1.8; }
.slot-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.metric-box { padding: 11px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); }
.metric-box span { display: block; color: var(--text-muted); font-size: 8px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.metric-box strong { display: block; font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700; color: var(--text); }
.metric-box.gain strong { color: var(--lime); }
.slot-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.slot-actions .btn { flex: 1; min-width: 70px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }
.empty-state i { font-size: 26px; margin-bottom: 10px; display: block; }

/* forms */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > div { flex: 1; min-width: 160px; }
.field-block { margin-bottom: 16px; }
.field-block label, label.lbl { display: block; margin-bottom: 7px; color: var(--text-muted); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.field-input, .field-select { width: 100%; padding: 13px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); color: var(--white); font-family: 'JetBrains Mono', monospace; font-size: 13px; outline: none; transition: .2s; }
.field-input:focus, .field-select:focus { border-color: var(--border-glow); background: var(--surface-3); }
.field-input[readonly] { color: var(--text-dim); }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 13px; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: #fff; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }
.hint b { color: var(--text-dim); }

/* tags + tables */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; border: 1px solid var(--border); color: var(--text-dim); background: var(--white-faint); }
.tag.ok { color: var(--lime); background: rgba(74,222,128,.1); border-color: rgba(74,222,128,.25); }
.tag.warn { color: var(--amber); background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.25); }
.tag.err { color: var(--red); background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); }
.tag.vio { color: var(--violet); background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.22); }
.tag.blue { color: var(--blue); background: rgba(96,165,250,.1); border-color: rgba(96,165,250,.25); }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; padding: 10px 12px; color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.mono, code { font-family: 'JetBrains Mono', monospace; font-size: 11px; }
td .btn + .btn { margin-left: 4px; }
.nowrap { white-space: nowrap; }

/* plan picker */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.plan { padding: 18px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); }
.plan b { display: block; font-size: 14px; color: var(--white); margin-bottom: 4px; }
.plan .pr { font-size: 22px; font-weight: 900; color: var(--white); margin: 6px 0; }
.pay-box { padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--border-glow); margin-bottom: 14px; font-size: 13px; line-height: 1.9; }
.pay-box code { color: var(--white); user-select: all; }

/* bell, toast, flash, modal */
.bell { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .2s; }
.bell:hover { border-color: var(--border-glow); color: var(--white); }
.bell .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.drop { display: none; position: absolute; top: calc(100% + 8px); right: 0; width: min(340px, 92vw); max-height: 60vh; overflow-y: auto; z-index: 3000; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border-glow); box-shadow: 0 20px 50px rgba(0,0,0,.7); }
.drop.open { display: block; }
.drop .it { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 12px; line-height: 1.5; }
.drop .it:last-child { border-bottom: 0; }
.drop .it b { color: var(--white); display: block; }
.drop .it small { color: var(--text-muted); font-size: 10px; }
.flash { padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; font-weight: 600; margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.flash.ok { color: var(--lime); border-color: rgba(74,222,128,.25); background: rgba(74,222,128,.08); }
.flash.err { color: var(--red); border-color: rgba(248,113,113,.25); background: rgba(248,113,113,.08); }
#toast-wrap { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 9000; display: flex; flex-direction: column; gap: 8px; width: min(420px, 92vw); pointer-events: none; }
.toast { padding: 13px 16px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--border-glow); color: var(--white); font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: slideDown .25s ease; }
.toast.ok { border-color: rgba(74,222,128,.4); color: var(--lime); }
.toast.err { border-color: rgba(248,113,113,.4); color: var(--red); }
.toast small { display: block; color: var(--text-dim); font-weight: 500; margin-top: 3px; }
.modal-bg { position: fixed; inset: 0; z-index: 5000; display: none; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.8); backdrop-filter: blur(12px); }
.modal-bg.active { display: flex; }
.modal-card { width: 100%; max-width: 520px; padding: 28px 24px calc(28px + env(safe-area-inset-bottom, 0px)); border-radius: 28px 28px 0 0; background: var(--surface); border: 1px solid var(--border); border-bottom: none; animation: slideUp .3s cubic-bezier(.2,.9,.2,1); max-height: 92vh; overflow-y: auto; }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h3 { font-size: 17px; font-weight: 900; color: var(--white); display: flex; align-items: center; gap: 8px; margin: 0; }
.modal-close { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-body { font-size: 13px; line-height: 1.7; color: var(--text-dim); }
.modal-body ul { padding-left: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 120px; }
.overlay-full { position: fixed; inset: 0; z-index: 8000; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; }

/* login */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); overflow-y: auto; }
.login-card { width: 100%; max-width: 400px; padding: 40px 32px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border); text-align: center; }
.login-logo { width: 64px; height: 64px; border-radius: 20px; background: var(--white); display: flex; align-items: center; justify-content: center; font-size: 28px; color: #000; margin: 0 auto 20px; }
.login-title { font-size: 26px; font-weight: 900; color: var(--white); margin-bottom: 4px; }
.login-sub { font-size: 12px; font-weight: 600; letter-spacing: .5px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 24px; }
.seg { display: flex; padding: 4px; gap: 4px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 20px; }
.seg button { flex: 1; padding: 10px; border: 0; border-radius: 14px; background: none; color: var(--text-dim); font: 700 12px Inter, sans-serif; cursor: pointer; transition: .2s; }
.seg button.active { background: var(--white); color: #000; }
.login-card .field-block { text-align: left; }
.login-err { min-height: 18px; margin: 8px 0 12px; color: var(--red); font-size: 12px; font-weight: 700; }

@media (max-width: 800px) {
    .shell { padding: 12px 12px calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px)); }
    .tabs { display: none; }
    .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .grid-2, .plans { grid-template-columns: 1fr; }
    .slots-grid { grid-template-columns: 1fr; }
    .hide-sm { display: none; }
    .mobile-nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); z-index: 4000; display: flex; align-items: flex-start; justify-content: space-around; padding: 8px 8px 0; background: rgba(18,18,18,.96); border-top: 1px solid var(--border); backdrop-filter: blur(20px); }
    .nav-btn { flex: 1; border: 0; background: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 4px; font: 700 9px Inter, sans-serif; letter-spacing: .3px; padding: 8px 2px; border-radius: var(--r-sm); cursor: pointer; transition: .2s; }
    .nav-btn i { font-size: 19px; }
    .nav-btn.active { color: var(--white); }
}

/* logo image (falls back to the icon when /logo.png is missing) */
.brand-mark img, .login-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; display: block; }
.brand-mark:has(img), .login-logo:has(img) { background: transparent; padding: 0; }
.brand-mark img + i, .login-logo img + i { display: none; }

/* payment ids highlight */
.pay-id { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; margin: 8px 0; border-radius: var(--r-md); background: rgba(250, 204, 21, .10); border: 1px solid rgba(250, 204, 21, .55); }
.pay-id .pay-lbl { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.pay-id code { font-size: 18px; font-weight: 900; color: #facc15; letter-spacing: .5px; user-select: all; word-break: break-all; }
.pay-qr { text-align: center; margin: 12px 0; }
.pay-qr img, .pay-qr canvas { width: 200px; height: 200px; max-width: 100%; background: #fff; padding: 8px; border-radius: 14px; object-fit: contain; }
.pay-warn { padding: 10px 12px; border-radius: var(--r-md); background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .4); font-size: 13px; margin-bottom: 12px; }

/* PP text mark */
.pp { font-family: Inter, system-ui, sans-serif; font-weight: 900; font-style: italic; letter-spacing: -2px; color: #000; line-height: 1; }
.brand-mark .pp { font-size: 22px; padding-right: 2px; }
.login-logo .pp { font-size: 32px; padding-right: 3px; }

/* latency pill + online dot */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font: 700 11px 'JetBrains Mono', monospace; color: var(--text-dim); white-space: nowrap; }
.pill .ld { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); box-shadow: 0 0 0 0 transparent; }
.pill.good .ld { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.pill.mid .ld { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.pill.bad .ld { background: var(--red); box-shadow: 0 0 8px var(--red); }
.odot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--text-muted); }
.odot.on { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.toast.warn { border-color: rgba(251,191,36,.4); color: var(--amber); }

/* ---------- desktop: compact layout (phone-size UI looked oversized on PC) ---------- */
@media (min-width: 1000px) {
    :root { --r-sm: 9px; --r-md: 13px; --r-lg: 16px; --r-xl: 18px; }
    html { font-size: 15px; }
    .shell { max-width: 1280px; padding: 14px 28px 40px; }
    .topbar { padding: 10px 16px; margin-bottom: 12px; }
    .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
    .brand-name-main { font-size: 16px; }
    .tabs { margin-bottom: 14px; }
    .tab { padding: 8px 14px; font-size: 12px; }
    .page-title { text-align: left; font-size: 17px; letter-spacing: 1.5px; margin: 4px 0 14px; }
    .stats { gap: 12px; margin-bottom: 14px; }
    .stat-card { padding: 14px 16px; }
    .stat-value { font-size: 22px; margin-bottom: 4px; }
    .card { padding: 18px 20px; margin-bottom: 14px; }
    .slots-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
    .slot-card { padding: 16px; }
    .field-input, .field-select { padding: 11px 14px; }
    .btn { padding: 10px 14px; }
    .grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
    .plans { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (min-width: 1500px) {
    .shell { max-width: 1440px; }
    .slots-grid { grid-template-columns: repeat(4, 1fr); }
}
