/* ------------------------------------------------------------------ */
/* Palet warna                                                        */
/*                                                                      */
/* Semua warna memakai variabel CSS supaya mode gelap dan mode terang   */
/* bisa memakai struktur yang sama. Dark = default (body.theme-dark),   */
/* terang = body.theme-light / html.theme-light.                        */
/* ------------------------------------------------------------------ */
:root {
  color-scheme: dark;
  --bg: #0f1115;
  --bg-2: #0c0e13;
  --panel: #171a21;
  --panel-2: #1c2029;
  --panel-3: #222732;
  --surface: rgba(148, 163, 184, 0.05);
  --border: #2b3140;
  --border-soft: #2b3240;
  --text: #e6e8ec;
  --muted: #a3acbb;
  --muted-2: #7b8496;
  --input-bg: #12151c;
  --console-bg: #0b0d12;
  --console-text: #cfe0f5;
  --code-bg: rgba(148, 163, 184, 0.12);
  --overlay: rgba(4, 8, 16, 0.72);
  --glow-1: rgba(34, 211, 238, 0.10);
  --glow-2: rgba(52, 211, 153, 0.08);
  --green: #34d399;
  --green-2: #10b981;
  --green-soft: #a7f3d0;
  --green-dim: rgba(52, 211, 153, 0.12);
  --cyan: #22d3ee;
  --cyan-soft: #a5f3fc;
  --cyan-dim: rgba(34, 211, 238, 0.12);
  --violet: #a78bfa;
  --violet-soft: #ddd6fe;
  --amber: #fbbf24;
  --amber-soft: #fde68a;
  --amber-dim: rgba(251, 191, 36, 0.12);
  --red: #fb7185;
  --red-soft: #fecdd3;
  --red-dim: rgba(251, 113, 133, 0.12);
  --blue: #60a5fa;
  --blue-soft: #bfdbfe;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --radius: 16px;
  --radius-sm: 11px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html.theme-light,
body.theme-light {
  color-scheme: light;
  --bg: #f4f5f7;
  --bg-2: #eceef2;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --panel-3: #eef0f4;
  --surface: rgba(15, 23, 42, 0.035);
  --border: #d3d7df;
  --border-soft: #e2e5ec;
  --text: #1a1d23;
  --muted: #545c6b;
  --muted-2: #6c7484;
  --input-bg: #ffffff;
  --console-bg: #f7f8fa;
  --console-text: #26303f;
  --code-bg: rgba(15, 23, 42, 0.06);
  --overlay: rgba(24, 28, 36, 0.45);
  --glow-1: rgba(34, 211, 238, 0.10);
  --glow-2: rgba(52, 211, 153, 0.07);
  --green: #0f9d63;
  --green-2: #0b7c4c;
  --green-soft: #056b46;
  --green-dim: rgba(15, 157, 99, 0.12);
  --cyan: #0e8ba8;
  --cyan-soft: #0b6b81;
  --cyan-dim: rgba(14, 139, 168, 0.12);
  --violet: #6d3bd6;
  --violet-soft: #5b2fb8;
  --amber: #b45309;
  --amber-soft: #92400e;
  --amber-dim: rgba(180, 83, 9, 0.12);
  --red: #d1344a;
  --red-soft: #a3202f;
  --red-dim: rgba(209, 52, 74, 0.10);
  --blue: #2563eb;
  --blue-soft: #1d4ed8;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay);
  backdrop-filter: blur(8px);
}
.login-card {
  width: min(390px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.login-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.login-card input {
  width: 100%;
}
.login-error {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid var(--red);
}

html, body {
  margin: 0;
  min-height: 100%;
  /* Warna dasar dipisah dari gradient supaya var(--bg) selalu ter-resolve
     ulang saat tema diganti (shorthand background tidak di-refresh otomatis). */
  background-color: var(--bg);
  background-image: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 500px at 78% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at 8% 110%, var(--glow-2), transparent 60%);
  /* Tanpa transisi warna: pergantian tema harus langsung mengubah nilai
     computed background-color/color (transisi bisa "macet" di tab latar
     atau renderer yang tidak menjalankan animasi). */
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: var(--code-bg);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 0.92em;
}
.hidden { display: none !important; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12.5px; }
.grow { flex: 1 1 260px; }
.nowrap { white-space: nowrap; }

/* Layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 246px;
  flex: 0 0 246px;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background-color: transparent;
  background-image: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  border-right: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 10px 24px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #04121e;
  background-color: transparent;
  background-image: linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 8px 24px var(--cyan-dim);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15.5px; letter-spacing: 0.1px; }
.brand-text span { color: var(--muted-2); font-size: 11.5px; margin-top: 3px; letter-spacing: 0.5px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  color: var(--green-soft);
  background-color: transparent;
  background-image: linear-gradient(90deg, var(--green-dim), var(--cyan-dim));
  border-color: var(--green);
}
.nav-item.active svg { color: var(--green); }

.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding: 14px 6px 0; }
.local-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: 0.3px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-dim);
  display: inline-block;
  flex: 0 0 auto;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 26px clamp(18px, 3.2vw, 46px) 56px;
  max-width: 1560px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -0.5px; }
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.status .dot { width: 6px; height: 6px; }
.status.ok .dot { background: var(--green); }
.status.warn .dot { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-dim); }
.status.bad .dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-dim); }

/* Tombol tema (matahari / bulan) */
.theme-toggle { position: relative; width: 34px; height: 34px; }
.theme-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
body.theme-light .theme-toggle .icon-sun { display: none; }
body.theme-dark .theme-toggle .icon-moon { display: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: transform 0.16s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary {
  color: #04121e;
  background-color: transparent;
  background-image: linear-gradient(135deg, var(--green), #2dd4bf);
  box-shadow: 0 8px 20px var(--green-dim);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted-2); background: var(--surface); }
.btn-danger { color: #ffffff; background: #b91c1c; border-color: #dc2626; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 4px 8px; font-size: 11px; border-radius: 7px; }
.full { width: 100%; }
.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); background: var(--surface); }

/* Banner */
.banner {
  border: 1px solid var(--amber);
  background: var(--amber-dim);
  color: var(--amber-soft);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 18px;
  font-size: 13px;
}
.banner.bad { border-color: var(--red); background: var(--red-dim); color: var(--red-soft); }

/* Views */
.view { display: none; }
.view.active { display: block; animation: fade 0.18s ease; }
/* Animasi hanya menggeser sedikit, TIDAK mengubah opacity: kalau animasi
   tidak sempat jalan (tab latar, renderer lambat, reduced motion) konten
   tetap terbaca 100%. */
@keyframes fade { from { transform: translateY(3px); } to { transform: none; } }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-card {
  position: relative;
  background-color: transparent;
  background-image: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--cyan-dim);
  filter: blur(2px);
}
.stat-icon {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
}
.stat-icon.green { color: var(--green); }
.stat-icon.cyan { color: var(--cyan); }
.stat-icon.violet { color: var(--violet); }
.stat-icon.amber { color: var(--amber); }
.stat-label { color: var(--muted); font-size: 12px; letter-spacing: 0.2px; margin-bottom: 8px; }
.stat-value { font-size: 27px; font-weight: 750; letter-spacing: -0.8px; line-height: 1.15; }
.stat-foot { color: var(--muted-2); font-size: 11.5px; margin-top: 7px; min-height: 16px; }

/* Section / panels */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin: 4px 0 14px;
}
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.3px; }
.section-head p { margin-top: 4px; }
.panel {
  background-color: transparent;
  background-image: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
  flex-wrap: wrap;
}
.panel-head h3 { margin: 0; font-size: 15px; letter-spacing: -0.2px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  white-space: nowrap;
}
.pill.green {
  color: var(--green-soft);
  border-color: var(--green);
  background: var(--green-dim);
}
.pill.cyan {
  color: var(--cyan-soft);
  border-color: var(--cyan);
  background: var(--cyan-dim);
}
.pill.amber {
  color: var(--amber-soft);
  border-color: var(--amber);
  background: var(--amber-dim);
}
.pill.bad {
  color: var(--red-soft);
  border-color: var(--red);
  background: var(--red-dim);
}
.create-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-style: dashed;
  background: var(--green-dim);
}
.create-panel h3 { margin: 0 0 5px; font-size: 15px; }

