:root {
  color-scheme: dark;
  --bg: #070b12;
  --sidebar: #0a0f18;
  --surface: #0e1521;
  --surface-2: #121c2a;
  --surface-3: #172334;
  --line: #223146;
  --line-soft: #182537;
  --text: #f7f9fc;
  --text-2: #c2ccda;
  --muted: #8190a4;
  --ink: #1e3a5f;
  --accent: #16a378;
  --accent-strong: #24c18f;
  --accent-soft: rgba(22, 163, 120, .13);
  --positive: #38c793;
  --negative: #ff6b7a;
  --warning: #f3bd5b;
  --info: #6aa8ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --sidebar-width: 200px;
  --topbar-height: 64px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 82% -10%, rgba(22, 163, 120, .10), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  transform: translateY(-140%);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg);
}
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--line-soft);
  background: rgba(10, 15, 24, .96);
  backdrop-filter: blur(18px);
}
.brand {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 560;
  letter-spacing: -.035em;
  text-decoration: none;
}
.brand::before {
  width: 30px;
  height: 22px;
  flex: none;
  content: "";
  background: url("/logo.svg?v=8") center / contain no-repeat;
}
.nav {
  display: grid;
  gap: 3px;
  padding: 14px 10px;
}
.nav-section {
  margin: 14px 8px 6px;
  color: #63738a;
  font: 500 11px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.nav-item:hover {
  background: rgba(255,255,255,.035);
  color: var(--text-2);
}
.nav-item[aria-current="page"] {
  border-color: rgba(36, 193, 143, .16);
  background: var(--accent-soft);
  color: #d9fff1;
}
.nav-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  flex: none;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.sidebar-foot {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding: 12px 10px 16px;
  border-top: 1px solid var(--line-soft);
}
.sidebar-link {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,.035); color: var(--text); }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 18px;
  padding: 12px clamp(18px, 3vw, 38px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 11, 18, .86);
  backdrop-filter: blur(18px);
}
.mobile-menu { display: none; }
.page-heading { min-width: 0; }
.page-heading h1 {
  overflow: hidden;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 29px);
  font-weight: 550;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-heading p {
  overflow: hidden;
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 0 11px;
  color: var(--muted);
  font: 500 11px/1 var(--mono);
  letter-spacing: .02em;
  background: rgba(14, 21, 33, .7);
}
.sync-pill::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}
.sync-pill.ready { color: var(--positive); border-color: rgba(56, 199, 147, .28); }
.sync-pill.ready::before { background: var(--positive); box-shadow: 0 0 0 3px rgba(56, 199, 147, .12); }
.sync-pill.loading { color: var(--warning); border-color: rgba(243, 189, 91, .28); }
.sync-pill.loading::before { background: var(--warning); animation: pulse 1.1s ease-in-out infinite; }
.sync-pill.error { color: var(--negative); border-color: rgba(255, 107, 122, .28); }
.sync-pill.error::before { background: var(--negative); }
.profile-wrap { position: relative; }
.profile-button {
  display: inline-flex;
  max-width: 168px;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  background: var(--surface);
  color: var(--text);
}
.avatar {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--accent), #0a7457);
  color: white;
  font: 600 11px/1 var(--mono);
}
.profile-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  text-align: left;
}
.profile-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-caret {
  width: 6px;
  height: 6px;
  flex: none;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-1px) rotate(45deg);
  opacity: .7;
}
.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: 250px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.profile-summary { padding: 10px; border-bottom: 1px solid var(--line); }
.profile-summary strong, .profile-summary span { display: block; overflow-wrap: anywhere; }
.profile-summary span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.menu-button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
}
.menu-button:hover { background: rgba(255,255,255,.045); color: var(--text); }

