:root{
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f4f4f4;
  --border: #dddddd;
  --text: #111111;
  --text-dim: #555555;
  --text-faint: #999999;
  --accent: #1f9d55;
  --accent-soft: #e6f4ea;
  --online: #1f9d55;
  --warn: #555555;
  --offline: #bbbbbb;
  --danger: #111111;
  --radius: 3px;
  --font: 'Inter', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}
html[data-theme="dark"]{
  --bg: #101012;
  --panel: #17171a;
  --panel-2: #1c1c1f;
  --border: #2a2a2e;
  --text: #eaeaec;
  --text-dim: #9a9aa1;
  --text-faint: #5e5e64;
  --accent: #34c77b;
  --accent-soft: #16301f;
  --online: #34c77b;
  --warn: #9a9aa1;
  --offline: #4a4a50;
  --danger: #eaeaec;
}
*{ margin:0; padding:0; box-sizing:border-box; }
html{ color-scheme: light; transition: background .15s ease; }
html[data-theme="dark"]{ color-scheme: dark; }
body{ background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; transition: background .15s ease, color .15s ease; }
a{ color:inherit; text-decoration:none; }
button{ font-family: inherit; cursor:pointer; }
::selection{ background: var(--accent); color: #fff; }
:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 8px; }

/* ===== login ===== */
.hidden{ display:none !important; }
.login-screen{
  display:flex; align-items:center; justify-content:center;
  min-height:100vh; padding:20px;
  background: var(--bg);
}
.login-card{
  background: var(--panel); border:1px solid var(--border); border-radius:8px;
  padding:40px; max-width:420px; width:100%; text-align:center;
}
.login-card h2{ margin-bottom:8px; font-size:22px; font-weight:700; }
.login-card p{ color:var(--text-dim); font-size:13px; margin-bottom:28px; line-height:1.5; }
.login-btn{ width:100%; justify-content:center; padding:12px 24px; font-size:15px; }
.brand-logo{ font-size:24px; font-weight:700; letter-spacing:-0.5px; margin-bottom:20px; }
.brand-logo span{ color:var(--accent); }

/* ===== layout ===== */
.shell{ display:flex; min-height:100vh; }

.sidebar{
  position: fixed; top:0; left:0; bottom:0; width: 232px;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  z-index: 90;
  display:flex; flex-direction:column;
  transform: translateX(-100%);
  transition: transform .22s ease;
}
.shell.nav-open .sidebar{ transform: translateX(0); }
@media (min-width: 1040px){
  .sidebar{ transform:none; position: sticky; height:100vh; }
  .scrim{ display:none !important; }
}
.scrim{ position:fixed; inset:0; background: rgba(0,0,0,0.5); z-index:80; opacity:0; pointer-events:none; transition: opacity .2s ease; }
.shell.nav-open .scrim{ opacity:1; pointer-events:auto; }

.brand{ display:flex; align-items:center; gap:9px; padding: 20px; border-bottom: 1px solid var(--border); }
.brand-mark{ width:20px; height:20px; border-radius:4px; background: var(--accent); flex-shrink:0; }
.brand-name{ font-weight:700; font-size:15px; letter-spacing: -.2px; }
.brand-name span{ color: var(--text-faint); font-weight: 500; }

.nav{ flex:1; overflow-y:auto; padding: 12px; }
.nav-group{ margin-bottom: 16px; }
.nav-label{ font-size:10.5px; text-transform:uppercase; letter-spacing: .6px; color: var(--text-faint); padding: 0 8px 6px; }
.nav-item{
  display:flex; align-items:center; gap:10px;
  padding: 8px 9px; border-radius: 5px;
  font-size: 13.5px; font-weight:500; color: var(--text-dim);
  margin-bottom: 1px;
  border-left: 2px solid transparent;
}
.nav-item svg{ width:16px; height:16px; opacity:.8; flex-shrink:0; }
.nav-item:hover{ background: var(--panel-2); color: var(--text); }
.nav-item.active{ background: var(--panel-2); color: var(--text); border-left-color: var(--accent); }
.nav-item.active svg{ color: var(--accent); opacity:1; }
.nav-item .count{ margin-left:auto; font-size:11px; color: var(--text-faint); font-family: var(--mono); }

