/* ==========================================================================
   Kismet Studio — Customer Platform Stylesheet
   New-API Console Clarity + Pro Cinema 3-Column Workbench
   Strict CSP Compliant · Zero External Assets · Dark-First + Light Theme
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg-app: #0b0e14;
  --bg-sidebar: #10141e;
  --bg-topbar: rgba(16, 20, 30, 0.88);
  --bg-surface: #141925;
  --bg-raised: #1a2131;
  --bg-input: #111622;
  --bg-hover: #212a3d;
  --bg-cinema: #06080c;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-subtle: rgba(255, 255, 255, 0.05);

  --text: #eef2fa;
  --text-secondary: #9aa6bc;
  --text-muted: #68758d;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --accent-border: rgba(99, 102, 241, 0.36);

  --gold: #e4b861;
  --gold-bright: #f2cf83;
  --gold-soft: rgba(228, 184, 97, 0.14);
  --gold-border: rgba(228, 184, 97, 0.5);
  --gold-text: #161108;

  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.13);
  --emerald-border: rgba(52, 211, 153, 0.3);

  --cyan: #38bdf8;
  --cyan-soft: rgba(56, 189, 248, 0.12);
  --cyan-border: rgba(56, 189, 248, 0.28);

  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.13);
  --amber-border: rgba(251, 191, 36, 0.32);

  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.13);
  --red-border: rgba(248, 113, 113, 0.32);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.62);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --sidebar-w: 228px;
  --sidebar-collapsed-w: 68px;
  --topbar-h: 54px;

  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Cascadia Code", monospace;
}

[data-theme="light"] {
  --bg-app: #f4f6fb;
  --bg-sidebar: #ffffff;
  --bg-topbar: rgba(255, 255, 255, 0.9);
  --bg-surface: #ffffff;
  --bg-raised: #f1f4fa;
  --bg-input: #f8fafd;
  --bg-hover: #e9eef7;
  --bg-cinema: #0b0e14;

  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.18);
  --border-subtle: rgba(15, 23, 42, 0.05);

  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #7c8aa0;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --accent-border: rgba(79, 70, 229, 0.32);

  --gold: #c78d24;
  --gold-bright: #d9a032;
  --gold-soft: rgba(199, 141, 36, 0.12);
  --gold-border: rgba(199, 141, 36, 0.48);
  --gold-text: #ffffff;

  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.1);
  --emerald-border: rgba(5, 150, 105, 0.28);

  --cyan: #0284c7;
  --cyan-soft: rgba(2, 132, 199, 0.1);
  --cyan-border: rgba(2, 132, 199, 0.28);

  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.11);
  --amber-border: rgba(217, 119, 6, 0.3);

  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.1);
  --red-border: rgba(220, 38, 38, 0.28);

  --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 54px rgba(15, 23, 42, 0.16);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
img, svg, video { display: block; max-width: 100%; }
code, pre, .mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4, p { margin: 0; }

/* Slim dark-friendly scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.22); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.38); }

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon.sm { width: 14px; height: 14px; }
.icon.lg { width: 20px; height: 20px; }

/* ---------- Boot Screen & Noscript ---------- */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: var(--bg-app);
  color: var(--text-secondary);
}
.boot-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  display: grid;
  place-items: center;
  border: 1px solid var(--accent-border);
}
.boot-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.boot-text { font-size: 13px; color: var(--text-muted); }
.noscript-bar {
  position: fixed;
  inset: 0 0 auto 0;
  padding: 12px;
  background: #b91c1c;
  color: #fff;
  text-align: center;
  font-size: 13px;
  z-index: 999;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-dot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.85); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   App Shell (New-API Fixed Collapsible Sidebar + Slim Top Header)
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-app);
}
.app-shell.sidebar-collapsed {
  --sidebar-w: var(--sidebar-collapsed-w);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 11, 0.64);
  backdrop-filter: blur(3px);
  z-index: 44;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 45;
  transition: width 0.2s ease, transform 0.22s ease;
  overflow: hidden;
}

.sidebar-brand {
  height: var(--topbar-h);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 55%, #3b82f6 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-copy strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-copy small {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-group-label {
  padding: 0 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 11px;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}