.content {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 38px);
}
.view { animation: view-in .22s ease both; }
.view-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}
.view-head-copy { min-width: 0; }
.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font: 500 10px/1.2 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.view-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(25px, 3vw, 36px);
  font-weight: 540;
  letter-spacing: -.035em;
}
.view-head p:not(.eyebrow) {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--muted);
}
.view-actions { display: flex; gap: 9px; margin-left: auto; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  background: var(--accent);
  color: #031810;
  font-weight: 600;
  text-decoration: none;
  transition: filter .16s ease, transform .16s ease, background-color .16s ease;
}
.button:hover { filter: brightness(1.1); }
.button:active { transform: translateY(1px); }
.button.secondary {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text-2);
}
.button.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.button.danger { border-color: rgba(255,107,122,.25); background: rgba(255,107,122,.1); color: #ffabb4; }
.button.small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.button:disabled { cursor: not-allowed; filter: none; opacity: .45; }
.button.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  opacity: .85;
}
.button.is-loading::after {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: var(--text-2);
  content: "";
  animation: spin .7s linear infinite;
}
.button:not(.secondary):not(.ghost):not(.danger).is-loading::after { color: #031810; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  padding: 17px;
  background: linear-gradient(145deg, rgba(18,28,42,.88), rgba(12,19,30,.88));
}
.kpi-link {
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease;
}
.kpi-link:hover, .kpi-link:focus-visible {
  border-color: rgba(36, 193, 143, .45);
  outline: none;
}
.kpi-value .sk-kpi {
  display: block;
  width: 58%;
  height: 26px;
  margin-top: 2px;
}
.kpi-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.kpi-value {
  display: block;
  overflow: hidden;
  margin-top: 8px;
  color: var(--text);
  font: 500 clamp(22px, 2.8vw, 31px)/1.1 var(--serif);
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-note { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.positive { color: var(--positive) !important; }
.negative { color: var(--negative) !important; }
.warning { color: var(--warning) !important; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr);
  gap: 14px;
}
.view[data-view="developer"] .dashboard-grid,
.view[data-view="billing"] .dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.view[data-view="billing"] .billing-grid {
  grid-template-columns: 1fr;
}
.billing-topup-panel .panel-head {
  min-height: 0;
  padding: 10px 16px;
  gap: 8px;
}
.billing-topup-body {
  display: grid;
  gap: 0;
  max-width: 640px;
}
.billing-balance-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(8, 14, 22, .55);
}
.billing-balance-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.billing-balance-chip strong {
  color: var(--text);
  font: 500 15px/1 var(--serif);
}
.billing-topup {
  display: grid;
  gap: 14px;
}
.billing-topup-primary {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}
.billing-topup .field {
  min-width: 0;
}
.billing-topup .input,
.billing-topup input,
.billing-topup select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.billing-amount-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0a111c;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.billing-amount-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 163, 120, .12);
}
.billing-amount-prefix {
  padding: 0 0 0 12px;
  color: var(--muted);
  font: 500 14px/1 var(--sans);
}
.billing-amount-wrap .input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.billing-amount-wrap .input:focus {
  border: 0;
  box-shadow: none;
}
.billing-coupon-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.billing-coupon-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.billing-coupon-row .button {
  min-height: 40px;
  white-space: nowrap;
}
.billing-coupon-status {
  margin: 0;
}
.billing-coupon-status.is-ok { color: var(--accent-strong); }
.billing-coupon-status.is-bad { color: #f3a6ae; }
.billing-topup-submit {
  min-height: 44px;
  width: 100%;
  justify-self: stretch;
}
.billing-payment {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(36, 193, 143, .22);
  border-radius: 12px;
  background: rgba(22, 163, 120, .05);
  display: grid;
  gap: 12px;
}
.billing-payment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.billing-payment-head strong {
  display: block;
  font-size: 14px;
}
.billing-payment-head .muted {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
}
.billing-payment-direct {
  display: grid;
  gap: 10px;
}
.billing-address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.billing-payment-direct .input,
.billing-payment-invoice .button {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}
.billing-payment-invoice {
  display: grid;
  gap: 10px;
}
.span-2 { grid-column: 1 / -1; }
.panel {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(14, 21, 33, .84);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
  overflow: hidden;
}
.panel-head {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-title { min-width: 0; }
.panel-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.panel-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.panel-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.panel-body { padding: 16px; }
.panel-foot { display: flex; justify-content: center; padding: 0 16px 16px; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chart-wrap { position: relative; min-height: 270px; }
.chart-wrap svg { display: block; width: 100%; height: 270px; overflow: visible; }
.chart-grid-line { stroke: #1d2b3e; stroke-width: 1; }
.chart-area { fill: none; }
.chart-line { fill: none; stroke: var(--accent-strong); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.chart-dot { fill: var(--surface); stroke: var(--accent-strong); stroke-width: 2; }
.chart-axis { fill: var(--muted); font: 10px var(--mono); }
.chart-summary {
  position: absolute;
  top: 10px;
  left: 14px;
  z-index: 1;
  display: grid;
  gap: 2px;
  pointer-events: none;
}
.chart-summary strong { font: 500 22px var(--serif); color: var(--text); }
.chart-summary span { color: var(--muted); font-size: 11px; }
.chart-summary span.is-up { color: var(--positive); }
.chart-summary span.is-down { color: var(--negative); }
.chart-skeleton {
  position: absolute;
  inset: 16px;
  display: grid;
}
.chart-skeleton .sk-chart {
  min-height: 220px;
  border-radius: 14px;
}

.health-list, .activity-list, .relationship-list, .developer-list, .account-grid {
  display: grid;
  gap: 10px;
}
.health-row, .activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 0;
}
.developer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 0;
}
.developer-row .inline-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
}
.health-row:last-child, .activity-row:last-child, .developer-row:last-child { border-bottom: 0; }
.status-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot.connected { background: var(--positive); box-shadow: 0 0 0 4px rgba(56,199,147,.08); }
.status-dot.pending { background: var(--warning); }
.status-dot.failed, .status-dot.disconnected { background: var(--negative); }
.row-main { min-width: 0; flex: 1; }
.row-main strong, .row-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.developer-row .row-main span {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: anywhere;
}
.developer-row .row-main .key-mask {
  letter-spacing: .04em;
  color: var(--muted);
}
.developer-row .row-main .key-scopes {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}
.api-key-row .key-scopes {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.api-key-row.is-revoked { opacity: .62; }
.api-key-row .key-status.active { color: var(--positive); }
.api-key-row .key-status.revoked { color: var(--muted); text-transform: lowercase; }
.api-key-fold {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}
.api-key-fold-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.api-key-fold-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.api-key-fold-list { display: grid; gap: 0; }
.row-main strong { color: var(--text-2); font-size: 12px; }
.row-main span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.row-value { flex: none; text-align: right; }
.row-value strong, .row-value span { display: block; }
.row-value strong { font: 500 12px var(--mono); }
.row-value span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.billing-ledger {
  max-height: min(420px, 55vh);
  overflow: auto;
  overscroll-behavior: contain;
}
.billing-row .row-value strong.is-credit { color: var(--positive); }
.billing-row .row-value strong.is-debit { color: var(--text-2); }

.onboarding {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 14px;
  margin-bottom: 14px;
}
.welcome-card {
  overflow: hidden;
  position: relative;
  min-height: 250px;
  border: 1px solid rgba(36,193,143,.2);
  border-radius: 16px;
  padding: clamp(24px, 4vw, 42px);
  background:
    radial-gradient(circle at 90% 10%, rgba(36,193,143,.18), transparent 16rem),
    linear-gradient(140deg, #122233, #0c141f 70%);
}
.welcome-card::after {
  position: absolute;
  right: -80px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(36,193,143,.13);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(36,193,143,.025), 0 0 0 76px rgba(36,193,143,.02);
  content: "";
}
.welcome-card h2 {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0;
  font: 540 clamp(29px, 4.5vw, 46px)/1.04 var(--serif);
  letter-spacing: -.045em;
}
.welcome-card p {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 13px 0 23px;
  color: var(--text-2);
}
.setup-list { counter-reset: setup; }
.setup-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  counter-increment: setup;
}
.setup-row:last-child { border-bottom: 0; }
.setup-row::before {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  content: counter(setup, decimal-leading-zero);
  font: 500 10px var(--mono);
}
.setup-row strong { display: block; font-size: 12px; }
.setup-row span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}
.search-field {
  position: relative;
  min-width: min(320px, 100%);
  flex: 1;
}
.search-field input { width: 100%; padding-left: 36px; }
.search-field svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
}
.input, input, select, textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 11px;
  outline: none;
  background: #0a111c;
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #59687b; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22,163,120,.12);
}
select { color-scheme: dark; }
textarea { min-height: 90px; resize: vertical; }
.compact-select { min-width: 190px; }