.sidebar-foot{ padding: 14px 20px; border-top:1px solid var(--border); font-size:12px; color: var(--text-faint); display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.dot-static{ width:6px; height:6px; border-radius:50%; background: var(--online); flex-shrink:0; }

/* ===== main ===== */
.main{ flex:1; min-width:0; display:flex; flex-direction:column; }

.topbar{
  position: sticky; top:0; z-index:60;
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar-left{ display:flex; align-items:center; gap:12px; min-width:0; }

.icon-btn{
  width:34px; height:34px; display:flex; align-items:center; justify-content:center;
  background: var(--panel); border:1px solid var(--border); border-radius: var(--radius);
  color: var(--text-dim); flex-shrink:0;
}
.icon-btn:hover{ color: var(--text); border-color: var(--text-faint); }
.icon-btn svg{ width:16px; height:16px; }

.identity{ display:flex; align-items:center; gap:9px; padding: 4px 10px 4px 4px; background: var(--panel); border:1px solid var(--border); border-radius: 20px; }
.avatar{ width:26px; height:26px; border-radius:50%; background: var(--panel-2); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-weight:600; font-size:11px; flex-shrink:0; }
.identity-text{ line-height:1.2; }
.identity-name{ font-size:12.5px; font-weight:600; white-space:nowrap; }
.identity-plan{ font-size:10.5px; color: var(--text-faint); }
@media (max-width: 560px){ .identity-text{ display:none; } }

.credit-pill{ display:flex; align-items:center; gap:7px; padding: 6px 12px; background: var(--panel); border:1px solid var(--border); border-radius: 20px; }
.credit-amt{ font-family: var(--mono); font-weight:600; font-size:13px; }
.credit-label{ font-size:11px; color: var(--text-faint); }
@media (max-width: 620px){ .credit-label{ display:none; } }

.btn{
  display:inline-flex; align-items:center; gap:6px;
  padding: 8px 14px; border-radius: var(--radius);
  font-size:13px; font-weight:600; border:1px solid transparent;
}
.btn svg{ width:14px; height:14px; }
.btn-primary{ background: var(--accent); color:#fff; }
.btn-primary:hover{ filter: brightness(0.92); }
.btn-ghost{ background: var(--panel); border-color: var(--border); color: var(--text); }
.btn-ghost:hover{ border-color: var(--text-dim); }
.btn-danger{ background: var(--panel); border-color: var(--border); color: var(--text-dim); }
.btn-danger:hover{ border-color: var(--text); color: var(--text); }
.btn-sm{ padding: 6px 11px; font-size:12px; }
.btn:disabled{ opacity:.4; cursor:not-allowed; }

.content{ padding: 24px 20px 60px; max-width: 1180px; width:100%; margin:0 auto; }
.view{ display:none; }
.view.active{ display:block; }

.view-head{ margin-bottom: 20px; }
.view-title{ font-size:22px; font-weight:700; letter-spacing:-.3px; }
.view-desc{ color: var(--text-dim); font-size:13px; margin-top:3px; }

/* ===== stat cards ===== */
.stat-row{ display:grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap:12px; margin-bottom:20px; }
.stat-card{ background: var(--panel); border:1px solid var(--border); border-radius: var(--radius); padding:16px; }
.stat-name{ font-size:12px; color: var(--text-dim); margin-bottom:6px; }
.stat-num{ font-size:22px; font-weight:700; letter-spacing:-.3px; }
.stat-sub{ font-size:11.5px; color: var(--text-faint); margin-top:3px; }

/* ===== panel ===== */
.panel{ background: var(--panel); border:1px solid var(--border); border-radius: var(--radius); overflow:hidden; margin-bottom:20px; }
.panel-head{ display:flex; align-items:center; justify-content:space-between; padding:14px 16px; border-bottom:1px solid var(--border); gap:10px; flex-wrap:wrap; }
.panel-head h3{ font-size:14.5px; font-weight:600; }
.panel-head p{ font-size:12px; color: var(--text-faint); margin-top:2px; }
.link-more{ font-size:12.5px; color: var(--accent); font-weight:600; }

.activity-item{ display:flex; align-items:flex-start; gap:10px; padding:11px 16px; border-bottom:1px solid var(--border); font-size:13px; }
.activity-item:last-child{ border-bottom:none; }
.activity-dot{ width:6px; height:6px; border-radius:50%; margin-top:6px; flex-shrink:0; background: var(--text-faint); }
.activity-dot.ok{ background: var(--accent); }
.activity-dot.warn{ background: #999; }
.activity-dot.err{ background: var(--bg); border: 2px solid var(--text); width:8px; height:8px; margin-top:5px; }
.activity-text b{ font-weight:600; }
.activity-time{ margin-left:auto; font-size:11px; color: var(--text-faint); font-family: var(--mono); white-space:nowrap; }

/* usage bars */
.usage-row{ padding: 12px 16px; }
.usage-top{ display:flex; justify-content:space-between; font-size:12px; color: var(--text-dim); margin-bottom:6px; }
.bar-track{ height:6px; background: var(--panel-2); border-radius:3px; overflow:hidden; }
.bar-fill{ height:100%; background: var(--accent); border-radius:3px; }
.bar-fill.dim{ background: var(--text-faint); }

/* ===== resource cards ===== */
.res-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap:12px; }
.res-card{ background: var(--panel); border:1px solid var(--border); border-radius: var(--radius); padding:16px; display:flex; flex-direction:column; gap:11px; }
.res-top{ display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
.res-name{ font-weight:600; font-size:14.5px; }
.res-sub{ font-size:11.5px; color: var(--text-faint); font-family: var(--mono); margin-top:2px; }

.status-tag{ display:flex; align-items:center; gap:6px; font-size:11px; color: var(--text-dim); flex-shrink:0; }
.status-tag .d{ width:6px; height:6px; border-radius:50%; background: var(--offline); }
.status-tag.online .d{ background: var(--accent); }
.status-tag.offline .d{ background: var(--offline); }
.status-tag.pending .d{ background: var(--bg); border: 1.5px solid var(--text); }

.res-specs{ display:flex; gap:14px; flex-wrap:wrap; font-size:12px; color: var(--text-dim); }
.res-specs b{ color: var(--text); font-weight:600; }

.meter-top{ display:flex; justify-content:space-between; font-size:11px; color: var(--text-faint); margin-bottom:5px; }

.res-actions{ display:flex; gap:7px; flex-wrap:wrap; }

.tag{ display:inline-flex; font-size:11px; color: var(--text-faint); font-family: var(--mono); }

/* ===== table ===== */
.table-wrap{ overflow-x:auto; }
table{ width:100%; border-collapse:collapse; font-size:13px; min-width:520px; }
th{ text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.4px; color: var(--text-faint); padding:9px 16px; border-bottom:1px solid var(--border); background: var(--panel-2); font-weight:600; }
td{ padding:11px 16px; border-bottom:1px solid var(--border); color: var(--text-dim); }
tr:last-child td{ border-bottom:none; }
td.amt-in{ color: var(--text); font-family: var(--mono); }
td.amt-out{ color: var(--text-dim); font-family: var(--mono); }
.pill{ font-size:11px; padding:3px 8px; border-radius:20px; }
.pill.paid{ background: var(--accent-soft); color: var(--accent); }
.pill.pending{ background: #fff; border: 1px dashed var(--text-faint); color: var(--text-dim); }

/* billing */
.bill-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; margin-bottom:20px; }
@media (max-width: 760px){ .bill-grid{ grid-template-columns:1fr; } }
.balance-card{ background: var(--panel); border:1px solid var(--border); border-radius: var(--radius); padding:20px; display:flex; flex-direction:column; gap:12px; }
.balance-num{ font-size:32px; font-weight:700; }
.balance-sub{ font-size:12.5px; color: var(--text-dim); }

/* settings */
.settings-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap:14px; }
.field{ margin-bottom:12px; }
.field label{ display:block; font-size:11.5px; color: var(--text-faint); margin-bottom:5px; }
.field input{ width:100%; padding:9px 10px; background: var(--panel-2); border:1px solid var(--border); border-radius:5px; color: var(--text); font-size:13px; font-family: var(--font); }
.field input:focus{ border-color: var(--accent); }

/* modal */
.modal-back{ position:fixed; inset:0; background: rgba(0,0,0,0.55); display:flex; align-items:center; justify-content:center; z-index:200; opacity:0; pointer-events:none; transition: opacity .18s ease; }
.modal-back.show{ opacity:1; pointer-events:auto; }
.modal{ width:92%; max-width:360px; background: var(--panel); border:1px solid var(--border); border-radius:8px; padding:20px; }
.modal h3{ font-size:16px; margin-bottom:5px; }
.modal p{ font-size:12.5px; color: var(--text-dim); margin-bottom:14px; }
.modal select, .modal input{ width:100%; padding:9px 10px; background: var(--panel-2); border:1px solid var(--border); border-radius:5px; color: var(--text); font-size:13px; margin-bottom:12px; font-family: var(--font); }
.amount-grid{ display:grid; grid-template-columns: repeat(3,1fr); gap:7px; margin-bottom:14px; }
.amount-opt{ padding:10px 4px; text-align:center; background: var(--panel-2); border:1px solid var(--border); border-radius:5px; font-family: var(--mono); font-size:13px; color: var(--text-dim); }
.amount-opt.sel{ border-color: var(--accent); color: var(--accent); }
.modal-actions{ display:flex; gap:9px; justify-content:flex-end; }

/* ===== gauges ===== */
.gauge-row{ display:flex; gap:12px; flex-wrap:wrap; padding:18px 16px; }
.gauge-box{ flex:1; min-width:150px; display:flex; flex-direction:column; align-items:center; gap:10px; }
.gauge-ring{ width:112px; height:112px; position:relative; }
.gauge-arc{ position:absolute; inset:0; border-radius:50%; background: conic-gradient(var(--accent) calc(var(--pct)*3.6deg), var(--panel-2) 0deg); }
.gauge-hole{ position:absolute; inset:13px; background:var(--panel); border-radius:50%; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.gauge-val{ font-size:19px; font-weight:700; }
.gauge-sub{ font-size:10.5px; color: var(--text-faint); }
.gauge-name{ font-size:12px; font-weight:600; text-align:center; }
.gauge-desc{ font-size:11px; color: var(--text-faint); text-align:center; }

/* ===== VPS builder (slider configurator) ===== */
.back-link{ display:inline-flex; align-items:center; gap:6px; font-size:12.5px; color: var(--text-dim); margin-bottom:14px; }
.back-link:hover{ color: var(--text); }
.build-grid{ display:grid; grid-template-columns: 1.5fr 1fr; gap:16px; align-items:start; }
@media (max-width: 860px){ .build-grid{ grid-template-columns: 1fr; } }

.slider-block{ padding:20px 20px 22px; border-bottom:1px solid var(--border); }
.slider-block:last-child{ border-bottom:none; }
.slider-label{ font-size:12px; font-weight:700; letter-spacing:.4px; text-transform:uppercase; color: var(--text-dim); margin-bottom:14px; }
.slider-input{ width:100%; -webkit-appearance:none; appearance:none; height:4px; background: var(--panel-2); border-radius:2px; outline:none; }
.slider-input::-webkit-slider-thumb{ -webkit-appearance:none; width:16px; height:16px; border-radius:50%; background:var(--accent); cursor:pointer; border:3px solid var(--bg); box-shadow:0 0 0 1px var(--accent); }
.slider-input::-moz-range-thumb{ width:16px; height:16px; border-radius:50%; background:var(--accent); cursor:pointer; border:3px solid var(--bg); box-shadow:0 0 0 1px var(--accent); }
.slider-track-fill{ height:4px; background: var(--text); border-radius:2px; margin-top:-4px; pointer-events:none; }
.tick-row{ display:flex; justify-content:space-between; margin-top:10px; }
.tick{ font-size:10.5px; color: var(--text-faint); font-family: var(--mono); }
.tick.on{ color:var(--accent); font-weight:700; }

.spec-panel{ position:sticky; top:70px; }
.spec-list{ list-style:none; padding: 14px 16px; }
.spec-list li{ font-size:13px; padding: 6px 0; display:flex; align-items:center; gap:8px; }
.spec-list li::before{ content:'—'; color: var(--text-faint); }
.spec-select-row{ padding: 10px 16px; border-top:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:10px; }
.spec-select-row label{ font-size:12.5px; color: var(--text-dim); }
.spec-select-row select{ font-family: var(--font); font-size:12.5px; padding:6px 8px; background:#fff; border:1px solid var(--border); border-radius:4px; color:#111; }
.price-row{ padding:16px; border-top:1px solid var(--border); }
.price-num{ font-size:24px; font-weight:700; }
.price-sub{ font-size:11.5px; color: var(--text-faint); margin-bottom:14px; }

.toast-stack{ position:fixed; bottom:18px; right:18px; z-index:300; display:flex; flex-direction:column; gap:8px; }
.toast{ background: var(--panel); border:1px solid var(--border); border-left:3px solid var(--accent); padding:11px 14px; border-radius:5px; font-size:12.5px; min-width:210px; box-shadow: 0 6px 18px rgba(0,0,0,0.15); }
.toast b{ display:block; margin-bottom:2px; }