/* Account cards */
.account-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.account-card {
  background-color: transparent;
  background-image: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease;
}
.account-card:hover { border-color: var(--border); transform: translateY(-2px); }
.account-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.account-card h3 { margin: 0; font-size: 15px; letter-spacing: -0.2px; }
.account-card .sub { color: var(--muted-2); font-size: 11.5px; margin-top: 4px; }
.account-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.badge {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10.5px;
  line-height: 1.5;
}
.badge.green { color: var(--green-soft); border-color: var(--green); background: var(--green-dim); }
.badge.cyan { color: var(--cyan-soft); border-color: var(--cyan); background: var(--cyan-dim); }
.badge.amber { color: var(--amber-soft); border-color: var(--amber); background: var(--amber-dim); }
.badge.red { color: var(--red-soft); border-color: var(--red); background: var(--red-dim); }
.quota { margin-top: 15px; }
.quota-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.quota-row strong { font-size: 17px; letter-spacing: -0.4px; }
.quota-row span { color: var(--muted-2); font-size: 11px; }
.progress {
  height: 7px;
  border-radius: 99px;
  background: var(--surface);
  overflow: hidden;
  margin-top: 8px;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background-color: transparent;
  background-image: linear-gradient(90deg, var(--green), var(--green-2));
  width: 0;
  transition: width 0.4s ease;
}
.quota-hint {
  margin-top: 9px;
  padding: 6px 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  background: var(--surface);
}
.progress.warn > i {
  background-color: transparent;
  background-image: linear-gradient(90deg, var(--amber), #f59e0b);
}
.progress.bad > i {
  background-color: transparent;
  background-image: linear-gradient(90deg, var(--red), #f43f5e);
}
.account-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.meta-label { color: var(--muted-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; }
.meta-value { color: var(--text); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-actions { display: flex; gap: 7px; margin-top: 13px; }
.skeleton-card {
  height: 230px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background-color: transparent;
  background-image: linear-gradient(100deg, var(--panel-2) 20%, var(--panel-3) 40%, var(--panel-2) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.empty-card {
  grid-column: 1 / -1;
  padding: 30px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Errors */
.error-list { display: grid; gap: 8px; }
.error-item {
  border: 1px solid var(--red);
  background: var(--red-dim);
  color: var(--red-soft);
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 12.5px;
}
.error-item strong { color: var(--red-soft); }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.field label { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: 0.2px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 11px;
  outline: none;
  transition: transform 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; min-width: 680px; }
.table.compact { min-width: 520px; }
.table th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  color: var(--muted-2);
  background: var(--surface);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--cyan-dim); }
.table .empty { text-align: center; color: var(--muted-2); padding: 26px 12px; }
.table .name { font-weight: 650; color: var(--text); }
.table .sub { color: var(--muted-2); font-size: 10.5px; margin-top: 2px; }
.table .num { font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Header tabel yang bisa diurutkan */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.th-sort:hover { color: var(--text); }
.th-sort .sort-arrow { font-size: 9px; opacity: 0.4; }
.th-sort.active { color: var(--cyan); }
.th-sort.active .sort-arrow { opacity: 1; }

/* Checkbox baris */
.row-select {
  width: 15px;
  height: 15px;
  min-width: 15px;
  padding: 0;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

/* Paginasi */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--muted);
}
.pager-actions { display: flex; align-items: center; gap: 8px; }
.pager-info { font-variant-numeric: tabular-nums; }
.pager .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Bulk action */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--surface);
}
.bulk-count { color: var(--muted); font-size: 12px; margin-right: auto; }
.bulk-count strong { color: var(--text); }

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
}
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-badge.ok { color: var(--green-soft); border-color: var(--green); background: var(--green-dim); }
.status-badge.warn { color: var(--amber-soft); border-color: var(--amber); background: var(--amber-dim); }
.status-badge.bad { color: var(--red-soft); border-color: var(--red); background: var(--red-dim); }

/* Segmented / chart */
.segmented { display: flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 11px;
  font-size: 12px;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--green-dim); color: var(--green-soft); }
.chart {
  height: 220px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 14px 4px 4px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background-color: transparent;
  background-image: linear-gradient(180deg, var(--cyan-dim), transparent 65%);
  overflow: hidden;
}
.chart-empty { margin: auto; color: var(--muted-2); font-size: 12.5px; }
.bar {
  flex: 1 1 0;
  min-width: 1px;
  max-width: 22px;
  background-color: transparent;
  background-image: linear-gradient(180deg, var(--cyan), var(--cyan-dim));
  border-radius: 3px 3px 1px 1px;
  position: relative;
  min-height: 2px;
  transition: height 0.2s ease, width 0.2s ease;
}
.bar:hover { filter: brightness(1.35); }
.bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--console-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 10px;
  white-space: nowrap;
  z-index: 4;
}