[data-theme="light"] .nav-link.active {
  color: var(--accent);
}
.nav-link.active::after {
  content: "";
  position: absolute;
  right: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-hover);
  box-shadow: 0 0 8px var(--accent);
}
.nav-link .nav-badge {
  margin-left: auto;
  margin-right: 4px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.nav-link .nav-badge.live {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-border);
}
.nav-link.active .nav-badge { margin-right: 12px; }
.nav-ext {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
  flex-shrink: 0;
}
.status-dot.warn {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.7);
}
.status-dot.bad {
  background: var(--red);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.7);
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .nav-group-label,
.app-shell.sidebar-collapsed .nav-text,
.app-shell.sidebar-collapsed .nav-badge,
.app-shell.sidebar-collapsed .nav-ext,
.app-shell.sidebar-collapsed .sidebar-status span {
  display: none;
}
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .nav-link { justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .nav-link.active::after { right: 5px; }
.app-shell.sidebar-collapsed .sidebar-status { justify-content: center; padding: 8px 0; }

/* Main area */
.main-shell {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-topbar);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb .bc-sep { opacity: 0.45; }
.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 5px 0 11px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 13px;
}
.balance-pill-val {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.balance-pill-val .icon { color: var(--gold); }
.balance-topup-btn {
  height: 24px;
  padding: 0 10px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--gold) 0%, #d49c3d 100%);
  color: var(--gold-text);
  font-size: 11.5px;
  font-weight: 700;
  transition: filter 0.14s ease, transform 0.1s ease;
}
.balance-topup-btn:hover { filter: brightness(1.08); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px 0 5px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.user-chip:hover {
  border-color: var(--border-strong);
  background: var(--bg-raised);
}
.avatar-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.user-chip-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.icon-btn:hover {
  background: var(--bg-raised);
  color: var(--text);
  border-color: var(--border);
}

/* Main View Container */
.view-host {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
}
.view-host.view-workbench {
  flex: 0 0 calc(100vh - var(--topbar-h));
  max-width: none;
  padding: 0;
  margin: 0;
  height: calc(100vh - var(--topbar-h));
  max-height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Common UI Components (Buttons, Badges, Forms, Tables, Modals, Toasts)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease, transform 0.1s ease;
}
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.28);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 55%, #cf9838 100%);
  color: var(--gold-text);
  box-shadow: 0 4px 18px rgba(228, 184, 97, 0.26);
}
.btn-gold:hover:not(:disabled) { filter: brightness(1.06); }

.btn-ghost {
  background: var(--bg-raised);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-raised);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red-border);
}
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.22); }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; gap: 4px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; border-radius: 10px; }
.btn-full { width: 100%; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.pill.accent { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-border); }
[data-theme="light"] .pill.accent { color: var(--accent); }
.pill.gold { background: var(--gold-soft); color: var(--gold); border-color: var(--gold-border); }
.pill.emerald { background: var(--emerald-soft); color: var(--emerald); border-color: var(--emerald-border); }
.pill.cyan { background: var(--cyan-soft); color: var(--cyan); border-color: var(--cyan-border); }
.pill.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-border); }
.pill.red { background: var(--red-soft); color: var(--red); border-color: var(--red-border); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.completed { background: var(--emerald-soft); color: var(--emerald); border: 1px solid var(--emerald-border); }
.status-badge.active { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.status-badge.failed { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-border); }
.status-badge.neutral { background: var(--bg-raised); color: var(--text-secondary); border: 1px solid var(--border); }

.notice-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
}
.notice-bar.warn { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.notice-bar.error { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.notice-bar.info { background: var(--accent-soft); border-color: var(--accent-border); color: var(--text); }

/* Inputs */
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.form-error { font-size: 12.5px; color: var(--red); margin-top: 8px; min-height: 0; }
.form-error:empty { display: none; }

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Panels & Tables */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.panel-head h2,
.panel-head h3 {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text);
}
.panel-body { padding: 18px; }

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(148, 163, 184, 0.04); }
.data-table .empty-cell {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
}

