:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #f8f9fc;
  --panel-3: #eef1f7;
  --line: #dfe4ee;
  --line-strong: #cbd2df;
  --muted: #6f788b;
  --text: #151925;
  --text-soft: #3f485a;
  --accent: #6f52f5;
  --accent-2: #5737e7;
  --good: #16865f;
  --warn: #a96a08;
  --bad: #c53f5c;
  --sidebar-bg: rgba(255,255,255,.92);
  --topbar-bg: rgba(244,246,251,.86);
  --hover: rgba(15,23,42,.045);
  --active: rgba(111,82,245,.10);
  --accent-border: rgba(111,82,245,.28);
  --accent-soft: rgba(111,82,245,.08);
  --shadow: 0 18px 50px rgba(25,34,52,.08);
  --body-glow: rgba(111,82,245,.08);
  --input-bg: #ffffff;
  --chip-bg: #eef1f7;
  --table-line: rgba(223,228,238,.85);
  --auth-overlay: rgba(255,255,255,.72);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070910;
  --panel: #0d101a;
  --panel-2: #111523;
  --panel-3: #151a28;
  --line: #20263a;
  --line-strong: #343a50;
  --muted: #8790a8;
  --text: #f6f7fb;
  --text-soft: #c8cede;
  --accent: #7c5cff;
  --accent-2: #5e3fff;
  --good: #4ee1a0;
  --warn: #ffca66;
  --bad: #ff6f8d;
  --sidebar-bg: rgba(7,9,16,.92);
  --topbar-bg: rgba(7,9,16,.72);
  --hover: rgba(255,255,255,.035);
  --active: rgba(124,92,255,.13);
  --accent-border: rgba(124,92,255,.30);
  --accent-soft: rgba(124,92,255,.08);
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  --body-glow: rgba(124,92,255,.13);
  --input-bg: #0a0d16;
  --chip-bg: #1e2333;
  --table-line: rgba(32,38,58,.7);
  --auth-overlay: rgba(7,9,16,.75);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { background: radial-gradient(circle at 70% -20%, var(--body-glow), transparent 35%), var(--bg); transition: background .18s ease, color .18s ease; }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:disabled { opacity: .58; cursor: wait; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--sidebar-bg); backdrop-filter: blur(18px); padding: 20px 14px; overflow: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; }