/* Settings */
.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 18px; }
.connection-list { display: grid; gap: 9px; }
.connection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  padding: 11px 12px;
  background: var(--surface);
}
.connection-item .info { min-width: 0; }
.connection-item strong { display: block; font-size: 13px; }
.connection-item .token { color: var(--muted-2); font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; margin-top: 3px; }
.connection-item .actions { display: flex; gap: 6px; }
.kv { display: grid; gap: 7px; }
.kv-row { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); font-size: 12px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row span:first-child { color: var(--muted); }
.kv-row span:last-child { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--text); text-align: right; overflow-wrap: anywhere; max-width: 68%; }
.security-panel { border-color: var(--amber); }
.security-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.75; }
.security-list li + li { margin-top: 4px; }

/* Forms / modal */
.form { display: grid; gap: 13px; }
.hint { color: var(--muted-2); font-size: 11px; }
.form-error {
  border: 1px solid var(--red);
  background: var(--red-dim);
  color: var(--red-soft);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--overlay);
  backdrop-filter: blur(5px);
  padding: 18px;
}
.modal-card {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  background-color: transparent;
  background-image: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
  padding: 20px;
}
.modal-card.wide { width: min(760px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 17px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head p { margin-top: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
}
.detail-item .k { color: var(--muted-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; }
.detail-item .v { margin-top: 4px; font-size: 13px; word-break: break-word; }
.detail-item.full { grid-column: 1 / -1; }

/* Auto-registration */
.reg-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.switch {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: var(--muted) !important;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.switch input {
  width: 15px;
  height: 15px;
  min-width: 15px;
  flex: 0 0 auto;
  accent-color: var(--green);
  cursor: pointer;
}
.reg-block { margin-top: 18px; }
.reg-console {
  margin: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--console-bg);
  color: var(--console-text);
  padding: 12px 13px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.reg-console .reg-bad { color: var(--red-soft); }
.reg-console .reg-good { color: var(--green-soft); }
.reg-console .reg-warn { color: var(--amber-soft); }
.console-sub { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-soft); }
.console-sub:empty { display: none; }

/* Toast */
.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 36px));
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  animation: toast-in 0.2s ease;
}
.toast.bad { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Responsive */
@media (max-width: 1180px) {
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 840px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    position: relative;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .brand { padding-bottom: 14px; }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .nav-item { width: auto; white-space: nowrap; }
  .sidebar-foot { display: none; }
  .main { padding: 20px 16px 46px; }
  .topbar { flex-direction: column; }
  .account-grid { grid-template-columns: 1fr; }
  .create-panel { flex-direction: column; align-items: flex-start; }
  .reg-form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .stat-grid, .stat-grid.three, .stat-grid.five { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 22px; }
  .toolbar { align-items: stretch; }
  .field { min-width: 100%; }
  .toolbar .btn { flex: 1; }
}