.amount-pos { color: var(--emerald); font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-neg { color: var(--red); font-weight: 600; font-variant-numeric: tabular-nums; }

.pager-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Empty & Auth Gate */
.empty-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.empty-card h2 { font-size: 17px; font-weight: 650; }
.empty-card p { font-size: 13px; color: var(--text-secondary); max-width: 420px; }

/* Dialog Modal */
dialog.studio-modal {
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--bg-surface);
  color: var(--text);
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.studio-modal.wide { width: min(760px, calc(100vw - 28px)); }
dialog.studio-modal::backdrop {
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(6px);
}
.modal-inner {
  padding: 22px 24px;
  overflow-y: auto;
  max-height: calc(100vh - 40px);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.55; }
.modal-fields { display: flex; flex-direction: column; gap: 13px; }
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}
.modal-footer-line {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}
.link-btn { color: var(--accent-hover); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

.confirm-amount-box {
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  margin-bottom: 14px;
}
.confirm-amount-box small { display: block; font-size: 11.5px; color: var(--text-secondary); }
.confirm-amount-box strong {
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.confirm-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.confirm-kv {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.confirm-kv small { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.confirm-kv strong { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-word; }

.modal-video-player {
  width: 100%;
  max-height: 62vh;
  border-radius: 12px;
  background: #000;
  outline: none;
}

/* Toasts */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  padding: 10px 15px;
  border-radius: 10px;
  background: #171e2d;
  color: #eef2fa;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  max-width: 360px;
  animation: fade-in 0.16s ease;
}
.toast-item.bad {
  background: #2b1318;
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}
.toast-item.good {
  background: #0d2a22;
  border-color: rgba(52, 211, 153, 0.42);
  color: #a7f3d0;
}

/* Compatibility for download.js inline status notice */
.download-status {
  font-size: 11.5px;
  color: var(--emerald);
  margin: 4px 0 0;
}
.download-status.bad { color: var(--red); }

/* ==========================================================================
   VIEW 1: #dashboard (New-API Console Home)
   ========================================================================== */
.console-wrap {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fade-in 0.18s ease;
}

/* Emerald-Teal Gradient Announcement Card */
.announce-banner {
  position: relative;
  border-radius: 16px;
  padding: 20px 24px;
  background:
    radial-gradient(620px 260px at 88% 12%, rgba(45, 212, 191, 0.32), transparent 70%),
    linear-gradient(125deg, #0b2621 0%, #0d4235 52%, #126b53 100%);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #ecfdf5;
  box-shadow: 0 16px 38px -12px rgba(6, 78, 59, 0.45);
}
.announce-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.announce-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.announce-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(52, 211, 153, 0.2);
  border: 1px solid rgba(110, 231, 183, 0.35);
  color: #6ee7b7;
  display: grid;
  place-items: center;
}
.announce-kicker {
  font-size: 11px;
  font-weight: 600;
  color: #6ee7b7;
  letter-spacing: 0.04em;
}
.announce-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}
.announce-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: rgba(236, 253, 245, 0.72);
  transition: background 0.14s ease, color 0.14s ease;
}
.announce-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.announce-body {
  font-size: 13px;
  line-height: 1.72;
  color: rgba(236, 253, 245, 0.9);
  white-space: pre-line;
}
.announce-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.announce-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(6, 28, 22, 0.44);
  border: 1px solid rgba(110, 231, 183, 0.26);
  font-size: 12px;
  color: #d1fae5;
}

