/* ==========================================================================
   VPSRENTO — Client Area (dashboard.css)
   Classic hosting control panel: gray app bg, white bordered panels,
   navy sidebar, square cards, spreadsheet tables. Standalone: do NOT load
   style.css here. Tokens mirror the public site exactly.
   ========================================================================== */

:root {
  --bg: #EEF1F5;
  --bg-2: #E9EDF3;
  --surface: #FFFFFF;
  --surface-2: #F7F9FB;
  --border: #C3CAD4;
  --border-strong: #9AA6B5;
  --text: #1B2430;
  --text-2: #4A5568;
  --text-3: #6B7684;
  --accent: #17427A;
  --accent-2: #0F3260;
  --accent-dim: rgba(23, 66, 122, .08);
  --gold: #A16207;
  --gold-dim: rgba(161, 98, 7, .10);
  --red: #B91C1C;
  --red-dim: rgba(185, 28, 28, .08);
  --blue: #0B63CE;
  --blue-dim: rgba(11, 99, 206, .08);
  --navy: #12325F;
  --navy-edge: #0B2242;
  --green: #15803D;
  --green-dim: rgba(21, 128, 61, .08);
  --r-sm: 3px;
  --r: 3px;
  --r-lg: 3px;
  --sidebar-w: 240px;
  --rail-w: 72px;
  --topbar-h: 60px;
  --shadow: 0 1px 0 rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .06);
  --glow: 0 0 0 1px rgba(23, 66, 122, .30);
  --font: Tahoma, Verdana, Arial, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(23, 66, 122, .18); }

/* Slim square scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: normal; }
p { margin: 0 0 12px; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.mono { font-family: var(--mono); font-feature-settings: 'tnum' 1; letter-spacing: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.gold { color: var(--gold); }
.red { color: var(--red); }
.green { color: var(--green); }
.blue { color: var(--blue); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ==========================================================================
   Buttons — flat navy / white with gray border
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  font-family: var(--font);
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent-2);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--navy-edge); color: #FFFFFF; text-decoration: none; }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--text-3); background: var(--surface-2); color: var(--text); text-decoration: none; }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }

.btn-danger {
  background: var(--red-dim);
  border-color: rgba(185, 28, 28, .3);
  color: var(--red);
}
.btn-danger:hover { background: rgba(185, 28, 28, .12); border-color: var(--red); color: var(--red); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 3px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 16px; height: 16px; }

/* ==========================================================================
   App layout
   ========================================================================== */

/* ---- Sidebar — solid navy, white text ---- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--navy);
  border-right: 1px solid var(--navy-edge);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform .25s ease, width .25s ease;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--navy-edge);
  height: var(--topbar-h);
  color: #FFFFFF;
}
.side-brand:hover { color: #FFFFFF; text-decoration: none; }
.side-brand img { width: 26px; height: 26px; flex: none; }
.side-brand .wm {
  font-weight: 700;
  letter-spacing: .14em;
  font-size: 14px;
}
.side-brand .tag {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: #CFE0F5;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: .04em;
}

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .58);
  padding: 14px 10px 6px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: rgba(255, 255, 255, .75);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background .15s ease, color .15s ease;
}
.side-link:hover { background: rgba(255, 255, 255, .08); color: #FFFFFF; text-decoration: none; }
.side-link svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.side-link.active {
  background: rgba(255, 255, 255, .12);
  color: #FFFFFF;
  font-weight: 700;
}
.side-link.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: #D9A441;
}
.side-link .cnt {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .20);
  color: rgba(255, 255, 255, .65);
  border-radius: 3px;
  padding: 1px 6px;
}
.side-link.active .cnt { color: #FFFFFF; border-color: rgba(255, 255, 255, .35); }

.side-bottom {
  border-top: 1px solid var(--navy-edge);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.token-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255, 255, 255, .80);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  overflow: hidden;
  white-space: nowrap;
  cursor: default;
}
.token-chip svg { width: 13px; height: 13px; flex: none; color: #D9A441; }
.token-chip span { overflow: hidden; text-overflow: ellipsis; }
.side-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, .7);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .15s ease;
}
.side-logout:hover { background: rgba(185, 28, 28, .35); color: #FCA5A5; }
.side-logout svg { width: 16px; height: 16px; }

.side-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 36, 48, .45);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
body.nav-open .side-overlay { opacity: 1; pointer-events: auto; }

/* ---- Topbar — solid white panel, no blur ---- */

