.small { font-size: 12.5px; }
.stack > * + * { margin-top: 16px; }

/* ============ shell ============ */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 22px 14px; background: var(--bg-2); }
.sidebar > .logo { padding: 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; border-radius: 12px; color: var(--text-2); font-weight: 500; transition: background .12s, color .12s; }
.side-nav a svg { width: 18px; height: 18px; flex: none; }
.side-nav a:hover { background: var(--surface-3); color: var(--text); }
.side-nav a.active { background: var(--ink); color: var(--paper); }
.side-sep { height: 1px; background: var(--border-strong); margin: 10px 12px; }
.side-foot { margin-top: auto; padding: 0 12px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.side-foot b { color: var(--text-2); font-weight: 600; }
.side-tg { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 -12px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--border); transition: border-color .15s; }
.side-tg:hover { border-color: var(--ink); }
.side-tg svg { width: 18px; height: 18px; color: var(--text); flex: none; }
.side-tg > span { display: flex; flex-direction: column; font-size: 12px; }
.side-tg b { color: var(--text); font-size: 13px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: flex-end; gap: 10px; height: 64px; padding: 0 32px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(12px); }
.topbar .mobile-logo { display: none; margin-right: auto; }
.balance-pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--bg-2); font-size: 13px; white-space: nowrap; transition: background .15s; }
.balance-pill:hover { background: var(--surface-3); }
.balance-pill b { font-variant-numeric: tabular-nums; }
.balance-pill.negative { background: var(--ink); color: var(--paper); }
.balance-pill.negative .muted { color: #a3a3a3; }
.top-user { display: flex; align-items: center; gap: 6px; padding-left: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--ink); color: var(--paper); }
.top-email { color: var(--text-2); font-size: 13px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 4px; }
.view { padding: 12px 32px 40px; max-width: 1280px; width: 100%; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 0; background: transparent; order: 2; gap: 0; }
  .sidebar > .logo, .side-foot { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding: 8px 16px 12px; scrollbar-width: none; }
  .side-nav a { flex: none; height: 36px; font-size: 13px; background: var(--bg-2); }
  .side-sep { display: none; }
  .main { display: contents; }
  .topbar { order: 1; padding: 0 16px; }
  .topbar .mobile-logo { display: inline-flex; }
  .view { order: 3; padding: 8px 16px 32px; }
  .top-email { display: none; }
}
@media (max-width: 480px) { .topbar .btn-new span { display: none; } .balance-pill .muted { display: none; } }