.console-feature-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 13px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.console-feature-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.console-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.console-feature-left strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
}
.console-feature-left p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.section-bar h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* 4-Column KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}
.kpi-card:hover { border-color: var(--border-strong); }
.kpi-top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}
.kpi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.kpi-dot.gold { background: var(--gold); }
.kpi-dot.cyan { background: var(--cyan); }
.kpi-dot.emerald { background: var(--emerald); }
.kpi-value {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* 4 Quick-Action Cards */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quick-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 13px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.14s ease;
}
.quick-card:hover {
  border-color: var(--accent-border);
  background: var(--bg-raised);
  transform: translateY(-1px);
}
.quick-card-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.quick-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--accent-hover);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.quick-card:hover .quick-icon {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}
.quick-card strong {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
}
.quick-card small {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.quick-arrow { color: var(--text-muted); flex-shrink: 0; transition: transform 0.14s ease; }
.quick-card:hover .quick-arrow { color: var(--text); transform: translateX(2px); }

/* Recent 6 Tasks Mini-List */
.recent-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s ease;
  width: 100%;
  text-align: left;
}
.recent-row:last-child { border-bottom: none; }
.recent-row:hover { background: var(--bg-raised); }
.recent-prompt {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.recent-cost {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   VIEW 2: #models (Model Plaza)
   ========================================================================== */
.plaza-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-tab {
  height: 33px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: all 0.14s ease;
}
.filter-tab:hover { color: var(--text); border-color: var(--border-strong); }
.filter-tab.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: var(--accent-border);
}
[data-theme="light"] .filter-tab.active { color: var(--accent); }

.plaza-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-box {
  position: relative;
  width: 240px;
}
.search-box .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-box .input {
  height: 34px;
  padding: 0 11px 0 32px;
  font-size: 13px;
}
.view-toggle {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.view-toggle button {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.view-toggle button.active {
  background: var(--bg-raised);
  color: var(--text);
}

.plaza-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.plaza-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.plaza-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.plaza-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.plaza-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.plaza-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.plaza-price small {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.plaza-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.model-id-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 7px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  transition: border-color 0.14s ease, color 0.14s ease;
  align-self: flex-start;
}
.model-id-pill:hover {
  border-color: var(--accent-border);
  color: var(--accent-hover);
}
.model-id-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plaza-specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.plaza-spec-box {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 7px 8px;
}
.plaza-spec-box small {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.plaza-spec-box strong {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plaza-routes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}
.plaza-routes-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.plaza-route-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.route-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: border-color 0.14s ease, color 0.14s ease;
}
.route-chip:hover {
  border-color: var(--accent-border);
  color: var(--text);
}
.route-chip b { color: var(--accent-hover); font-family: var(--font-mono); }

.plaza-telemetry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.telemetry-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sparkbars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}
.sparkbars i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--emerald);
  height: 14px;
}
.sparkbars i.warn { background: var(--amber); height: 10px; }
.sparkbars i.fail { background: var(--red); height: 6px; }
.sparkbars i.muted { background: var(--border-strong); height: 5px; }

.plaza-card-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==========================================================================
   VIEW 3: #create (Koko Pro Cinema 3-Column Workbench)
   ========================================================================== */
.wb-banner-strip {
  padding: 8px 16px;
  background: var(--amber-soft);
  border-bottom: 1px solid var(--amber-border);
  color: var(--amber);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.wb-banner-strip.error {
  background: var(--red-soft);
  border-bottom-color: var(--red-border);
  color: var(--red);
}

.workbench-grid {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 416px minmax(0, 1fr) 296px;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg-app);
}

/* Left Column: Composer */
.wb-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
}
.wb-col-head {
  height: 46px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wb-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.wb-col-sub { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }

.wb-left-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wb-sec {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.wb-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wb-sec-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.wb-sec-label::before {
  content: "";
  width: 3px;
  height: 11px;
  border-radius: 2px;
  background: var(--gold);
}
.wb-sec-meta { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Mini family chips in workbench */
.wb-fam-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.wb-fam-chip {
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: all 0.12s ease;
}
.wb-fam-chip:hover { color: var(--text); border-color: var(--border-strong); }
.wb-fam-chip.active {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: var(--gold-border);
}

/* 2-Column Visual Model Card Grid (Koko Pro style) */
.wb-model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.wb-model-card {
  position: relative;
  text-align: left;
  padding: 10px 10px 9px;
  border-radius: 11px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}
.wb-model-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-raised);
}
.wb-model-card.active {
  border-color: var(--gold);
  background: linear-gradient(160deg, rgba(228, 184, 97, 0.13) 0%, var(--bg-surface) 65%);
  box-shadow: 0 0 0 1px rgba(228, 184, 97, 0.35), 0 6px 20px rgba(0, 0, 0, 0.28);
}
.wmc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.wmc-res {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-model-card.active .wmc-res {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: var(--gold-border);
}
.wmc-price {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wmc-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.28;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wmc-spec {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-secondary);
  padding: 5px 7px;
  border-radius: 7px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}
.wmc-telemetry {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.wmc-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1.5px 5.5px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wmc-tag.cyan { background: var(--cyan-soft); color: var(--cyan); }
.wmc-tag.ok { background: var(--emerald-soft); color: var(--emerald); }
.wmc-tag.warn { background: var(--amber-soft); color: var(--amber); }
.wmc-tag.muted { background: var(--bg-raised); color: var(--text-muted); }
.wmc-id {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dynamic Multi-Route Selector */
.wb-route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 6px;
}
.wb-route-btn {
  text-align: left;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.14s ease;
}
.wb-route-btn:hover { border-color: var(--border-strong); background: var(--bg-raised); }
.wb-route-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.wb-route-btn strong { font-size: 12px; font-weight: 700; color: var(--text); }
.wb-route-btn small { font-size: 10.5px; color: var(--text-secondary); line-height: 1.35; }

/* Prompt Composer */
.wb-prompt-wrap {
  position: relative;
}
.wb-prompt-textarea {
  min-height: 106px;
  max-height: 220px;
  padding: 11px 12px 26px;
  font-size: 13px;
}
.wb-prompt-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}
.idea-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.idea-chip {
  height: 25px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: all 0.12s ease;
}
.idea-chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-raised);
}