.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  z-index: 50;
  transition: left .25s ease;
}

.nav-toggle { display: none; }

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.crumb b { color: var(--text); font-weight: 700; }
.crumb .sep { color: var(--border-strong); }

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}
.status-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--green);
  animation: ping 2.2s ease-out infinite;
}
@keyframes ping {
  0% { transform: scale(.5); opacity: .8; }
  80%, 100% { transform: scale(1.4); opacity: 0; }
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #7C4A05;
  background: var(--gold-dim);
  border: 1px solid rgba(161, 98, 7, .35);
  border-radius: 3px;
  padding: 5px 13px;
  white-space: nowrap;
}
.balance-pill b {
  font-family: var(--mono);
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0;
}

/* ---- Content ---- */

.content {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 24px) 28px 72px;
  min-height: 100vh;
  transition: margin-left .25s ease;
}
.content > .wrap { max-width: 1400px; margin: 0 auto; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 21px; letter-spacing: normal; }
.page-head .sub { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* 12-col grid */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; } .col-9 { grid-column: span 9; }
.col-12 { grid-column: span 12; }

@media (max-width: 1200px) {
  .col-3 { grid-column: span 6; }
  .col-4 { grid-column: span 6; }
  .col-5, .col-7 { grid-column: span 12; }
  .col-8, .col-9 { grid-column: span 12; }
}
@media (max-width: 640px) {
  .grid { gap: 12px; }
  .col-2, .col-3, .col-4, .col-6 { grid-column: span 12; }
}

/* ==========================================================================
   Stat cards — square, bordered
   ========================================================================== */

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
  transition: border-color .18s ease;
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card .sc-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 7px;
}
.stat-card .sc-label svg { width: 14px; height: 14px; }
.stat-card .sc-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.15;
}
.stat-card .sc-value small { font-size: 14px; color: var(--text-3); font-weight: 500; }
.stat-card .sc-delta { font-size: 12px; display: flex; align-items: center; gap: 5px; color: var(--text-3); }
.stat-card .sc-delta.up { color: var(--green); }
.stat-card .sc-delta.down { color: var(--red); }
.stat-card .sc-delta svg { width: 12px; height: 12px; }
.stat-card .sc-spark { position: absolute; right: 0; bottom: 0; left: 0; height: 36px; opacity: .8; pointer-events: none; }

/* ==========================================================================
   Panels — white, 1px border
   ========================================================================== */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
}
.panel + .panel, .panel + .grid, .grid + .panel { margin-top: 16px; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 50px;
  background: var(--surface-2);
}
.panel-head h3 { font-size: 14px; font-weight: 700; }
.panel-head .ph-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.panel-head .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.panel-body { padding: 18px; }
.panel-body.tight { padding: 12px 18px; }
.panel-flush .panel-body { padding: 0; }
.panel-foot {
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-3);
  background: var(--surface-2);
}
.panel-foot .right { margin-left: auto; display: flex; gap: 8px; }

/* Key-value rows (manage page etc.) */
.kv { display: grid; grid-template-columns: 150px 1fr; row-gap: 10px; column-gap: 16px; font-size: 13px; }
.kv dt { color: var(--text-3); margin: 0; }
.kv dd { margin: 0; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; row-gap: 2px; } .kv dd { margin-bottom: 8px; } }

/* ==========================================================================
   Tables — full 1px grid, navy header, zebra rows
   ========================================================================== */

.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #FFFFFF;
  padding: 9px 16px;
  border: 1px solid var(--navy-edge);
  white-space: nowrap;
  background: var(--navy);
}
.table td {
  padding: 10px 16px;
  border: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}