.account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview-account-grid,
.account-grid.meta-tile-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  align-items: stretch;
  align-content: start;
}
.meta-tile {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 168px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 12px;
  background: rgba(14, 21, 33, .92);
  text-align: left;
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.meta-tile:hover { border-color: #31445d; }
.meta-tile.is-progress { border-color: rgba(36, 193, 143, .28); }
.meta-tile.is-error { border-color: rgba(255, 107, 122, .28); }
.meta-tile-add {
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
  gap: 10px;
  width: 100%;
  min-height: 168px;
  border-style: dashed;
  border-color: #2c3d55;
  background: rgba(10, 16, 26, .55);
  color: var(--muted);
  cursor: pointer;
  font: 500 14px var(--sans);
}
.meta-tile-add:hover {
  border-color: rgba(36, 193, 143, .45);
  color: var(--text);
  background: rgba(22, 163, 120, .06);
}
.meta-add-plus {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 999px;
  border: 1px dashed #3a4f6b;
  color: var(--accent-strong);
  font: 400 28px/1 var(--sans);
}
.meta-tile-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.meta-id {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px dashed #3a4f6b;
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(8, 14, 22, .7);
  color: var(--muted);
  font: 500 10px/1.3 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: copy;
}
.meta-id:hover { border-color: #5a7394; color: var(--text); }
.meta-tile-icons {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 2px;
}
.meta-tile .account-more-wrap { position: relative; }
.meta-tile .account-more-menu {
  top: calc(100% + 6px);
  right: 0;
  bottom: auto;
  left: auto;
}
.meta-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.meta-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.meta-icon:hover { background: rgba(255,255,255,.05); color: var(--text); }
.meta-icon.danger:hover { background: rgba(255,107,122,.1); color: var(--negative); }
.meta-tile-title {
  overflow: hidden;
  margin: 0;
  min-width: 0;
  color: var(--text);
  font: 500 13px/1.35 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.meta-tag {
  display: inline-flex;
  max-width: 42%;
  overflow: hidden;
  flex: none;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--text-2);
  font: 500 10px/1.2 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: lowercase;
}
.meta-tag-good {
  border-color: rgba(56, 199, 147, .35);
  color: #7ce4ba;
}
.meta-tag-server {
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
}
.meta-tile-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  min-width: 0;
  padding-top: 2px;
}
.meta-tile-foot-actions {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
}
.meta-conn {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}
.meta-conn span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meta-conn-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #4d5d73;
}
.meta-conn-dot.is-on { background: var(--positive); box-shadow: 0 0 0 3px rgba(56,199,147,.12); }
.meta-conn-dot.is-off { background: var(--negative); }
.meta-conn-dot.is-wait { background: var(--warning); animation: pulse 1.2s infinite; }
.meta-conn-dot.is-idle { background: #3d4d63; }
.meta-deploy {
  flex: none;
  border-radius: 999px;
  padding: 4px 8px;
  font: 600 10px/1 var(--sans);
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.meta-deploy.is-on {
  background: rgba(56, 199, 147, .14);
  color: #7ce4ba;
}
.meta-deploy.is-off {
  background: rgba(243, 189, 91, .14);
  color: #f5ce84;
}
.meta-power {
  display: grid;
  width: 30px;
  height: 30px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 0;
  background: rgba(255,255,255,.03);
  color: var(--text-2);
  cursor: pointer;
}
.meta-power svg { width: 12px; height: 12px; fill: currentColor; }
.meta-power:hover {
  border-color: rgba(36, 193, 143, .35);
  color: var(--accent-strong);
}
.overview-account-grid > .empty-state,
.meta-tile-grid > .empty-state {
  grid-column: 1 / -1;
}
.overview-accounts-panel .panel-head {
  min-height: 0;
  padding: 8px 12px;
  gap: 8px;
}
.overview-accounts-panel .panel-actions {
  gap: 6px;
}
.overview-limit-select {
  min-width: 0;
  width: 64px;
  padding-inline: 8px;
}
.overview-accounts-panel .panel-body.overview-account-grid {
  overflow: visible;
}
.account-card {
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 16px;
  background: rgba(14,21,33,.84);
  transition: border-color .16s ease, transform .16s ease;
}
.account-card:hover { border-color: #31445d; transform: translateY(-1px); }
.account-card.is-progress { border-color: rgba(36, 193, 143, .28); }
.account-card.is-error { border-color: rgba(255, 107, 122, .28); }
.account-status {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 11px 12px;
  background: rgba(8, 14, 22, .72);
}
.account-status.is-progress {
  border-color: rgba(36, 193, 143, .18);
  background: linear-gradient(180deg, rgba(22, 163, 120, .08), rgba(8, 14, 22, .55));
}
.account-status.is-error {
  border-color: rgba(255, 107, 122, .2);
  background: linear-gradient(180deg, rgba(255, 107, 122, .08), rgba(8, 14, 22, .55));
}
.account-status.is-idle {
  padding: 9px 12px;
  background: rgba(255,255,255,.02);
}
.account-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-status-row strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: capitalize;
}
.account-status-row > span:last-child {
  color: var(--muted);
  font: 500 10px/1 var(--mono);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.account-status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}
.account-status-dot.connected { background: var(--positive); box-shadow: 0 0 0 4px rgba(56,199,147,.1); }
.account-status-dot.pending { background: var(--warning); box-shadow: 0 0 0 4px rgba(243,189,91,.1); animation: pulse 1.2s infinite; }
.account-status-dot.failed { background: var(--negative); box-shadow: 0 0 0 4px rgba(255,107,122,.1); }
.account-status-dot.idle { background: #4d5d73; }
.account-status-detail {
  margin: 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}
.account-status.is-error .account-status-detail { color: #ffabb4; }
.account-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.account-step {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.account-step::before {
  height: 2px;
  border-radius: 999px;
  background: #223146;
  content: "";
}
.account-step span {
  overflow: hidden;
  color: var(--muted);
  font: 500 9px/1.2 var(--mono);
  letter-spacing: .04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.account-step.is-done::before { background: rgba(56, 199, 147, .7); }
.account-step.is-done span { color: #7ce4ba; }
.account-step.is-current::before {
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 10px rgba(36, 193, 143, .35);
}
.account-step.is-current span { color: var(--text); }
.account-status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.account-status-meta span {
  color: var(--muted);
  font: 500 10px/1.3 var(--mono);
}
.account-progress {
  overflow: hidden;
  position: relative;
  height: 2px;
  border-radius: 999px;
  background: rgba(36, 193, 143, .1);
}
.account-progress-shuttle {
  position: absolute;
  top: 0;
  left: 0;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
  animation: account-shuttle 1.35s ease-in-out infinite;
}
@keyframes account-shuttle {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.account-head { display: flex; align-items: flex-start; gap: 12px; }
.account-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  flex: none;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: 600 12px var(--mono);
}
.account-title { min-width: 0; flex: 1; }
.account-title h3 {
  overflow: hidden;
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 540;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-title p { overflow: hidden; margin: 3px 0 0; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge, .chip {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-badge.connected, .chip.good { border-color: rgba(56,199,147,.2); background: rgba(56,199,147,.09); color: #7ce4ba; }
.status-badge.deployed { border-color: rgba(106,168,255,.22); background: rgba(106,168,255,.09); color: #9ac4ff; }
.status-badge.failed, .chip.bad { border-color: rgba(255,107,122,.22); background: rgba(255,107,122,.09); color: #ffabb4; }
.status-badge.pending, .chip.warn { border-color: rgba(243,189,91,.2); background: rgba(243,189,91,.09); color: #f5ce84; }
.account-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 17px 0 14px;
}
.mini-metric {
  min-width: 0;
  border-radius: 9px;
  padding: 10px;
  background: rgba(255,255,255,.025);
}
.mini-metric span, .mini-metric strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-metric span { color: var(--muted); font-size: 10px; }
.mini-metric strong { margin-top: 4px; font: 500 13px var(--mono); }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.account-more-wrap { position: relative; margin-left: auto; }
.account-more-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 40;
  min-width: 168px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  background: rgba(14, 21, 33, .98);
  box-shadow: var(--shadow);
}
.account-more-menu .menu-button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 9px 11px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
}
.account-more-menu .menu-button:hover { background: rgba(255,255,255,.04); color: var(--text); }
.account-more-menu .menu-button.danger { color: var(--negative); }
.field-hint { display: block; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.field-hint.good { color: #7ce4ba; }
.field-hint.pending { color: #f5ce84; }
.field-hint.warn { color: #ffabb4; }

.relationship-list {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  align-items: stretch;
}
.relationship-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 14px;
  background: rgba(14,21,33,.92);
  transition: border-color .16s ease, transform .16s ease;
}
.relationship-card:hover { border-color: #31445d; transform: translateY(-1px); }
.relationship-card.is-disabled { opacity: .78; }
.relationship-card.is-paused { border-color: rgba(255, 107, 122, .28); }
.relationship-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.relationship-top-actions {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.relationship-path {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}
.relationship-account {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px;
  background: rgba(8, 14, 22, .55);
}
.relationship-account span,
.relationship-account strong,
.relationship-account em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.relationship-account span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.relationship-account strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.relationship-account em {
  color: var(--muted);
  font: 500 10px/1.3 var(--mono);
  font-style: normal;
}
.path-arrow {
  display: grid;
  place-items: center;
  color: var(--accent-strong);
}
.path-arrow svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.relationship-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.relationship-meta .chip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.relationship-actions { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.relationship-actions .status-badge { margin-right: auto; }

.bar-list { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 120px) minmax(100px, 1fr) 72px; align-items: center; gap: 10px; }
.bar-label { overflow: hidden; color: var(--text-2); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; overflow: hidden; border-radius: 999px; background: #182536; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--accent); }
.bar-fill.negative { background: var(--negative); }
.bar-value { color: var(--muted); font: 10px var(--mono); text-align: right; }
.breakdown-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }

.tabs {
  display: inline-flex;
  gap: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 3px;
  background: #09111b;
}
.tab {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  padding: 5px 11px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.tab[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.tab.is-loading { opacity: .7; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.data-table th {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 12px;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: rgba(255,255,255,.018); }
.mono { font-family: var(--mono); }

.trade-panel { overflow: hidden; display: flex; flex-direction: column; }
.history-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: #0a121c;
}
.history-filter {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.history-filter span {
  color: var(--muted);
  font: 500 10px/1 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.history-filter select {
  min-height: 34px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}
.trade-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(36, 193, 143, .45) rgba(255,255,255,.04);
}
.trade-scroll.is-history {
  max-height: min(52vh, 520px);
}
.trade-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.trade-scroll::-webkit-scrollbar-track {
  margin: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.035);
}
.trade-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(36,193,143,.75), rgba(22,163,120,.45));
  box-shadow: inset 0 0 0 1px rgba(36,193,143,.2);
}
.trade-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(56,199,147,.95), rgba(36,193,143,.65));
}
.trade-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0e1521;
  box-shadow: 0 1px 0 var(--line);
}
.trade-foot {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.history-count {
  color: var(--muted);
  font: 500 11px/1.2 var(--mono);
}
.trade-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line-soft);
  background: #0a121c;
}
.trade-stat {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(14, 21, 33, .92);
}
.trade-stat span {
  color: var(--muted);
  font: 500 10px/1.2 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.trade-stat strong {
  font: 560 18px/1.1 var(--serif);
  letter-spacing: -.02em;
}
.trade-table td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.trade-table td.symbol {
  color: var(--text);
  font-weight: 600;
  letter-spacing: .01em;
}
.trade-table tbody tr.row-profit { background: rgba(56, 199, 147, .045); }
.trade-table tbody tr.row-loss { background: rgba(255, 107, 122, .05); }
.trade-table tbody tr.row-profit:hover { background: rgba(56, 199, 147, .08); }
.trade-table tbody tr.row-loss:hover { background: rgba(255, 107, 122, .085); }
.trade-side {
  display: inline-flex;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 3px 8px;
  font: 700 10px/1 var(--mono);
  letter-spacing: .04em;
}
.trade-side-buy {
  background: rgba(74, 158, 255, .14);
  color: #7cbcff;
  box-shadow: inset 0 0 0 1px rgba(74, 158, 255, .28);
}
.trade-side-sell {
  background: rgba(255, 107, 122, .14);
  color: #ff9aa5;
  box-shadow: inset 0 0 0 1px rgba(255, 107, 122, .28);
}
.trade-side-neutral {
  background: rgba(129, 144, 164, .12);
  color: var(--muted);
}
.trade-entry {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font: 600 10px/1 var(--mono);
  letter-spacing: .04em;
}
.trade-entry-in { color: #7cbcff; background: rgba(74, 158, 255, .1); }
.trade-entry-out { color: #f3bd5b; background: rgba(243, 189, 91, .1); }
.trade-state {
  display: inline-flex;
  border-radius: 6px;
  padding: 3px 8px;
  font: 600 10px/1 var(--mono);
  letter-spacing: .03em;
}
.trade-state-placed, .trade-state-started { color: var(--info); background: rgba(106, 168, 255, .12); }
.trade-state-filled, .trade-state-partial { color: var(--positive); background: rgba(56, 199, 147, .12); }
.trade-state-canceled, .trade-state-expired, .trade-state-rejected { color: var(--negative); background: rgba(255, 107, 122, .12); }
.trade-pnl { font: 600 12px/1 var(--mono); font-variant-numeric: tabular-nums; }
.skeleton-row td { padding-top: 14px; padding-bottom: 14px; }
.skeleton-row .skeleton { height: 12px; }
.list-skeleton { display: grid; gap: 12px; padding: 4px 0; }
.list-skeleton-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 88px;
  gap: 12px;
  align-items: center;
}
.list-skeleton-row .skeleton.dot { width: 8px; height: 8px; border-radius: 50%; }
.list-skeleton-copy { display: grid; gap: 6px; }
.list-skeleton-copy .skeleton:first-child { width: 42%; height: 11px; }
.list-skeleton-copy .skeleton:last-child { width: 68%; height: 10px; }
.list-skeleton-row .skeleton.value { width: 100%; height: 12px; }

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 30px;
  text-align: center;
}
.empty-state.compact { min-height: 150px; }
.empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin: 0 auto 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--accent-strong);
}
.empty-state h3 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 540; }
.empty-state p { max-width: 440px; margin: 7px auto 15px; color: var(--muted); font-size: 12px; }

.skeleton {
  overflow: hidden;
  position: relative;
  min-height: 16px;
  border-radius: 7px;
  background: #142031;
}
.skeleton::after {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent);
  content: "";
  animation: shimmer 1.3s infinite;
}
.is-soft-refresh {
  opacity: .58;
  transition: opacity .28s ease;
  pointer-events: none;
}
.is-fade-in {
  animation: content-in .28s ease both;
}
@keyframes content-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.kpi.is-skeleton .kpi-value { min-height: 34px; }
.account-card-skeleton { pointer-events: none; }
.sk-mark { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.sk-title { flex: 1; display: grid; gap: 8px; min-width: 0; }
.sk-line { height: 11px; }
.sk-line.w-40 { width: 40%; }
.sk-line.w-42 { width: 42%; height: 15px; }
.sk-line.w-68 { width: 68%; height: 10px; }
.sk-line.w-70 { width: 70%; }
.sk-line.mt-8 { margin-top: 8px; }
.sk-pill { width: 74px; height: 22px; border-radius: 999px; flex: none; }
.sk-status { width: 100%; height: 52px; border-radius: 10px; margin-bottom: 12px; }
.sk-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.sk-btn { width: 78px; height: 32px; border-radius: 9px; }
.sk-btn.short { width: 56px; }
.sk-btn.mid { width: 72px; }
.sk-rel-path { display: grid; grid-template-columns: 1fr 18px 1fr; gap: 8px; align-items: center; }
.sk-block { height: 42px; border-radius: 10px; }
.sk-dot { width: 18px; height: 18px; border-radius: 50%; justify-self: center; }
.sk-chart { width: 100%; height: 220px; border-radius: 12px; }
.chart-skeleton { min-height: 220px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { color: var(--text-2); font-size: 11px; font-weight: 500; }
.field small { color: var(--muted); font-size: 10px; }
.check {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 11px;
  background: #0a111c;
  color: var(--text-2);
}
.check input { min-height: auto; width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.advanced {
  margin-top: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.advanced summary {
  padding: 11px 13px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { float: right; color: var(--muted); content: "+"; }
.advanced[open] summary::after { content: "−"; }
.advanced-body { padding: 2px 13px 13px; }

dialog {
  width: min(660px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 4, 10, .75); backdrop-filter: blur(3px); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 20px 15px;
  border-bottom: 1px solid var(--line-soft);
}
.dialog-head h2 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 540; letter-spacing: -.025em; }
.dialog-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.dialog-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}
.dialog-body { padding: 18px 20px; }
.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line-soft);
}
.dialog-status { margin-right: auto; color: var(--negative); font-size: 11px; }
.stepper { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 18px; }
.step {
  border: 0;
  border-bottom: 2px solid var(--line);
  padding: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.step[aria-current="step"] { border-color: var(--accent); color: var(--accent-strong); }
.secret-box {
  overflow-wrap: anywhere;
  border: 1px solid rgba(36,193,143,.23);
  border-radius: 10px;
  padding: 13px;
  background: var(--accent-soft);
  color: #c8ffeb;
  font: 12px/1.6 var(--mono);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 150;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 9px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  background: #152132;
  box-shadow: var(--shadow);
  animation: toast-in .22s ease both;
}
.toast::before { width: 8px; height: 8px; flex: none; margin-top: 6px; border-radius: 50%; background: var(--info); content: ""; }
.toast.success::before { background: var(--positive); }
.toast.error::before { background: var(--negative); }
.toast strong { display: block; font-size: 12px; }
.toast span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

.mobile-scrim { display: none; }
.error-banner {
  margin-bottom: 14px;
  border: 1px solid rgba(255,107,122,.22);
  border-radius: 10px;
  padding: 11px 13px;
  background: rgba(255,107,122,.08);
  color: #ffb4bc;
}

@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes pulse { 50% { opacity: .4; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .kpi-grid, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .relationship-list { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .overview-account-grid,
  .account-grid.meta-tile-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .billing-topup-primary {
    grid-template-columns: minmax(110px, 140px) minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-102%);
    box-shadow: 24px 0 70px rgba(0,0,0,.38);
    transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    border: 0;
    background: rgba(0, 4, 10, .68);
  }
  body:not(.nav-open) .mobile-scrim { display: none; }
  .workspace { margin-left: 0; }
  .mobile-menu {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    flex: none;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
  }
  .mobile-menu svg { width: 18px; fill: none; stroke: currentColor; }
  .onboarding { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { min-height: 66px; padding: 10px 14px; }
  .page-heading p { display: none; }
  .profile-copy, .profile-caret { display: none; }
  .profile-button { max-width: none; padding: 3px; }
  .content { padding: 18px 14px 42px; }
  .view-head { align-items: stretch; flex-direction: column; }
  .view-actions { width: 100%; margin-left: 0; }
  .view-actions .button { flex: 1; }
  .kpi-grid, .kpi-grid-5, .account-grid, .overview-account-grid, .account-grid.meta-tile-grid, .breakdown-grid { grid-template-columns: 1fr; }
  .sync-pill { display: none; }
  .account-more-wrap { margin-left: 0; width: 100%; }
  .account-more-wrap > .button { width: 100%; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar .button, .compact-select { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .account-metrics { grid-template-columns: repeat(2, 1fr); }
  .relationship-path { grid-template-columns: 1fr; }
  .path-arrow { transform: rotate(90deg); padding: 2px 0; }
  .relationship-top { flex-wrap: wrap; }
  .relationship-top-actions { width: 100%; margin-left: 0; justify-content: flex-end; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .panel-actions { width: 100%; margin-left: 0; }
  .panel-actions .tabs { width: 100%; }
  .panel-actions .tab { flex: 1; }
  .trade-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trade-scroll { max-height: min(58vh, 420px); }
  .bar-row { grid-template-columns: 80px 1fr 60px; }
  .dialog-foot { align-items: stretch; flex-direction: column-reverse; }
  .dialog-foot .button { width: 100%; }
  .dialog-status { margin-right: 0; }
  .view[data-view="developer"] .dashboard-grid,
  .view[data-view="billing"] .dashboard-grid { grid-template-columns: 1fr; }
  .billing-topup-body { max-width: none; }
  .billing-topup-primary { grid-template-columns: 1fr; }
  .billing-balance-chip { width: 100%; justify-content: space-between; }
  .developer-row { grid-template-columns: 1fr; }
  .developer-row .row-value { text-align: left; }
  .developer-row .inline-actions { width: 100%; }
  .developer-row .inline-actions .button { flex: 1; }
}

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

:focus-visible {
  outline: 2px solid #8be4c3;
  outline-offset: 2px;
}