/* Reference Media Uploader */
.wb-ref-box {
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.wb-ref-box.drag-over {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.seg-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}
.seg-tab {
  height: 27px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.13s ease;
}
.seg-tab:hover { color: var(--text); }
.seg-tab.active {
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.ref-thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.ref-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-input);
}
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ref-thumb-rm {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(6, 8, 12, 0.78);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.ref-thumb-rm:hover { background: var(--red); }
.ref-frame-tag {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(6, 8, 12, 0.78);
  color: var(--gold);
}
.ref-add-tile {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-input);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  transition: all 0.14s ease;
}
.ref-add-tile:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-soft);
}

.media-btn-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 7px;
}
.media-upload-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: all 0.14s ease;
}
.media-upload-btn:hover:not(:disabled) {
  border-color: var(--accent-border);
  color: var(--text);
  background: var(--bg-raised);
}
.media-upload-btn-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.media-file-list { display: flex; flex-direction: column; gap: 6px; }
.media-file-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.media-file-top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}
.media-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.media-trim-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.media-trim-row input {
  width: 62px;
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ref-limit-note {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
}
.ref-limit-note.invalid {
  color: var(--red);
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
}
.upload-busy-bar {
  font-size: 12px;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 7px;
}
.upload-busy-bar:empty { display: none; }

/* Output Parameters (Aspect Pills + Duration Slider/Stepper) */
.aspect-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.aspect-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.13s ease;
}
.aspect-pill:hover { border-color: var(--border-strong); color: var(--text); }
.aspect-pill.active {
  background: var(--gold-soft);
  border-color: var(--gold-border);
  color: var(--gold);
}
.aspect-box {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  flex-shrink: 0;
}

.duration-box {
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.duration-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.duration-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.step-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  display: grid;
  place-items: center;
}
.step-btn:hover:not(:disabled) { border-color: var(--gold-border); color: var(--gold); }
.duration-val {
  min-width: 48px;
  text-align: center;
  font-size: 14px;
  font-weight: 750;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: var(--bg-raised);
  outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 2px var(--gold-border);
  cursor: pointer;
}
.sec-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.sec-preset {
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.sec-preset:hover { color: var(--text); border-color: var(--border-strong); }
.sec-preset.active {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: var(--gold-border);
}

/* Toggle Switch & Advanced Details */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.switch-row strong { display: block; font-size: 12.5px; color: var(--text); }
.switch-row small { display: block; font-size: 11px; color: var(--text-muted); }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  transition: background 0.16s ease;
  cursor: pointer;
}
.toggle-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: transform 0.16s ease, background 0.16s ease;
}
.toggle-switch input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(15px);
  background: #fff;
}

.adv-details {
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 9px 12px;
}
.adv-details summary {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.adv-details[open] summary { margin-bottom: 8px; color: var(--text); }

/* Sticky Bottom CTA Footer */
.wb-sticky-footer {
  padding: 12px 15px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.wb-cta-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.wb-cta-meta strong {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-cta-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wb-cta-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Center Column: Cinema Preview Monitor */
.wb-center {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-cinema);
  color: #eef2fa;
  border-right: 1px solid var(--border);
}
.wb-hud-top {
  height: 46px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 16, 24, 0.85);
  flex-shrink: 0;
}
.wb-hud-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
  overflow: hidden;
}
.hud-live-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #eef2fa;
  white-space: nowrap;
}
.hud-live-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}
.hud-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wb-hud-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.wb-stage-wrap {
  flex: 1;
  min-height: 0;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(540px 360px at 50% 48%, rgba(228, 184, 97, 0.06), transparent 72%),
    var(--bg-cinema);
}
.wb-monitor {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 14px;
  background: rgba(8, 10, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* Viewfinder corner brackets */
.vf-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: rgba(255, 255, 255, 0.22);
  border-style: solid;
  pointer-events: none;
  z-index: 3;
}
.vf-tl { top: 14px; left: 14px; border-width: 1.5px 0 0 1.5px; }
.vf-tr { top: 14px; right: 14px; border-width: 1.5px 1.5px 0 0; }
.vf-bl { bottom: 14px; left: 14px; border-width: 0 0 1.5px 1.5px; }
.vf-br { bottom: 14px; right: 14px; border-width: 0 1.5px 1.5px 0; }

.wb-monitor video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  outline: none;
  z-index: 2;
}