.table tbody tr:nth-child(even) { background: var(--surface-2); }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #EDF2F8; }
.table td strong, .table td .cell-main { color: var(--text); font-weight: 700; }
.table td .cell-sub { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.table .num { font-family: var(--mono); text-align: right; white-space: nowrap; }
.table th.num { text-align: right; }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table a.rowlink { color: var(--text); font-weight: 700; }
.table a.rowlink:hover { color: var(--blue); }

/* Clickable rows */
.table tr.clickable { cursor: pointer; }
.table tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Visually hidden, available to assistive tech (labeling inline-edit controls) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Status pills / badges — rectangular with borders
   ========================================================================== */

.st {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.st::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.st-running, .st-paid { color: var(--green); background: var(--green-dim); border-color: rgba(21, 128, 61, .30); }
.st-running::before { animation: blink-dot 2s ease-in-out infinite; }
@keyframes blink-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.st-stopped { color: var(--text-3); background: var(--surface-2); border-color: var(--border-strong); }
.st-unpaid, .st-open { color: var(--gold); background: var(--gold-dim); border-color: rgba(161, 98, 7, .30); }
.st-answered, .st-info { color: var(--blue); background: var(--blue-dim); border-color: rgba(11, 99, 206, .30); }
.st-error, .st-failed { color: var(--red); background: var(--red-dim); border-color: rgba(185, 28, 28, .32); }
.st-working { color: var(--blue); background: var(--blue-dim); border-color: rgba(11, 99, 206, .30); }
.st-working::before { animation: blink-dot 1s ease-in-out infinite; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  white-space: nowrap;
}
.pill.gold { color: var(--gold); background: var(--gold-dim); border-color: rgba(161, 98, 7, .3); }
.pill.accent { color: var(--accent); background: var(--accent-dim); border-color: rgba(23, 66, 122, .3); }
.pill.mono { font-family: var(--mono); font-size: 11px; }

/* ==========================================================================
   Progress bars — solid fills, square
   ========================================================================== */

.progress {
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 0;
  transition: width .3s ease;
}
.progress.gold .progress-bar { background: var(--gold); }
.progress.red .progress-bar { background: var(--red); }
.progress.live .progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .14) 0 8px, transparent 8px 16px);
  animation: stripes 1s linear infinite;
}
@keyframes stripes { to { background-position: 22.6px 0; } }

.progress-wrap { display: flex; flex-direction: column; gap: 8px; }
.progress-wrap .progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
}
.progress-label { font-size: 12.5px; color: var(--text-2); min-height: 18px; }

/* Usage meter rows */
.meter-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.meter-row:last-child { margin-bottom: 0; }
.meter-row .mr-top { display: flex; justify-content: space-between; font-size: 12.5px; }
.meter-row .mr-top b { color: var(--text); font-weight: 700; }
.meter-row .mr-top span { font-family: var(--mono); color: var(--text-3); font-size: 11.5px; }

/* ==========================================================================
   Toasts (bottom-right)
   ========================================================================== */

#toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
  animation: toast-in .2s ease;
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.toast.err::before { background: var(--red); }
.toast.info::before { background: var(--blue); }
.toast.gold::before { background: var(--gold); }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--accent); }
.toast.err svg { color: var(--red); }
.toast.info svg { color: var(--blue); }
.toast.gold svg { color: var(--gold); }
.toast .t-body { flex: 1; line-height: 1.45; }
.toast .t-body b { display: block; font-weight: 700; margin-bottom: 1px; }
.toast .t-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  border-radius: 2px;
  flex: none;
}
.toast .t-close:hover { color: var(--text); }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ==========================================================================
   Modal (confirm dialogs)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 36, 48, .5);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 440px;
  padding: 22px;
  animation: modal-in .18s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } }

.modal-card .m-icon {
  width: 40px;
  height: 40px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border: 1px solid rgba(23, 66, 122, .25);
  color: var(--accent);
  margin-bottom: 14px;
}
.modal-card .m-icon svg { width: 19px; height: 19px; }
.modal-card.danger .m-icon { background: var(--red-dim); border-color: rgba(185, 28, 28, .3); color: var(--red); }
.modal-card h3 { font-size: 16px; margin-bottom: 7px; }
.modal-card .m-body { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.modal-card .m-body .mono { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ==========================================================================
   Tabs (underline)
   ========================================================================== */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
  font-family: var(--font);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .cnt {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 6px;
  color: var(--text-3);
}
.tab.active .cnt { color: var(--accent); background: var(--accent-dim); border-color: rgba(23, 66, 122, .3); }
.tab-panel { padding-top: 18px; }
.tab-panel[hidden] { display: none; }

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  gap: 6px;
}
.empty-state .es-icon {
  width: 52px;
  height: 52px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  margin-bottom: 8px;
}
.empty-state .es-icon svg { width: 22px; height: 22px; }
.empty-state h4 { font-size: 15px; }
.empty-state p { font-size: 13px; color: var(--text-3); max-width: 380px; margin-bottom: 10px; }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field label .opt { color: var(--text-3); font-weight: 500; margin-left: auto; font-size: 11px; }
.field .hint { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.field .err-msg { font-size: 11.5px; color: var(--red); display: none; }
.field.invalid .err-msg { display: block; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: rgba(185, 28, 28, .5); }

.input, .field input, .field select, .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 9px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
  outline: none;
}
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(23, 66, 122, .16);
}
.field input.mono, .input.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
.field textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7684' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
.field select:hover { border-color: var(--text-3); }

.input-group { display: flex; gap: 8px; }
.input-group .input, .input-group input { flex: 1; }

/* Copy field */
.copy-field {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: border-color .15s ease;
}
.copy-field:hover { border-color: var(--text-3); }
.copy-field .cf-val {
  flex: 1;
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 9px 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}
.copy-field .cf-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-left: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  padding: 9px 13px;
  cursor: pointer;
  transition: all .15s ease;
  font-family: var(--font);
}
.copy-field .cf-btn:hover { color: var(--accent); background: var(--bg-2); }
.copy-field .cf-btn.copied { color: var(--accent); }
.copy-field .cf-btn svg { width: 13px; height: 13px; }