.brand-mark { width: 33px; height: 33px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(145deg, #9f7cff, #5437ed); box-shadow: 0 8px 28px rgba(124,92,255,.28); font-weight: 900; color: white; }
.brand-mark.large { width: 44px; height: 44px; border-radius: 13px; font-size: 18px; }
.brand-copy strong { display: block; letter-spacing: .08em; font-size: 14px; }
.brand-copy span { color: var(--muted); font-size: 11px; }
.nav-section { margin: 16px 0 6px; padding: 0 10px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); opacity: .72; font-weight: 700; }
.nav { display: grid; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; color: var(--text-soft); border-radius: 10px; font-size: 13px; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.active { background: var(--active); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-border); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .65; }
.main { min-width: 0; }
.topbar { min-height: 70px; border-bottom: 1px solid var(--line); padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--topbar-bg); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.breadcrumbs { color: var(--muted); font-size: 13px; }
.breadcrumbs strong { color: var(--text); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 12px; color: var(--text-soft); }
.status-pill::before { content:""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px color-mix(in srgb, var(--good) 45%, transparent); }
.owner { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line-strong); display:grid; place-items:center; font-weight:700; font-size:12px; }
.owner-button { cursor: pointer; }
.icon-btn { width: 36px; height: 36px; display:grid; place-items:center; border:1px solid var(--line); background:var(--panel); border-radius:10px; cursor:pointer; font-size:17px; }
.icon-btn:hover,.owner-button:hover { border-color: var(--accent-border); background: var(--active); }
.content { padding: 28px; max-width: 1600px; margin: 0 auto; }
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:24px; }
.page-head h1 { margin:0 0 7px; font-size:25px; letter-spacing:-.025em; }
.page-head p { margin:0; color:var(--muted); font-size:13px; max-width:780px; line-height:1.55; }
.btn { border:1px solid var(--line); background:var(--panel-2); border-radius:10px; min-height:38px; padding:0 13px; cursor:pointer; font-size:12px; }
.btn:hover { border-color:var(--line-strong); }
.btn.primary { color:#fff; background:linear-gradient(145deg,#8063ff,#6547ef); border-color:#8f78ff; box-shadow:0 8px 24px rgba(124,92,255,.2); }
.btn.compact { min-height:34px; padding:0 10px; }
.grid { display:grid; gap:14px; }
.grid.metrics { grid-template-columns:repeat(4,minmax(0,1fr)); }
.metric { background:linear-gradient(180deg,var(--panel-2),var(--panel)); border:1px solid var(--line); border-radius:14px; padding:16px; min-height:116px; box-shadow:var(--shadow); }
.metric .label { color:var(--muted); font-size:11px; margin-bottom:13px; }
.metric .value { font-size:24px; font-weight:720; letter-spacing:-.03em; }
.metric .delta { margin-top:9px; font-size:11px; color:var(--good); }
.metric .delta.muted { color:var(--muted); }
.split { display:grid; grid-template-columns:1.15fr .85fr; gap:14px; margin-top:14px; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow); overflow:hidden; }
.card-head { min-height:56px; padding:0 16px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--line); }
.card-head h2 { margin:0; font-size:14px; }
.card-head .meta { color:var(--muted); font-size:11px; }
.card-body { padding:16px; }
.rates { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.rate { border:1px solid var(--line); background:var(--panel-2); border-radius:12px; padding:13px; }
.rate-top { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.rate-name { font-size:12px; color:var(--text-soft); }
.rate-value { font-size:16px; font-weight:700; }
.rate small { display:block; color:var(--muted); margin-top:6px; font-size:10px; }
.channel-list { display:grid; gap:9px; }
.channel-row { display:grid; grid-template-columns:minmax(160px,1.5fr) repeat(3,minmax(90px,1fr)) 80px; gap:10px; align-items:center; min-height:54px; padding:0 12px; background:var(--panel-2); border:1px solid var(--line); border-radius:11px; font-size:12px; }
.channel-name { display:flex; align-items:center; gap:9px; font-weight:650; }
.logo-chip { width:26px; height:26px; display:grid; place-items:center; border-radius:8px; background:var(--chip-bg); border:1px solid var(--line); font-size:10px; }
.good { color:var(--good); }
.warn { color:var(--warn); }
.bad { color:var(--bad); }
.muted { color:var(--muted); }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; font-size:12px; }
th { color:var(--muted); font-size:10px; text-align:left; font-weight:600; padding:10px 12px; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:12px; border-bottom:1px solid var(--table-line); white-space:nowrap; }
tr:last-child td { border-bottom:0; }
.badge { display:inline-flex; align-items:center; gap:6px; min-height:24px; padding:0 8px; border-radius:999px; border:1px solid var(--line); background:var(--panel-3); font-size:10px; }
.badge.good::before,.badge.warn::before,.badge.bad::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.tabs { display:flex; gap:6px; flex-wrap:wrap; margin:0 0 14px; }
.tab { min-height:34px; border:1px solid var(--line); background:var(--panel); color:var(--muted); border-radius:9px; padding:0 11px; cursor:pointer; font-size:11px; }
.tab.active { color:var(--text); background:var(--active); border-color:var(--accent-border); }
.channel-cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.channel-card { padding:18px; border-radius:14px; border:1px solid var(--line); background:linear-gradient(180deg,var(--panel-2),var(--panel)); cursor:pointer; }
.channel-card:hover { border-color:var(--line-strong); transform:translateY(-1px); }
.channel-card .title { display:flex; align-items:center; justify-content:space-between; font-weight:700; }
.channel-card .stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:18px; }
.channel-card .stats div { background:var(--bg); border:1px solid var(--line); border-radius:10px; padding:10px; }
.channel-card .stats span { display:block; color:var(--muted); font-size:9px; margin-bottom:4px; }
.channel-card .stats strong { font-size:14px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.field { display:grid; gap:7px; }
.field label { color:var(--muted); font-size:10px; }
.field input,.field select { width:100%; min-height:39px; background:var(--input-bg); color:var(--text); border:1px solid var(--line); border-radius:9px; padding:0 10px; outline:0; }
.field input:focus,.field select:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.field input[readonly] { opacity:.78; }
.integration-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.integration { border:1px solid var(--line); border-radius:13px; padding:15px; background:var(--panel); }
.integration-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.integration h3 { margin:0; font-size:13px; }
.integration p { color:var(--muted); font-size:10px; line-height:1.5; min-height:30px; }
.kv { display:grid; gap:7px; margin-top:12px; }
.kv div { display:flex; justify-content:space-between; gap:14px; font-size:10px; color:var(--muted); }
.kv span:last-child { color:var(--text-soft); }
.notice { border:1px solid var(--accent-border); background:var(--accent-soft); border-radius:12px; padding:12px 14px; font-size:11px; color:var(--text-soft); line-height:1.55; }
.empty { min-height:260px; display:grid; place-items:center; color:var(--muted); text-align:center; }
.empty strong { display:block; color:var(--text); margin-bottom:7px; }
.settings-stack { display:grid; gap:14px; }
.help-text { color:var(--muted); font-size:11px; margin-top:14px; }
.mobile-menu { display:none; }

.auth-screen { min-height:100vh; display:grid; place-items:center; padding:24px; position:relative; background:radial-gradient(circle at 50% 0%,var(--body-glow),transparent 42%); }
.auth-theme { position:fixed; top:22px; right:22px; }
.auth-card { width:min(430px,100%); background:var(--auth-overlay); border:1px solid var(--line); border-radius:20px; box-shadow:0 28px 90px rgba(0,0,0,.18); backdrop-filter:blur(22px); padding:28px; }
.auth-brand { display:flex; align-items:center; gap:12px; padding-bottom:24px; border-bottom:1px solid var(--line); }
.auth-brand strong { display:block; letter-spacing:.1em; font-size:15px; }
.auth-brand span { display:block; color:var(--muted); font-size:10px; margin-top:4px; }
.auth-copy { margin:27px 0 22px; }
.auth-copy h1 { margin:0 0 8px; font-size:26px; letter-spacing:-.03em; }
.auth-copy p { margin:0; color:var(--muted); font-size:12px; }
.auth-form { display:grid; gap:14px; }
.auth-submit { width:100%; margin-top:4px; }
.auth-error { border:1px solid color-mix(in srgb,var(--bad) 38%,transparent); background:color-mix(in srgb,var(--bad) 9%,transparent); color:var(--bad); border-radius:10px; padding:10px 12px; font-size:11px; margin-bottom:15px; }
.toast-root { position:fixed; right:20px; bottom:20px; z-index:1000; display:grid; gap:8px; pointer-events:none; }
.toast { max-width:360px; background:var(--panel); border:1px solid var(--line); border-left:3px solid var(--good); color:var(--text); border-radius:10px; padding:11px 13px; box-shadow:var(--shadow); font-size:12px; opacity:0; transform:translateY(8px); transition:.18s ease; }
.toast.bad { border-left-color:var(--bad); }
.toast.show { opacity:1; transform:translateY(0); }

@media(max-width:1100px){ .grid.metrics{grid-template-columns:repeat(2,1fr)} .split{grid-template-columns:1fr} .channel-cards,.integration-grid{grid-template-columns:1fr 1fr} }
@media(max-width:780px){ .shell{grid-template-columns:1fr}.sidebar{display:none}.topbar{padding:0 15px}.content{padding:18px 14px}.grid.metrics{grid-template-columns:1fr 1fr}.channel-cards,.integration-grid,.form-grid{grid-template-columns:1fr}.channel-row{grid-template-columns:1.5fr 1fr 1fr}.channel-row > :nth-child(4),.channel-row > :nth-child(5){display:none}.mobile-menu{display:block}.page-head{flex-direction:column}.rates{grid-template-columns:1fr}.top-actions .btn.compact{display:none} }
@media(max-width:470px){ .grid.metrics{grid-template-columns:1fr}.top-actions .status-pill{display:none}.auth-card{padding:22px}.auth-screen{padding:14px} }