.stage-idle,
.stage-active {
  position: relative;
  z-index: 2;
  max-width: 480px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.stage-emblem {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(228, 184, 97, 0.2) 0%, rgba(228, 184, 97, 0.05) 70%);
  border: 1px solid rgba(228, 184, 97, 0.4);
  color: var(--gold-bright);
  display: grid;
  place-items: center;
  box-shadow: 0 0 36px rgba(228, 184, 97, 0.16);
}
.stage-idle h2,
.stage-active h2 {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
}
.stage-idle p,
.stage-active p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.6;
}
.stage-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}
.stage-preset-btn {
  height: 32px;
  padding: 0 13px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  font-size: 12.5px;
  font-weight: 550;
  transition: all 0.15s ease;
}
.stage-preset-btn:hover {
  border-color: var(--gold-border);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

/* Progress Ring */
.progress-ring-wrap {
  position: relative;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
}
.progress-ring-svg {
  width: 82px;
  height: 82px;
  transform: rotate(-90deg);
}
.progress-ring-svg.indeterminate { animation: spin 1.6s linear infinite; }
.progress-ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.1); stroke-width: 4.5; }
.progress-ring-fg {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease;
}
.progress-ring-text {
  position: absolute;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.wb-hud-bottom {
  min-height: 50px;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 16, 24, 0.92);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.hud-bottom-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
}
.hud-prompt-preview {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #cbd5e1;
  max-width: 380px;
}