/* Toggle switch — square track */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; flex: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .trk {
  width: 36px;
  height: 20px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  transition: all .18s ease;
  position: relative;
}
.toggle .trk::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--text-3);
  transition: all .18s ease;
}
.toggle input:checked + .trk { background: var(--accent-dim); border-color: var(--accent); }
.toggle input:checked + .trk::after { left: 18px; background: var(--accent); }
.toggle input:focus-visible + .trk { outline: 2px solid var(--accent); outline-offset: 2px; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .tr-main { flex: 1; min-width: 0; }
.toggle-row .tr-main b { font-size: 13.5px; font-weight: 700; display: block; }
.toggle-row .tr-main span { font-size: 12px; color: var(--text-3); }

/* Checkbox card row (add-ons on deploy) */
.check-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.check-card:hover { border-color: var(--border-strong); }
.check-card.checked { border-color: var(--accent); background: var(--accent-dim); }
.check-card input { accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
.check-card .cc-main { flex: 1; min-width: 0; }
.check-card .cc-main b { font-size: 13px; font-weight: 700; display: block; }
.check-card .cc-main span { font-size: 11.5px; color: var(--text-3); }
.check-card .cc-price { font-family: var(--mono); font-size: 12.5px; color: var(--accent); white-space: nowrap; }

/* ==========================================================================
   Keyboard hint
   ========================================================================== */

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 6px;
  min-width: 22px;
  line-height: 1.5;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border-radius: var(--r-sm);
  border: 1px solid;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 16px;
}
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.alert b { font-weight: 700; }
.alert.info { background: var(--blue-dim); border-color: rgba(11, 99, 206, .3); color: #0B5394; }
.alert.info svg { color: var(--blue); }
.alert.warn { background: var(--gold-dim); border-color: rgba(161, 98, 7, .3); color: #7C4A05; }
.alert.warn svg { color: var(--gold); }
.alert.danger { background: var(--red-dim); border-color: rgba(185, 28, 28, .32); color: #B91C1C; }
.alert.danger svg { color: var(--red); }
.alert.ok { background: var(--green-dim); border-color: rgba(21, 128, 61, .3); color: #15803D; }
.alert.ok svg { color: var(--green); }

/* ==========================================================================
   Chart container + tooltip
   ========================================================================== */

.chart {
  position: relative;
  width: 100%;
  height: 260px;
}
.chart.sm { height: 180px; }
.chart canvas { display: block; width: 100%; height: 100%; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity .12s ease;
  white-space: nowrap;
  z-index: 5;
  transform: translate(-50%, calc(-100% - 12px));
}
.chart-tip.on { opacity: 1; }
.chart-tip .ct-x { color: var(--text-3); font-size: 11px; margin-bottom: 3px; font-family: var(--mono); }
.chart-tip .ct-row { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11.5px; }
.chart-tip .ct-dot { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.chart-tip .ct-row b { margin-left: auto; padding-left: 12px; color: var(--text); font-weight: 700; }

.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.chart-legend .cl { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend .cl i { width: 10px; height: 3px; border-radius: 1px; display: inline-block; }

/* ==========================================================================
   Deploy: compact plan / location selector cards
   ========================================================================== */

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick-grid.loc { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.pick-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  width: 100%;
}
.pick-card:hover { border-color: var(--border-strong); }
.pick-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent);
}
.pick-card .pc-check {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 17px;
  height: 17px;
  border-radius: 2px;
  background: var(--accent);
  color: #FFFFFF;
  display: none;
  align-items: center;
  justify-content: center;
}
.pick-card .pc-check svg { width: 10px; height: 10px; }
.pick-card.selected .pc-check { display: flex; }
.pick-card .pc-name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.pick-card .pc-name .flag { font-size: 16px; }
.pick-card .pc-specs { font-size: 11.5px; color: var(--text-2); margin-top: 5px; line-height: 1.5; }
.pick-card .pc-price { font-family: var(--mono); font-size: 14px; color: var(--accent); margin-top: 8px; font-weight: 700; }
.pick-card .pc-price small { color: var(--text-3); font-weight: 400; font-size: 11px; }
.pick-card .pc-badge {
  position: absolute;
  top: -8px;
  left: 12px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--gold);
  color: #FFFFFF;
  border-radius: 3px;
  padding: 2px 7px;
}
.pick-card .pc-tier {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-radius: 3px;
  padding: 1px 6px;
}
.pick-card .pc-tier.standard { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-strong); }
.pick-card .pc-tier.premium { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(161, 98, 7, .3); }

/* Cycle segmented control */
.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.seg button {
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font);
  padding: 6px 13px;
  border-radius: 3px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent); color: #FFFFFF; }
.seg button .save { color: var(--gold); font-size: 10.5px; margin-left: 4px; font-family: var(--mono); }
.seg button.active .save { color: #F5D08A; }

/* Order summary (deploy) */
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--text-2);
}
.summary-row:last-child { border-bottom: none; }
.summary-row b { color: var(--text); font-weight: 700; text-align: right; }
.summary-row.total { padding-top: 12px; margin-top: 4px; border-top: 1px solid var(--border-strong); border-bottom: none; }
.summary-row.total span { font-weight: 700; color: var(--text); }
.summary-row.total b { font-family: var(--mono); font-size: 20px; color: var(--accent); letter-spacing: normal; }
.summary-row .disc { color: var(--gold); font-size: 11.5px; font-family: var(--mono); }

/* ==========================================================================
   Ticket thread
   ========================================================================== */

.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 12px; }
.msg .avatar {
  width: 30px;
  height: 30px;
  border-radius: 3px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
}
.msg.staff .avatar { background: var(--accent-dim); border-color: rgba(23, 66, 122, .3); color: var(--accent); }
.msg .msg-body { flex: 1; min-width: 0; }
.msg .msg-meta { display: flex; align-items: baseline; gap: 9px; margin-bottom: 4px; }
.msg .msg-meta b { font-size: 13px; font-weight: 700; }
.msg .msg-meta .role { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.msg .msg-meta time { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.msg .msg-text {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0 var(--r) var(--r) var(--r);
  padding: 11px 14px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.staff .msg-text { border-color: rgba(23, 66, 122, .25); }

/* ==========================================================================
   Login page — quiet classic grid, no glow pulse
   ========================================================================== */

body.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-bg { position: fixed; inset: 0; pointer-events: none; }
.login-bg::before {
  content: '';
  position: absolute;
  inset: -100px;
  background-image:
    linear-gradient(rgba(23, 66, 122, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 66, 122, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: grid-drift 24s linear infinite;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
}
.login-bg::after { content: none; }
@keyframes grid-drift { to { transform: translate(44px, 44px); } }

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 30px;
  animation: modal-in .25s ease;
}
.login-card .lc-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; color: var(--text); }
.login-card .lc-brand img { width: 30px; height: 30px; }
.login-card .lc-brand .wm { font-weight: 700; letter-spacing: .14em; font-size: 15px; }
.login-card .lc-brand .tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(23, 66, 122, .25);
  padding: 2px 6px;
  border-radius: 3px;
}
.login-card h1 { font-size: 19px; letter-spacing: normal; margin-bottom: 6px; }
.login-card .lc-sub { font-size: 13px; color: var(--text-2); margin-bottom: 22px; line-height: 1.55; }
.login-card .lc-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); line-height: 1.6; }
.login-card .lc-foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.login-card .lc-foot a:hover { color: var(--blue); }
.login-card .demo-hint {
  margin-top: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
}
.login-card .demo-hint .mono { color: var(--gold); font-size: 11px; user-select: all; }