/* ============ page header ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 12px 0 28px; }
.page-head h1 { font: 500 28px/1.15 var(--display); letter-spacing: -.04em; }
.page-head p { margin: 6px 0 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin: 12px 0 16px; }
.back:hover { color: var(--text); }
.back svg { width: 16px; height: 16px; }

/* ============ auth ============ */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(60% 60% at 50% 40%, #fff, #f1f1f1); }
.auth-card { width: 100%; max-width: 400px; padding: 36px; border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 18px; }
.auth-card h1 { font: 500 24px/1.15 var(--display); letter-spacing: -.04em; margin-top: 32px; }
.auth-card > p { margin: 6px 0 26px; }
.auth-card form .btn { margin-top: 24px; }
.auth-foot { text-align: center; margin: 22px 0 0; font-size: 13px; }
.auth-foot a, .link { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.form-error { margin-top: 14px; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--ink); font-size: 13px; font-weight: 500; }

/* ============ notices / empty ============ */
.notice { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px; font-size: 13.5px; margin-bottom: 16px; background: var(--bg-2); color: var(--text); }
.notice svg { width: 18px; height: 18px; flex: none; }
.notice-danger { background: var(--ink); color: var(--paper); }
.notice-warn { border: 1px dashed var(--ink); background: var(--paper); }
.notice a { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.empty { text-align: center; padding: 72px 24px; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 16px; display: grid; place-items: center; background: var(--ink); color: var(--paper); }
.empty-icon svg { width: 26px; height: 26px; }
.empty h3 { font: 500 19px/1.2 var(--display); letter-spacing: -.03em; }
.empty p { color: var(--muted); margin: 8px auto 24px; max-width: 380px; }

/* ============ server list ============ */
.srv-name { display: flex; align-items: center; gap: 12px; }
.srv-name b { display: block; font-weight: 600; }
.srv-name .muted { font-size: 12.5px; }
.os-badge { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 15px; background: var(--bg-2); color: var(--ink); border: 1px solid var(--border); }
.os-badge.lg { width: 52px; height: 52px; border-radius: 15px; font-size: 22px; background: var(--ink); color: var(--paper); border: 0; }
.sub { display: block; color: var(--muted); font-size: 12.5px; }

/* ============ create server ============ */
.create-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .create-grid { grid-template-columns: minmax(0, 1fr); } }
.step + .step { margin-top: 16px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step-head h3 { font-size: 17px; font-weight: 700; }
.step-head .seg { margin-left: auto; }
.step-num { font: 500 13px var(--mono); color: var(--muted); }
.opt-grid { display: grid; gap: 10px; }
.opt-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .opt-grid-3, .opt-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 15px; text-align: left; border-radius: 14px; background: var(--bg-2); border: 1.5px solid transparent; cursor: pointer; transition: border-color .12s, background .12s; min-width: 0; }
.opt:hover { background: var(--surface-3); }
.opt.active { border-color: var(--ink); background: var(--paper); }
.opt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt .muted { font-size: 12.5px; }
.opt svg { width: 16px; height: 16px; }
.opt-flag { font-size: 24px; line-height: 1; }
.opt > span:last-child { min-width: 0; }
.opt.active .os-badge { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.plan-list { display: flex; flex-direction: column; gap: 8px; }
.plan-opt { display: grid; grid-template-columns: 110px repeat(4, minmax(0, 1fr)) 130px; align-items: center; gap: 12px; padding: 15px 18px; }
.plan-opt .spec { color: var(--text-2); }
.plan-opt .spec b { color: var(--text); display: inline; }
.plan-opt .price { text-align: right; }
.plan-opt .price b { display: block; }
@media (max-width: 760px) {
  .plan-opt { grid-template-columns: 1fr auto; }
  .plan-opt .spec { display: none; }
  .plan-opt .spec-mobile { display: block !important; grid-column: 1 / -1; }
}
.spec-mobile { display: none; color: var(--text-2); font-size: 13px; }
.key-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.key-opts .opt { padding: 10px 14px; }
.summary { position: sticky; top: 84px; background: var(--bg-2); border: 0; }
.summary h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.sum-list { margin: 0; display: flex; flex-direction: column; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--border-strong); }
.sum-list div { display: flex; justify-content: space-between; gap: 12px; }
.sum-list dt { color: var(--muted); }
.sum-list dd { margin: 0; text-align: right; font-weight: 550; }
.sum-price { display: flex; align-items: baseline; gap: 6px; margin-top: 18px; }
.sum-price b { font: 500 30px/1 var(--display); letter-spacing: -.05em; }
.sum-price span { color: var(--muted); }
.sum-balance { margin: 16px 0; font-size: 13px; color: var(--text-2); }
.summary .notice { background: var(--paper); }
.summary p.small { margin: 12px 0 0; }

/* ============ server detail ============ */
.srv-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.srv-title { display: flex; align-items: center; gap: 16px; min-width: 0; }
.srv-title h1 { font: 500 24px/1.15 var(--display); letter-spacing: -.04em; word-break: break-all; }
.srv-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 6px; color: var(--text-2); font-size: 13px; }
.srv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.srv-cards { margin-bottom: 16px; }
.kv { display: flex; flex-direction: column; gap: 12px; }
.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 22px; }
.kv > div > span:first-child { color: var(--muted); flex: none; }
.kv > div > span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv-tight { gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.ssh-cmd { display: flex !important; align-items: center; gap: 8px; padding: 11px 14px; margin-top: 4px; border-radius: 12px; background: var(--ink); }
.ssh-cmd code { font: 12.5px var(--mono); color: var(--paper); flex: 1; overflow-x: auto; white-space: nowrap; text-align: left !important; }
.ssh-cmd .icon-btn { color: #a3a3a3; }
.ssh-cmd .icon-btn:hover { background: #262626; color: var(--paper); }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }
.chart-card { padding: 18px; border-radius: 16px; background: var(--bg-2); min-width: 0; }
.chart-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.chart-top b { font-size: 20px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.chart { display: block; width: 100%; height: 110px; }
.chart-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 2px; margin-right: 6px; vertical-align: middle; }
.events { display: flex; flex-direction: column; }
.event { display: grid; grid-template-columns: 14px 150px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); }
.event:last-child { border-bottom: 0; }
.event .dot { color: var(--border-strong); transform: translateY(-1px); }
.event.ok .dot { color: var(--ink); }
.event.err .dot { color: var(--ink); border-radius: 1px; transform: rotate(45deg); }
.event.err span:last-child { font-weight: 600; }
.event.warn .dot { color: var(--muted); }
.event time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .event { grid-template-columns: 14px minmax(0, 1fr); } .event time { grid-column: 2; } .event span:last-child { grid-column: 2; } }

/* ============ billing ============ */
.balance-card { background: var(--ink); color: var(--paper); border: 0; }
.balance-card .muted, .balance-card .kv > div > span:first-child { color: #a3a3a3; }
.balance-card .kv-tight { border-color: #2a2a2a; }
.balance-big { font: 500 36px/1.1 var(--display); letter-spacing: -.05em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.card-pad h3 { font-size: 16px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.chip { height: 32px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--bg-2); cursor: pointer; font-weight: 550; font-size: 13px; transition: background .12s, color .12s; }
.chip:hover { background: var(--ink); color: var(--paper); }
.amount-pos { font-weight: 700; }

/* ============ keys / tokens ============ */
.key-row { display: flex; align-items: center; gap: 14px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.key-row:last-child { border-bottom: 0; }
.key-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-2); flex: none; }
.key-icon svg { width: 18px; height: 18px; }
.key-row .grow b { display: block; }
.key-row .mono { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
pre.code { margin: 0; padding: 16px 18px; border-radius: 14px; background: var(--ink); font: 12.5px/1.65 var(--mono); color: #e5e5e5; overflow-x: auto; }
.token-box { display: flex; align-items: center; gap: 8px; padding: 12px 14px; margin-top: 12px; border-radius: 12px; background: var(--bg-2); border: 1.5px solid var(--ink); }
.token-box code { flex: 1; font: 12.5px var(--mono); color: var(--text); overflow-wrap: anywhere; }

/* ============ admin ============ */
.admin-tabs { margin-bottom: 20px; overflow-x: auto; max-width: 100%; }
.stat { padding: 20px 22px; background: var(--bg-2); border: 0; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { display: block; font: 500 24px/1.2 var(--display); letter-spacing: -.04em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .sub { margin-top: 2px; }
.actions-cell { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.price-input { width: 110px; height: 34px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { opacity: .4; cursor: not-allowed; }