/* Right Column: Real-Time Queue Stream */
.wb-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sidebar);
}
.wb-queue-filters {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.wb-q-filter {
  height: 28px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.13s ease;
}
.wb-q-filter:hover { color: var(--text); background: var(--bg-surface); }
.wb-q-filter.active {
  background: var(--bg-raised);
  color: var(--text);
  border-color: var(--border);
}

.wb-queue-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wb-queue-card {
  text-align: left;
  width: 100%;
  padding: 10px 11px;
  border-radius: 11px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.wb-queue-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-raised);
}
.wb-queue-card.active {
  border-color: var(--gold);
  background: linear-gradient(155deg, rgba(228, 184, 97, 0.11) 0%, var(--bg-surface) 75%);
}
.wqc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.wqc-model {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wqc-prompt {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wqc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.wb-queue-empty {
  margin: auto 0;
  padding: 28px 14px;
  text-align: center;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.wb-queue-empty strong { font-size: 13px; color: var(--text-secondary); }
.wb-queue-empty p { font-size: 11.5px; line-height: 1.55; }

/* ==========================================================================
   VIEW 4: #gallery (Task Records)
   ========================================================================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.gallery-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.14s ease;
}
.gallery-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.gallery-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(145deg, #0d121c 0%, #151d2e 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.gallery-thumb video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  pointer-events: none;
}
.gallery-thumb-top {
  position: absolute;
  inset: 10px 10px auto 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  z-index: 2;
}
.gallery-play-btn {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(11, 14, 20, 0.78);
  border: 1px solid rgba(228, 184, 97, 0.55);
  color: var(--gold-bright);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.gallery-play-btn:hover {
  transform: scale(1.07);
  background: var(--gold);
  color: var(--gold-text);
}
.gallery-state-icon {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.gallery-body {
  padding: 13px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}
.gallery-prompt {
  font-size: 13px;
  color: var(--text);
  line-height: 1.48;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}
.gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.gallery-error {
  font-size: 11.5px;
  color: var(--red);
  line-height: 1.4;
}
.gallery-actions {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.gallery-actions .spacer { flex: 1; }

/* ==========================================================================
   VIEW 5: #wallet (Recharge, Voucher, Payments, Ledger)
   ========================================================================== */
.wallet-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.wallet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.pay-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.quick-amount-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}
.voucher-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.voucher-row .input {
  flex: 1;
  min-width: 180px;
  text-transform: uppercase;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.account-badge-box {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.wallet-tables {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ==========================================================================
   VIEW 6: #keys (API Keys & Quick Connect)
   ========================================================================== */
.keys-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.code-snippet-box {
  background: #090c12;
  color: #dbe6f5;
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}
.code-snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.code-tabs { display: flex; gap: 5px; }
.code-tab {
  height: 25px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
}
.code-tab.active { background: rgba(99, 102, 241, 0.22); color: #c7d2fe; }
.code-snippet-pre {
  margin: 0;
  padding: 13px 14px;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  color: #e2e8f0;
}

.key-bindings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.key-binding-item {
  padding: 10px 11px;
  border-radius: 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.key-binding-item label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.key-binding-item code { font-size: 11px; color: var(--text-muted); }

/* ==========================================================================
   VIEW 7: #account (Account & Security)
   ========================================================================== */
.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  max-width: 960px;
}
.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.profile-kv-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
}
.profile-kv span { color: var(--text-muted); }
.profile-kv strong { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1260px) {
  .workbench-grid {
    grid-template-columns: 396px minmax(0, 1fr);
    grid-template-rows: minmax(520px, 1fr) auto;
    height: auto;
  }
  .view-host.view-workbench {
    flex: 1 0 auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .wb-left { max-height: calc(100vh - var(--topbar-h)); }
  .wb-center { min-height: 540px; border-right: none; }
  .wb-right {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
  }
  .wb-queue-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    max-height: 360px;
  }
}

@media (max-width: 1060px) {
  .kpi-grid,
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .wallet-grid,
  .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .sidebar {
    width: 248px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .app-shell.mobile-open .sidebar { transform: translateX(0); }
  .app-shell.mobile-open .sidebar-backdrop { display: block; }
  .app-shell.sidebar-collapsed .brand-copy,
  .app-shell.sidebar-collapsed .nav-group-label,
  .app-shell.sidebar-collapsed .nav-text,
  .app-shell.sidebar-collapsed .nav-badge,
  .app-shell.sidebar-collapsed .nav-ext,
  .app-shell.sidebar-collapsed .sidebar-status span {
    display: initial;
  }
  .app-shell.sidebar-collapsed .sidebar-brand { justify-content: flex-start; padding: 0 14px; }
  .app-shell.sidebar-collapsed .nav-link { justify-content: flex-start; padding: 0 11px; }
  .main-shell { margin-left: 0; }
  .view-host { padding: 18px 16px 32px; }
  .workbench-grid { grid-template-columns: 1fr; }
  .wb-left { max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .wb-center { min-height: 400px; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .breadcrumb span:first-child,
  .breadcrumb .bc-sep { display: none; }
  .user-chip-name { display: none; }
  .kpi-grid,
  .quick-grid,
  .wallet-stats,
  .pay-fields-grid,
  .confirm-kv-grid {
    grid-template-columns: 1fr;
  }
  .wb-model-grid { grid-template-columns: 1fr; }
  .plaza-grid { grid-template-columns: 1fr; }
  .search-box { width: 100%; }
  .plaza-controls { width: 100%; }
  .ref-thumb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Support Ticket Service (#tickets) ---------- */
@keyframes ticket-badge-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

#nav-tickets-badge:not(:empty):not([hidden]),
#tb-ticket-badge:not(:empty):not([hidden]),
[data-nav-badge="tickets"]:not(:empty):not([hidden]) {
  animation: ticket-badge-pulse 2s ease-in-out infinite;
}

#tickets .grid-1-2,
#view-tickets .grid-1-2,
[data-view="tickets"] .grid-1-2,
.grid-1-2 {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
  gap: 16px;
}

@media (max-width: 960px) {
  #tickets .grid-1-2,
  #view-tickets .grid-1-2,
  [data-view="tickets"] .grid-1-2,
  .grid-1-2 {
    grid-template-columns: 1fr !important;
  }
}
