:root {
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #1c2430;
  --line: #273140;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #22c55e;
  --accent-ink: #052e14;
  --accent-2: #38bdf8;
  --danger: #f43f5e;
  --warn: #f59e0b;
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent-2); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: var(--mono); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 18px; padding: 4px 10px 20px; }
.brand .dot { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: var(--accent-ink); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 550; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: rgba(34,197,94,.12); color: var(--accent); }
.side .foot { margin-top: auto; padding: 10px; font-size: 13px; color: var(--muted); }
main { padding: 26px 32px 60px; max-width: 1200px; width: 100%; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.balance-pill { background: var(--panel); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; font-weight: 650; }
.balance-pill b { color: var(--accent); }
.bell { position: relative; cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; width: 40px; height: 40px; display: grid; place-items: center; }
.bell .badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 6px; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .v.pos { color: var(--accent); }
.banner { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid; }
.banner.warn { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.35); color: #fcd34d; }
.banner.info { background: rgba(56,189,248,.08); border-color: rgba(56,189,248,.35); color: #bae6fd; }

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; font-weight: 550; }
input, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); }
textarea { min-height: 120px; font-family: var(--mono); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4657; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: transparent; border-color: rgba(244,63,94,.5); color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); margin: 10px 0; }
.switch input { width: auto; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl input, .tbl select { padding: 6px 8px; }
.scroll { overflow-x: auto; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); }
.tag.green { background: rgba(34,197,94,.14); color: var(--accent); }
.tag.red { background: rgba(244,63,94,.14); color: var(--danger); }
.tag.amber { background: rgba(245,158,11,.14); color: var(--warn); }
.tag.blue { background: rgba(56,189,248,.14); color: var(--accent-2); }
.pos { color: var(--accent); } .neg { color: var(--danger); }

/* dialer */
.dialer { max-width: 380px; }
.dial-display { font-size: 28px; font-family: var(--mono); text-align: center; padding: 14px; background: var(--bg); border-radius: 12px; border: 1px solid var(--line); width: 100%; letter-spacing: .04em; }
.dial-info { text-align: center; min-height: 22px; margin: 10px 0; font-size: 14px; color: var(--muted); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.key { height: 62px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: 22px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.key small { font-size: 9px; color: var(--muted); letter-spacing: .15em; margin-top: 3px; }
.key:active { transform: scale(.97); }
.call-btn { width: 100%; height: 56px; border-radius: 16px; font-size: 17px; }
.call-live { text-align: center; padding: 16px; }
.call-live .timer { font-family: var(--mono); font-size: 34px; margin: 6px 0; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; animation: p 1.2s infinite; }
@keyframes p { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 100% { box-shadow: 0 0 0 14px rgba(34,197,94,0); } }

/* misc */
.addr { font-family: var(--mono); background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 12px; word-break: break-all; }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--panel-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; z-index: 99; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 380px; }
.toast.err { border-color: rgba(244,63,94,.6); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.section { display: none; } .section.show { display: block; }
.empty { text-align: center; padding: 36px; color: var(--muted); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1000px 500px at 20% -10%, rgba(34,197,94,.12), transparent), radial-gradient(800px 500px at 100% 100%, rgba(56,189,248,.10), transparent); }
.auth-card { width: 100%; max-width: 420px; }
.tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 9px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.tabs button.active { background: var(--panel-2); color: var(--text); }
.chart { width: 100%; height: 180px; }
.hamb { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: -260px; width: 240px; transition: left .2s; }
  .side.open { left: 0; }
  .hamb { display: inline-flex; }
  main { padding: 18px 16px 60px; }
}