/* ==========================================================================
   Responsive shell behavior
   ========================================================================== */

@media (max-width: 992px) {
  /* Sidebar collapses to icon rail */
  .sidebar { width: var(--rail-w); }
  .sidebar .side-brand { justify-content: center; padding: 16px 0; }
  .sidebar .side-brand .wm, .sidebar .side-brand .tag { display: none; }
  .sidebar .side-link { justify-content: center; padding: 9px 0; }
  .sidebar .side-link span, .sidebar .side-link .cnt { display: none; }
  .sidebar .side-link.active::before { left: -10px; }
  .sidebar .side-label { display: none; }
  .sidebar .token-chip { justify-content: center; padding: 7px 0; }
  .sidebar .token-chip span { display: none; }
  .sidebar .side-logout { justify-content: center; padding: 8px 0; }
  .sidebar .side-logout span { display: none; }
  .topbar { left: var(--rail-w); }
  .content { margin-left: var(--rail-w); }
}

@media (max-width: 640px) {
  /* Sidebar becomes off-canvas drawer with overlay */
  .sidebar { width: var(--sidebar-w); transform: translateX(-100%); }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow); }
  .sidebar .side-brand { justify-content: flex-start; padding: 16px 18px; }
  .sidebar .side-brand .wm, .sidebar .side-brand .tag { display: block; }
  .sidebar .side-link { justify-content: flex-start; padding: 8px 10px; }
  .sidebar .side-link span { display: inline; }
  .sidebar .side-link .cnt { display: inline-block; }
  .sidebar .side-label { display: block; }
  .sidebar .token-chip { justify-content: flex-start; padding: 7px 10px; }
  .sidebar .token-chip span { display: inline; }
  .sidebar .side-logout { justify-content: flex-start; padding: 7px 10px; }
  .sidebar .side-logout span { display: inline; }
  .topbar { left: 0; padding: 0 14px; gap: 10px; }
  .nav-toggle { display: inline-flex; }
  .content { margin-left: 0; padding: calc(var(--topbar-h) + 16px) 14px 56px; }
  .crumb .crumb-root { display: none; }
  .crumb .sep { display: none; }
  .balance-pill { padding: 4px 10px; font-size: 12px; }
  .top-actions { gap: 8px; }
}

/* ==========================================================================
   Motion preferences
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
