[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 0.8125rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }

.auth { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 24px; padding: 48px 24px; }
.auth-brand { font-size: 1.125rem; }
.auth-card { width: min(420px, calc(100vw - 48px)); display: grid; gap: 4px; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-card > .muted:first-of-type { margin-bottom: 16px; }
.auth-card .btn-block { margin-top: 4px; }
.auth-card .center { margin-top: 12px; }
.demo { max-width: 420px; text-align: center; }

.form-field { display: grid; gap: 6px; margin-bottom: 12px; }
.form-field label, legend { font-size: 0.875rem; font-weight: 500; }
.form-field input, .form-field select, .form-field textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  min-height: 44px; padding: 10px 12px; width: 100%;
}
.form-field input[readonly] { color: var(--text-2); background: var(--surface-2); }
.form-field textarea { resize: vertical; }
.form-field [aria-invalid="true"] { border-color: #EF4444; }
.field-err { color: #F87171; font-size: 0.8125rem; min-height: 1.2em; }
html[data-theme="light"] .field-err { color: #B91C1C; }

.nav { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
.balance-pill { font-size: 0.8125rem; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); white-space: nowrap; }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 65px); }
.side { display: flex; flex-direction: column; gap: 2px; padding: 20px 12px 40px; border-right: 1px solid var(--border); position: sticky; top: 65px; align-self: start; max-height: calc(100vh - 65px); overflow-y: auto; }
.side-label { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); padding: 16px 12px 6px; }
.side-label:first-child { padding-top: 0; }
.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 0.9375rem; }
.side a:hover { background: var(--surface-2); color: var(--text); }
.side a[aria-current="page"] { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side-meta { font-size: 0.75rem; }
.scrim { position: fixed; inset: 65px 0 0; background: rgb(0 0 0 / 0.5); z-index: 80; }
.main { padding: 32px 40px 80px; max-width: 1080px; width: 100%; outline: none; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 1.75rem; }
.page-head .muted { margin-top: 6px; }
.sub { font-size: 1.125rem; margin: 32px 0 16px; }
form .sub { margin-top: 0; }
.notice { border: 1px solid color-mix(in srgb, #D97706 50%, transparent); background: color-mix(in srgb, #D97706 10%, transparent); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px; font-size: 0.9375rem; }
.empty { display: grid; gap: 16px; justify-items: start; }
.form-card { max-width: 560px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { padding: 20px; }
.kpi span { display: block; color: var(--text-2); font-size: 0.8125rem; }
.kpi strong { font-family: var(--font-mono); font-size: 1.375rem; font-weight: 600; }

.srv-list { display: grid; gap: 12px; }
.srv { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.srv h3 { font-size: 1rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.srv-meta { color: var(--text-2); font-size: 0.8125rem; font-family: var(--font-mono); margin-top: 4px; }
.srv-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.status { font-family: var(--font-mono); font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.status.ok { color: var(--green); }
.status.warn { color: #B45309; }
html[data-theme="dark"] .status.warn { color: #FBBF24; }
.status.off { color: var(--text-2); }

.plan-pick { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.plan-pick legend { margin-bottom: 8px; }
.plan-opt { position: relative; cursor: pointer; }
.plan-opt input { position: absolute; opacity: 0; }
.plan-opt > span { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-height: 44px; }
.plan-opt b { font-weight: 600; }
.plan-opt small { color: var(--text-2); font-size: 0.75rem; }
.plan-opt .mono { font-size: 0.8125rem; color: var(--accent-text); }
.plan-opt input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface-2); }
.plan-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.order-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0; margin-bottom: 8px; border-top: 1px solid var(--border); }
.order-total strong { font-size: 1.375rem; }

.balance-card { display: grid; gap: 4px; max-width: 560px; margin-bottom: 16px; }
.balance-card strong { font-size: 2rem; font-weight: 600; }
.chips-row { margin: -4px 0 16px; }
.chip-btn { min-height: 40px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; font-family: var(--font-mono); font-size: 0.8125rem; cursor: pointer; }
.chip-btn:hover { background: var(--surface-2); }

.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { color: var(--text-2); font-weight: 500; }
td.mono { font-family: var(--font-mono); font-size: 0.8125rem; }
td.actions { display: flex; gap: 8px; justify-content: flex-end; }
td .btn { min-height: 36px; padding: 0 12px; font-size: 0.8125rem; }
.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.status-list { padding: 8px 24px; max-width: 560px; }
.status-row { display: flex; justify-content: space-between; align-items: center; min-height: 52px; border-bottom: 1px solid var(--border); }
.status-row:last-child { border-bottom: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 18px; font-size: 0.9375rem; transition: opacity 0.2s ease, transform 0.2s ease; z-index: 300; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .menu-btn { display: inline-grid; }
  .side { position: fixed; top: 65px; left: 0; bottom: 0; width: 260px; max-height: none; z-index: 90; background: var(--bg); transform: translateX(-100%); transition: transform 0.2s ease; }
  .menu-open .side { transform: none; }
  .main { padding: 24px 20px 64px; }
  .nav-inner { padding: 0 16px; }
}
@media (max-width: 560px) {
  .plan-pick { grid-template-columns: 1fr; }
  .srv { grid-template-columns: 1fr; }
  .srv-actions { justify-content: flex-start; }
  .nav-actions .btn, .balance-pill { display: none; }
  .kpi strong { font-size: 1.125rem; }
}
