/* ==========================================================================
   Hark Studio Console — Optical Liquid Glass Design System
   Dark & Light dual-calibrated frosted glass + cursor-tracking specular sheen
   ========================================================================== */

:root {
  color-scheme: light;
  font: 14px/1.52 "Segoe UI Variable Text", -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  /* Light Theme — Crystal Daylight Porcelain Glass */
  --bg-base: #e9eff8;
  --bg-orb-a: rgba(96, 165, 250, 0.34);
  --bg-orb-b: rgba(129, 140, 248, 0.24);
  --bg-orb-c: rgba(45, 212, 191, 0.22);
  --grid-line: rgba(15, 23, 42, 0.042);
  --cursor-aura: radial-gradient(560px circle at var(--page-x, 50%) var(--page-y, 20%), rgba(255, 255, 255, 0.65), rgba(147, 197, 253, 0.22) 38%, transparent 70%);

  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --focus: #3b82f6;

  /* Glass Surfaces (Light) */
  --glass-bg: linear-gradient(155deg, rgba(255, 255, 255, 0.78), rgba(246, 250, 255, 0.62));
  --glass-bg-strong: linear-gradient(155deg, rgba(255, 255, 255, 0.88), rgba(248, 251, 255, 0.74));
  --glass-card-bg: linear-gradient(152deg, rgba(255, 255, 255, 0.74), rgba(243, 248, 255, 0.54));
  --glass-card-selected: linear-gradient(152deg, rgba(239, 246, 255, 0.92), rgba(219, 234, 254, 0.76));
  --glass-well: rgba(15, 23, 42, 0.036);
  --glass-well-strong: rgba(15, 23, 42, 0.06);
  --glass-input: rgba(255, 255, 255, 0.78);
  --glass-input-focus: rgba(255, 255, 255, 0.96);
  --glass-border: rgba(148, 163, 184, 0.34);
  --glass-border-strong: rgba(100, 116, 139, 0.42);
  --glass-line: rgba(15, 23, 42, 0.085);
  --glass-top-glint: rgba(255, 255, 255, 0.96);
  --glass-menu: rgba(255, 255, 255, 0.92);
  --glass-menu-hover: rgba(37, 99, 235, 0.10);
  --opaque: #ffffff;

  /* Cursor-Tracking Glass Illumination (Light) */
  --glass-spot-core: rgba(255, 255, 255, 0.92);
  --glass-spot-mid: rgba(186, 224, 255, 0.34);
  --glass-rim-core: rgba(59, 130, 246, 0.78);
  --glass-rim-mid: rgba(147, 197, 253, 0.45);
  --btn-spot-core: rgba(255, 255, 255, 0.56);
  --btn-spot-mid: rgba(191, 219, 254, 0.22);

  /* Elevations */
  --shadow-panel: 0 18px 48px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04), inset 0 1px 0 var(--glass-top-glint);
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.055), 0 1px 3px rgba(15, 23, 42, 0.03), inset 0 1px 0 var(--glass-top-glint);
  --shadow-card-hover: 0 16px 36px rgba(37, 99, 235, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06), inset 0 1px 0 #ffffff;
  --shadow-dock: 0 22px 54px rgba(15, 23, 42, 0.18), 0 4px 14px rgba(15, 23, 42, 0.08), inset 0 1px 0 #ffffff;

  /* Buttons (Light) — Smoked Obsidian Optical Glass Primary */
  --btn-primary-bg: linear-gradient(152deg, rgba(28, 35, 50, 0.94), rgba(12, 16, 26, 0.92));
  --btn-primary-hover: linear-gradient(152deg, rgba(38, 47, 66, 0.96), rgba(18, 24, 38, 0.95));
  --btn-primary-ink: #f8fafc;
  --btn-primary-border: rgba(255, 255, 255, 0.22);
  --btn-primary-shadow: 0 10px 26px rgba(15, 23, 42, 0.22), 0 2px 6px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.30);

  --btn-sec-bg: linear-gradient(155deg, rgba(255, 255, 255, 0.85), rgba(241, 245, 249, 0.7));
  --btn-sec-hover: linear-gradient(155deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.88));
  --btn-sec-ink: #0f172a;

  /* Semantic Status Palette (Light) */
  --ready-ink: #047857;
  --ready-bg: rgba(16, 185, 129, 0.14);
  --ready-border: rgba(16, 185, 129, 0.30);

  --attention-ink: #b45309;
  --attention-bg: rgba(245, 158, 11, 0.15);
  --attention-border: rgba(245, 158, 11, 0.34);

  --paused-ink: #475569;
  --paused-bg: rgba(100, 116, 139, 0.14);
  --paused-border: rgba(100, 116, 139, 0.28);

  --stopped-ink: #be123c;
  --stopped-bg: rgba(244, 63, 94, 0.13);
  --stopped-border: rgba(244, 63, 94, 0.30);

  --info-bg: rgba(37, 99, 235, 0.08);
  --info-border: rgba(37, 99, 235, 0.24);
  --danger: #be123c;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --danger-border: rgba(244, 63, 94, 0.32);

  --code-bg: rgba(15, 23, 42, 0.92);
  --code-ink: #e2e8f0;
  --backdrop-modal: rgba(15, 23, 42, 0.42);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  /* Dark Theme — Smoked Obsidian Optical Glass */
  --bg-base: #070a11;
  --bg-orb-a: rgba(56, 189, 248, 0.15);
  --bg-orb-b: rgba(129, 140, 248, 0.14);
  --bg-orb-c: rgba(45, 212, 191, 0.09);
  --grid-line: rgba(255, 255, 255, 0.032);
  --cursor-aura: radial-gradient(600px circle at var(--page-x, 50%) var(--page-y, 20%), rgba(125, 211, 252, 0.11), rgba(129, 140, 248, 0.05) 38%, transparent 72%);

  --ink: #f1f5f9;
  --ink-soft: #cbd5e1;
  --muted: #8b9bb4;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.16);
  --focus: #93c5fd;

  /* Glass Surfaces (Dark) */
  --glass-bg: linear-gradient(155deg, rgba(24, 31, 46, 0.70), rgba(12, 16, 26, 0.74));
  --glass-bg-strong: linear-gradient(155deg, rgba(30, 38, 56, 0.84), rgba(15, 20, 32, 0.88));
  --glass-card-bg: linear-gradient(152deg, rgba(28, 36, 54, 0.62), rgba(14, 19, 30, 0.68));
  --glass-card-selected: linear-gradient(152deg, rgba(37, 66, 114, 0.48), rgba(20, 34, 62, 0.66));
  --glass-well: rgba(255, 255, 255, 0.042);
  --glass-well-strong: rgba(255, 255, 255, 0.075);
  --glass-input: rgba(8, 12, 20, 0.56);
  --glass-input-focus: rgba(10, 15, 26, 0.82);
  --glass-border: rgba(255, 255, 255, 0.11);
  --glass-border-strong: rgba(255, 255, 255, 0.22);
  --glass-line: rgba(255, 255, 255, 0.085);
  --glass-top-glint: rgba(255, 255, 255, 0.16);
  --glass-menu: rgba(18, 24, 37, 0.94);
  --glass-menu-hover: rgba(147, 197, 253, 0.14);
  --opaque: #141a26;

  /* Cursor-Tracking Glass Illumination (Dark) */
  --glass-spot-core: rgba(255, 255, 255, 0.24);
  --glass-spot-mid: rgba(147, 197, 253, 0.12);
  --glass-rim-core: rgba(255, 255, 255, 0.88);
  --glass-rim-mid: rgba(125, 211, 252, 0.48);
  --btn-spot-core: rgba(255, 255, 255, 0.48);
  --btn-spot-mid: rgba(186, 230, 253, 0.20);

  /* Elevations */
  --shadow-panel: 0 24px 64px rgba(0, 0, 0, 0.52), 0 4px 16px rgba(0, 0, 0, 0.32), inset 0 1px 0 var(--glass-top-glint);
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.36), 0 2px 6px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --shadow-card-hover: 0 18px 42px rgba(0, 0, 0, 0.48), 0 0 28px rgba(96, 165, 250, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  --shadow-dock: 0 26px 64px rgba(0, 0, 0, 0.65), 0 0 24px rgba(96, 165, 250, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.22);

  /* Buttons (Dark) — Liquid Platinum Pearl Glass Primary */
  --btn-primary-bg: linear-gradient(152deg, rgba(255, 255, 255, 0.95), rgba(226, 232, 240, 0.85));
  --btn-primary-hover: linear-gradient(152deg, #ffffff, rgba(241, 245, 249, 0.95));
  --btn-primary-ink: #090e1a;
  --btn-primary-border: rgba(255, 255, 255, 0.82);
  --btn-primary-shadow: 0 10px 28px rgba(255, 255, 255, 0.14), 0 2px 10px rgba(0, 0, 0, 0.42), inset 0 1px 0 #ffffff;

  --btn-sec-bg: linear-gradient(155deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  --btn-sec-hover: linear-gradient(155deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.07));
  --btn-sec-ink: #f1f5f9;

  /* Semantic Status Palette (Dark) */
  --ready-ink: #6ee7b7;
  --ready-bg: rgba(16, 185, 129, 0.16);
  --ready-border: rgba(52, 211, 153, 0.34);

  --attention-ink: #fcd34d;
  --attention-bg: rgba(245, 158, 11, 0.16);
  --attention-border: rgba(251, 191, 36, 0.34);

  --paused-ink: #cbd5e1;
  --paused-bg: rgba(148, 163, 184, 0.15);
  --paused-border: rgba(148, 163, 184, 0.28);

  --stopped-ink: #fda4af;
  --stopped-bg: rgba(244, 63, 94, 0.17);
  --stopped-border: rgba(251, 113, 133, 0.34);

  --info-bg: rgba(96, 165, 250, 0.12);
  --info-border: rgba(96, 165, 250, 0.30);
  --danger: #fda4af;
  --danger-bg: rgba(244, 63, 94, 0.16);
  --danger-border: rgba(251, 113, 133, 0.36);

  --code-bg: rgba(5, 8, 15, 0.78);
  --code-ink: #e2e8f0;
  --backdrop-modal: rgba(3, 6, 14, 0.68);
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}

html, body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, dt, ul, pre { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, input, select { touch-action: manipulation; }

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

.icon-svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: block;
}

.flex-1 { flex: 1; min-width: 0; }

/* ==========================================================================
   ATMOSPHERIC LIQUID-GLASS CANVAS
   ========================================================================== */
.ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(88px);
  will-change: transform;
}

.orb-a {
  top: -14%;
  left: -8%;
  width: min(62vw, 720px);
  height: min(62vw, 720px);
  background: radial-gradient(circle, var(--bg-orb-a) 0%, transparent 70%);
  animation: orbDriftA 22s ease-in-out infinite alternate;
}

.orb-b {
  right: -10%;
  bottom: -18%;
  width: min(58vw, 680px);
  height: min(58vw, 680px);
  background: radial-gradient(circle, var(--bg-orb-b) 0%, transparent 70%);
  animation: orbDriftB 26s ease-in-out infinite alternate;
}

.orb-c {
  top: 32%;
  left: 44%;
  width: min(44vw, 520px);
  height: min(44vw, 520px);
  background: radial-gradient(circle, var(--bg-orb-c) 0%, transparent 72%);
  animation: orbDriftC 30s ease-in-out infinite alternate;
}

.ambient-grid {
  display: none;
}

.ambient-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.ambient-fx[hidden] {
  display: none;
}

.cursor-aura {
  position: absolute;
  inset: 0;
  background: var(--cursor-aura);
  opacity: var(--aura-op, 0);
  transition: opacity 0.45s ease;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  transition: opacity 0.14s ease;
}
body.lang-transitioning .app-shell {
  opacity: 0.88;
}

/* Sleek Custom Frosted Scrollbars (no chunky native gray bars) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.32) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.30);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.52);
}

/* ==========================================================================
   OPTICAL LIQUID GLASS & CURSOR-TRACKING SPECULAR ILLUMINATION ENGINE
   ========================================================================== */
.glass-panel {
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  background: var(--glass-bg);
  box-shadow: var(--shadow-panel);
  -webkit-backdrop-filter: blur(26px) saturate(185%);
  backdrop-filter: blur(26px) saturate(185%);
}

.glass-fx {
  position: relative;
  isolation: isolate;
  --gx: 50%;
  --gy: 0%;
  --g-op: 0;
  --g-rim: 0;
}

/* Keep direct visible content cleanly above specular surface sheen */
.glass-fx > :not(.account-hit):not(.sr-only):not([hidden]) {
  position: relative;
  z-index: 1;
}

/* Layer 1: Glossy Specular Surface Reflection following mouse */
.glass-fx::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: var(--g-op);
  background:
    radial-gradient(300px circle at var(--gx) var(--gy), var(--glass-spot-core), var(--glass-spot-mid) 36%, transparent 72%),
    linear-gradient(125deg, rgba(255, 255, 255, 0.08) 0%, transparent 45%);
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Layer 2: Refracted Crystal Luminous Rim Light along border near mouse */
.glass-fx::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 4;
  padding: 1.4px;
  border-radius: inherit;
  pointer-events: none;
  opacity: var(--g-rim);
  background: radial-gradient(220px circle at var(--gx) var(--gy), var(--glass-rim-core), var(--glass-rim-mid) 38%, transparent 74%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Tighter specular spot on smaller buttons & pills */
button.glass-fx::before {
  background: radial-gradient(150px circle at var(--gx) var(--gy), var(--btn-spot-core), var(--btn-spot-mid) 44%, transparent 76%);
}
button.glass-fx::after {
  background: radial-gradient(120px circle at var(--gx) var(--gy), var(--glass-rim-core), var(--glass-rim-mid) 42%, transparent 78%);
}
/* Prismatic optical crystal sweep on liquid-platinum primary buttons (Dark) */
:root[data-theme="dark"] .btn-glass-primary.glass-fx::before {
  background: radial-gradient(170px circle at var(--gx) var(--gy), rgba(255, 255, 255, 0.98), rgba(186, 230, 253, 0.42) 45%, transparent 78%);
}
:root[data-theme="dark"] .btn-glass-primary.glass-fx::after {
  background: radial-gradient(150px circle at var(--gx) var(--gy), #ffffff, rgba(147, 197, 253, 0.65) 44%, transparent 78%);
}

/* ==========================================================================
   BUTTONS, INPUTS & CONTROLS
   ========================================================================== */
button {
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.16s ease, opacity 0.16s ease;
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none !important;
}

.btn-glass-primary {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--btn-primary-border);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
  box-shadow: var(--btn-primary-shadow);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.btn-glass-primary:hover:not(:disabled) {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
}
.btn-glass-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

.btn-glass-secondary {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--btn-sec-bg);
  color: var(--btn-sec-ink);
  box-shadow: inset 0 1px 0 var(--glass-top-glint);
}
.btn-glass-secondary:hover:not(:disabled) {
  background: var(--btn-sec-hover);
  border-color: var(--glass-border-strong);
  transform: translateY(-1px);
}
.btn-glass-secondary:active:not(:disabled) { transform: scale(0.985); }

.btn-glass-accent {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--accent);
}
.btn-glass-accent:hover:not(:disabled) {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.btn-glass-subtle {
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 560;
}
.btn-glass-subtle:hover:not(:disabled) {
  background: var(--glass-well-strong);
  color: var(--ink);
  border-color: var(--glass-border-strong);
}

.btn-glass-ghost {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 580;
}
.btn-glass-ghost:hover:not(:disabled) {
  background: var(--glass-well-strong);
  color: var(--ink);
}

.btn-glass-danger {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 650;
}
.btn-glass-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.26);
  transform: translateY(-1px);
}

.danger-hover:hover:not(:disabled) {
  color: var(--danger) !important;
  border-color: var(--danger-border) !important;
  background: var(--danger-bg) !important;
}

.icon-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 0 9px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--btn-sec-bg);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: inset 0 1px 0 var(--glass-top-glint);
}
.icon-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--glass-border-strong);
  background: var(--btn-sec-hover);
}

.fx-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--btn-sec-bg);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-top-glint);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.fx-mode-btn .fx-icon {
  width: 15px;
  height: 15px;
  color: var(--accent, #38bdf8);
  transition: color 160ms ease, opacity 160ms ease;
}
.fx-mode-btn[data-fx-mode="ferro"] .fx-icon {
  color: #34d399;
}
.fx-mode-btn[data-fx-mode="off"] {
  color: var(--muted);
}
.fx-mode-btn[data-fx-mode="off"] .fx-icon {
  color: var(--muted);
  opacity: 0.6;
}
.fx-mode-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--glass-border-strong);
  background: var(--btn-sec-hover);
}
@media (max-width: 640px) {
  .fx-mode-btn [data-fx-label] {
    display: none;
  }
  .fx-mode-btn {
    padding: 0 9px;
  }
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  color: var(--muted);
}
.icon-btn-sm:hover:not(:disabled), .icon-btn-sm.is-active {
  color: var(--ink);
  background: var(--btn-sec-hover);
  border-color: var(--glass-border-strong);
}

/* Theme Icon Swap */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }

/* Eye Icon Swap */
.icon-eye-closed { display: none; }
.secret-toggle[aria-pressed="true"] .icon-eye-open { display: none; }
.secret-toggle[aria-pressed="true"] .icon-eye-closed { display: block; }

/* Glass Inputs */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.glass-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-input);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.2s ease, background 0.18s ease;
}
.glass-input-wrap:hover {
  border-color: var(--glass-border-strong);
}
.glass-input-wrap:focus-within {
  border-color: var(--focus);
  background: var(--glass-input-focus);
  box-shadow: 0 0 0 3.5px var(--accent-soft), inset 0 1px 0 var(--glass-top-glint);
}
.glass-input-wrap:has(input[aria-invalid="true"]) {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

.glass-input-wrap input,
.glass-input-wrap textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  padding: 10px 13px;
  font-size: 13.5px;
}
.glass-input-wrap input::placeholder,
.glass-input-wrap textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.input-lead-icon {
  display: grid;
  place-items: center;
  padding-inline-start: 12px;
  color: var(--muted);
  pointer-events: none;
}
.input-lead-icon + input {
  padding-inline-start: 9px;
}

.input-trailing {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-inline-end: 6px;
}

.input-icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  color: var(--muted);
}
.input-icon-btn:hover:not(:disabled) {
  color: var(--ink);
  background: var(--glass-well-strong);
}

/* Custom Switch */
.glass-check-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.glass-check-row:hover {
  background: var(--glass-well-strong);
  border-color: var(--glass-border);
}
.glass-check-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.glass-switch, .glass-switch-sm {
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-well-strong);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.glass-switch { width: 38px; height: 22px; }
.glass-switch-sm { width: 32px; height: 18px; }
.glass-switch::after, .glass-switch-sm::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: var(--ink-soft);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease;
}
.glass-switch::after { width: 16px; height: 16px; }
.glass-switch-sm::after { width: 12px; height: 12px; }

input:checked + .glass-switch,
input:checked + .glass-switch-sm {
  background: var(--accent);
  border-color: transparent;
}
input:checked + .glass-switch::after {
  transform: translateX(16px);
  background: #ffffff;
}
input:checked + .glass-switch-sm::after {
  transform: translateX(14px);
  background: #ffffff;
}
input:focus-visible + .glass-switch,
input:focus-visible + .glass-switch-sm {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.check-label-text {
  display: grid;
  gap: 1px;
}
.check-label-text strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.check-label-text small {
  font-size: 11.5px;
  font-weight: 450;
  color: var(--muted);
}

/* Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 9.5px;
  border-radius: 999px;
  border: 1px solid var(--paused-border);
  background: var(--paused-bg);
  color: var(--paused-ink);
  font-size: 11.5px;
  font-weight: 640;
  line-height: 1.25;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.status-pill.ready, .status-pill[data-tone="ready"] {
  border-color: var(--ready-border);
  background: var(--ready-bg);
  color: var(--ready-ink);
}
.status-pill.attention, .status-pill[data-tone="attention"] {
  border-color: var(--attention-border);
  background: var(--attention-bg);
  color: var(--attention-ink);
}
.status-pill.paused, .status-pill[data-tone="paused"] {
  border-color: var(--paused-border);
  background: var(--paused-bg);
  color: var(--paused-ink);
}
.status-pill.stopped, .status-pill[data-tone="stopped"] {
  border-color: var(--stopped-border);
  background: var(--stopped-bg);
  color: var(--stopped-ink);
}

.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.count-pill.tone-ready {
  border-color: var(--ready-border);
  background: var(--ready-bg);
  color: var(--ready-ink);
}
.selection-pill {
  border-color: var(--info-border);
  background: var(--info-bg);
  color: var(--accent);
}

/* ==========================================================================
   BRAND LOCKUP & LOGIN GATE STAGE
   ========================================================================== */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-card-bg);
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--glass-top-glint), 0 4px 12px rgba(0, 0, 0, 0.12);
}
.brand-mark svg { width: 21px; height: 21px; overflow: visible; }

/* Animated Dynamic Hark Pool Acoustic-Beam Logo */
.hark-logo-anim .hark-horn-core {
  transform-box: fill-box;
  transform-origin: left center;
  animation: harkCoreBreathe 3.2s ease-in-out infinite;
}
.hark-logo-anim .hark-wave {
  transform-box: fill-box;
  transform-origin: left center;
  opacity: 0;
}
.hark-logo-anim .hark-wave-1 {
  animation: harkWavePulse 2.8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.hark-logo-anim .hark-wave-2 {
  animation: harkWavePulse 2.8s cubic-bezier(0.22, 1, 0.36, 1) 0.55s infinite;
}
.brand-lockup:hover .hark-logo-anim .hark-horn-core,
.brand-emblem-lg:hover .hark-horn-core {
  filter: drop-shadow(0 0 8px rgba(147, 197, 253, 0.55));
}

.brand-name {
  font-size: 16.5px;
  font-weight: 740;
  letter-spacing: -0.025em;
}

.brand-pill {
  padding: 2.5px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  color: var(--muted);
  font-size: 11px;
  font-weight: 640;
  letter-spacing: 0.02em;
}

.gate-stage {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: min(1160px, calc(100% - 40px));
  margin-inline: auto;
  padding: 22px 0 36px;
}

.gate-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar-utility, .utility-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 580;
  font-variant-numeric: tabular-nums;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 var(--glass-top-glint);
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
}
.health-pill.is-online .pulse-dot {
  background: #10b981;
  animation: pulseRing 2.4s ease-out infinite;
}
.health-pill.is-offline .pulse-dot {
  background: #f43f5e;
}

.gate-center {
  flex: 1;
  display: grid;
  place-items: center;
  padding-block: 24px 12px;
}

.gate-shell {
  width: min(920px, 100%);
  min-height: 552px;
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  align-items: stretch;
  border-radius: 28px;
  background: var(--glass-bg-strong);
  animation: panelRise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Left Showcase Column */
.gate-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(32px, 4.2vw, 44px) clamp(28px, 3.6vw, 40px);
  border-inline-end: 1px solid var(--glass-line);
  gap: 24px;
}

.showcase-glow {
  position: absolute;
  top: -30px;
  left: -30px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.22), transparent 72%);
  filter: blur(24px);
  pointer-events: none;
  z-index: 0 !important;
}

.showcase-head {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 48px;
}

.brand-emblem-lg {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-card-bg);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  flex: 0 0 auto;
}
.brand-emblem-lg svg { width: 28px; height: 28px; }

.showcase-brand-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.showcase-brand-title {
  font-size: 18px;
  font-weight: 760;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.eyebrow-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
}

.gate-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gate-metric-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 22px 16px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: var(--glass-card-bg);
  box-shadow: var(--shadow-card);
}
.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.metric-val {
  font-size: 27px;
  font-weight: 760;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.18;
}
.metric-sub {
  font-size: 11.4px;
  color: var(--muted);
}

.gate-protocols {
  display: grid;
  gap: 10px;
}

.protocol-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 13px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  transition: transform 0.18s ease, border-color 0.2s ease, background 0.2s ease;
}
.protocol-chip:hover {
  transform: translateX(3px);
  background: var(--glass-well-strong);
  border-color: var(--glass-border);
}
.protocol-chip strong {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.25;
}
.protocol-chip span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.proto-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.proto-openai { background: #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.6); }
.proto-responses { background: #38bdf8; box-shadow: 0 0 10px rgba(56, 189, 248, 0.6); }
.proto-anthropic { background: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }

.gate-footnote {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-line);
  color: var(--muted);
  font-size: 11.8px;
}

/* Right Auth Column */
.gate-auth {
  display: flex;
  flex-direction: column;
  padding: clamp(32px, 4.2vw, 44px) clamp(28px, 3.6vw, 40px);
  gap: 24px;
}

.gate-mode-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
}

.mode-tab-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 10px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-card-bg);
  box-shadow: var(--shadow-card);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.gate-mode-tabs.is-client .mode-tab-slider {
  transform: translateX(100%);
}

.mode-tab {
  position: relative;
  z-index: 1;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.8px;
  font-weight: 620;
  transition: color 0.2s ease;
}
.mode-tab:hover:not(.is-active) {
  color: var(--ink-soft);
}
.mode-tab.is-active {
  color: var(--ink);
}

.auth-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.2s ease both;
}

.auth-header h2 {
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.28;
}
.auth-header p {
  margin-top: 6px;
  min-height: 24px;
  color: var(--muted);
  font-size: 13.2px;
  line-height: 1.56;
}

.gate-auth .glass-input-wrap input {
  min-height: 48px;
  font-size: 14px;
}

.gate-auth .glass-check-row {
  padding: 13px 15px;
}

.login-submit {
  margin-top: 18px;
  min-height: 48px;
  width: 100%;
  font-size: 14.2px;
  border-radius: 13px;
}

.auth-footer-strip {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-line);
}

.auth-cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.6px;
  font-weight: 560;
  white-space: nowrap;
}

.cap-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.cap-emerald { background: #10b981; box-shadow: 0 0 7px rgba(16, 185, 129, 0.55); }
.cap-sky { background: #38bdf8; box-shadow: 0 0 7px rgba(56, 189, 248, 0.55); }
.cap-amber { background: #f59e0b; box-shadow: 0 0 7px rgba(245, 158, 11, 0.55); }
.login-submit .btn-arrow {
  transition: transform 0.2s ease;
}
.login-submit:hover:not(:disabled) .btn-arrow {
  transform: translateX(3px);
}

.btn-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin360 0.75s linear infinite;
}
.is-loading .btn-spinner { display: inline-block; }
.is-loading .btn-arrow { display: none; }

.form-error {
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12.8px;
  font-weight: 560;
  overflow-wrap: anywhere;
  animation: shakeX 0.34s ease;
}

/* ==========================================================================
   AUTHENTICATED WORKSPACE & STICKY GLASS TOPBAR
   ========================================================================== */
.workspace-shell {
  width: min(1280px, calc(100% - 40px));
  margin-inline: auto;
  padding: 18px 0 118px;
  display: grid;
  gap: 20px;
}

/* Fixed Viewport Mode for Playground — ZERO outer page scrollbar */
body.is-playground-page {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}
.workspace-shell.is-playground-view {
  height: 100vh;
  height: 100dvh;
  padding: 14px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.workspace-shell.is-playground-view .topbar {
  position: relative;
  top: 0;
  flex: 0 0 auto;
}
.workspace-shell.is-playground-view .workspace-main {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.workspace-shell.is-playground-view .playground-pane {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Fixed Viewport Mode for Admin Pool Overview — symmetric 14px top & bottom margins */
@media (min-width: 901px) {
  body.is-overview-page {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
  }
  .workspace-shell.is-overview-view {
    height: 100vh;
    height: 100dvh;
    padding: 14px 0 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
  }
  .workspace-shell.is-overview-view .topbar {
    position: relative;
    top: 0;
    flex: 0 0 auto;
  }
  .workspace-shell.is-overview-view .workspace-main,
  .workspace-shell.is-overview-view #view-overview:not([hidden]) {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .workspace-shell.is-overview-view .kpi-grid {
    flex: 0 0 auto;
  }
  .workspace-shell.is-overview-view .accounts-panel {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 14px;
    gap: 12px;
  }
  .workspace-shell.is-overview-view .accounts-head,
  .workspace-shell.is-overview-view .accounts-toolbar,
  .workspace-shell.is-overview-view .account-feedback {
    flex: 0 0 auto;
  }
  .workspace-shell.is-overview-view .account-viewport {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .workspace-shell.is-overview-view .account-scroll {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    padding: 4px 8px 18px 2px;
  }
  .workspace-shell.is-overview-view:has(#batch:not([hidden])) .account-scroll {
    padding-bottom: 76px;
  }
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  border-radius: 18px;
  background: var(--glass-bg-strong);
}

.topbar-left { display: flex; align-items: center; min-width: 0; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }

.topbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
}

.nav-tab {
  min-height: 34px;
  min-width: 112px;
  padding: 0 14px;
  border-radius: 9.5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.nav-tab:hover:not(.is-active) {
  color: var(--ink);
  background: var(--glass-well-strong);
}
.nav-tab.is-active {
  border-color: var(--glass-border-strong);
  background: var(--glass-card-bg);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}

.nav-badge {
  padding: 1px 6.5px;
  border-radius: 999px;
  background: var(--glass-well-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}
.nav-tab.is-active .nav-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.75);
}

.sync-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  min-height: 36px;
  min-width: 78px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--btn-sec-bg);
  color: var(--ink-soft);
  font-size: 12.8px;
  box-shadow: inset 0 1px 0 var(--glass-top-glint);
}
.header-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--glass-border-strong);
  background: var(--btn-sec-hover);
}
.header-btn.loading .refresh-svg {
  animation: spin360 0.85s linear infinite;
}

.workspace-main {
  display: grid;
  gap: 20px;
}

.view-pane {
  display: grid;
  gap: 18px;
  animation: fadeSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ==========================================================================
   KPI BENTO GRID
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--glass-card-bg);
  box-shadow: var(--shadow-card);
  transition: transform 0.22s ease, box-shadow 0.24s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 620;
  color: var(--muted);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-line);
}
.kpi-icon-sky { background: rgba(56, 189, 248, 0.14); color: #38bdf8; border-color: rgba(56, 189, 248, 0.25); }
.kpi-icon-indigo { background: rgba(129, 140, 248, 0.14); color: #818cf8; border-color: rgba(129, 140, 248, 0.25); }
.kpi-icon-emerald { background: rgba(16, 185, 129, 0.14); color: #10b981; border-color: rgba(16, 185, 129, 0.25); }
.kpi-icon-amber { background: rgba(245, 158, 11, 0.14); color: #f59e0b; border-color: rgba(245, 158, 11, 0.25); }

:root:not([data-theme="dark"]) .kpi-icon-sky { color: #0284c7; }
:root:not([data-theme="dark"]) .kpi-icon-indigo { color: #4f46e5; }
:root:not([data-theme="dark"]) .kpi-icon-emerald { color: #059669; }
:root:not([data-theme="dark"]) .kpi-icon-amber { color: #d97706; }

.kpi-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.kpi-value {
  font-size: clamp(22px, 2.3vw, 29px);
  font-weight: 760;
  line-height: 1.12;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.kpi-value[title] { cursor: help; }

.kpi-chip {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
  background: var(--glass-well-strong);
  color: var(--ink-soft);
}
.kpi-chip.tone-ready { background: var(--ready-bg); color: var(--ready-ink); }
.kpi-chip.tone-attention { background: var(--attention-bg); color: var(--attention-ink); }
.kpi-chip.tone-stopped { background: var(--stopped-bg); color: var(--stopped-ink); }

.glass-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--glass-well-strong);
  overflow: hidden;
}
.glass-progress-fill {
  height: 100%;
  width: var(--pct, 0%);
  border-radius: inherit;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.fill-sky { background: linear-gradient(90deg, #38bdf8, #60a5fa); }
.fill-indigo { background: linear-gradient(90deg, #818cf8, #a78bfa); }
.fill-emerald { background: linear-gradient(90deg, #10b981, #34d399); }
.fill-amber { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.kpi-sub {
  font-size: 11.8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   ACCOUNTS POOL PANEL & CONTROLS
   ========================================================================== */
.accounts-panel {
  display: grid;
  padding: 18px 20px 20px;
  gap: 14px;
}

.accounts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.accounts-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.accounts-heading h2 {
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-filter-pill {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
}
.status-filter-pill strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.status-filter-pill:hover {
  border-color: var(--glass-border-strong);
  background: var(--glass-well-strong);
  color: var(--ink);
}
.status-filter-pill.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}
[data-tone="ready"] .state-dot { background: #10b981; }
[data-tone="attention"] .state-dot { background: #f59e0b; }
[data-tone="paused"] .state-dot { background: #94a3b8; }
[data-tone="stopped"] .state-dot { background: #f43f5e; }

.accounts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-line);
}

.search-field {
  flex: 1 1 250px;
  max-width: 380px;
}
.search-field input {
  padding-block: 8px;
  padding-inline-end: 34px;
}
.search-field input::-webkit-search-cancel-button { display: none; }

.kbd-hint {
  position: absolute;
  right: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  pointer-events: none;
}
.search-field:focus-within .kbd-hint,
.search-field.has-value .kbd-hint { display: none; }
#search-clear { position: absolute; right: 4px; }

.toolbar-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
#select-all {
  min-width: 94px;
}

.view-switch {
  display: inline-flex;
  gap: 3px;
  padding: 2px;
  border-radius: 11px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
}
.view-switch .icon-btn-sm {
  border-color: transparent;
  background: transparent;
}
.view-switch .icon-btn-sm.is-active {
  background: var(--glass-card-bg);
  border-color: var(--glass-border);
  box-shadow: var(--shadow-card);
}

/* ==========================================================================
   ACCOUNT CARDS GRID & COMPACT LIST
   ========================================================================== */
.account-viewport {
  position: relative;
  min-height: 220px;
}
.account-scroll {
  max-height: clamp(460px, calc(100vh - 330px), 780px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 8px 14px 2px;
  margin-right: -4px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.account-scroll:focus-visible { outline-offset: 4px; border-radius: 14px; }

.accounts-scroll-top {
  position: absolute;
  right: 18px;
  bottom: -2px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-bg-strong);
  color: var(--ink);
  font-size: 12px;
  font-weight: 560;
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  cursor: pointer;
  animation: fadeIn 0.18s ease both;
}
.accounts-scroll-top:hover {
  border-color: var(--accent);
}
.accounts-scroll-top .icon-svg {
  width: 13px;
  height: 13px;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
  padding: 0;
  list-style: none;
}

.account-widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px 17px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: var(--glass-card-bg);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease, border-color 0.2s ease, background 0.2s ease;
}

.account-widget:hover:not(:has(.account-hit:disabled)) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--glass-border-strong);
}

.account-widget.selected {
  border-color: var(--accent);
  background: var(--glass-card-selected);
  box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow-card-hover);
}

.account-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
}
.account-hit:focus-visible { outline-offset: 2px; }
.account-widget:has(.account-hit:disabled) { cursor: default; }

.account-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  pointer-events: none;
}

.account-order {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding-inline: 6px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--paused-border);
  background: var(--paused-bg);
  color: var(--paused-ink);
}
.account-widget[data-tone="ready"] .account-order { border-color: var(--ready-border); background: var(--ready-bg); color: var(--ready-ink); }
.account-widget[data-tone="attention"] .account-order { border-color: var(--attention-border); background: var(--attention-bg); color: var(--attention-ink); }
.account-widget[data-tone="stopped"] .account-order { border-color: var(--stopped-border); background: var(--stopped-bg); color: var(--stopped-ink); }

.account-identity { min-width: 0; }
.account-email-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.account-name {
  font-size: 13.5px;
  font-weight: 680;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-inline-btn {
  pointer-events: auto;
  position: relative;
  z-index: 3;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.account-widget:hover .copy-inline-btn,
.dd-copyable .copy-inline-btn,
.copy-inline-btn:focus-visible {
  opacity: 1;
}
.copy-inline-btn:hover {
  background: var(--glass-well-strong);
  color: var(--ink);
}
.copy-inline-btn .icon-svg { width: 13px; height: 13px; }

.account-badges {
  display: flex;
  align-items: center;
  gap: 7px;
}

.select-ring {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border-strong);
  background: var(--glass-well);
  display: grid;
  place-items: center;
  color: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.select-ring svg { width: 12px; height: 12px; }
.account-widget.selected .select-ring {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  transform: scale(1.05);
}

.account-note {
  padding: 6px 9px;
  border-radius: 9px;
  border: 1px solid var(--attention-border);
  background: var(--attention-bg);
  color: var(--attention-ink);
  font-size: 11.5px;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.account-widget[data-tone="stopped"] .account-note {
  border-color: var(--stopped-border);
  background: var(--stopped-bg);
  color: var(--stopped-ink);
}

/* Per-Account Exit Proxy IP & Live Status Strip */
.account-proxy-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 11px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
}

.proxy-ip-chip {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 11.8px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
}
.proxy-globe-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  color: var(--muted);
}
.proxy-flag-slot {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.country-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 1px 3px rgba(0, 0, 0, 0.3);
}
:root:not([data-theme="dark"]) .country-flag {
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16), 0 1px 2px rgba(15, 23, 42, 0.12);
}
.country-flag svg {
  display: block;
  width: 100%;
  height: 100%;
}
.country-flag.is-iso-fallback {
  width: auto;
  min-width: 20px;
  height: 14px;
  padding: 0 3.5px;
  background: var(--glass-well-strong);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
}
.dd-with-flag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.proxy-ip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxy-status-btn {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8.5px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-card-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
  pointer-events: auto;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.proxy-status-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--glass-border-strong);
  color: var(--ink);
}
.proxy-status-btn:disabled {
  cursor: default;
}
.proxy-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.proxy-status-btn[data-proxy-state="ok"] {
  border-color: var(--ready-border);
  background: var(--ready-bg);
  color: var(--ready-ink);
}
.proxy-status-btn[data-proxy-state="error"] {
  border-color: var(--stopped-border);
  background: var(--stopped-bg);
  color: var(--stopped-ink);
}
.proxy-status-btn[data-proxy-state="untested"] {
  border-color: var(--glass-border);
  background: var(--glass-well-strong);
  color: var(--ink-soft);
}
.proxy-status-btn[data-proxy-state="untested"] .proxy-dot {
  opacity: 0.55;
}
.proxy-status-btn[data-proxy-state="direct"] {
  border-color: var(--glass-line);
  background: transparent;
  color: var(--muted);
  opacity: 0.85;
}
.proxy-status-btn.is-probing .proxy-dot {
  width: 8px;
  height: 8px;
  background: transparent;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  animation: spin360 0.72s linear infinite;
}

.account-quotas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  pointer-events: none;
}

.quota-row { display: grid; gap: 6px; min-width: 0; }
.quota-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.quota-row-head span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.quota-row-head strong {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.quota-row-head strong[title] { cursor: help; }

.mini-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--glass-well-strong);
  overflow: hidden;
}
.mini-progress-fill {
  height: 100%;
  width: var(--pct, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.mini-progress-fill.is-mid { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.mini-progress-fill.is-low { background: linear-gradient(90deg, #f43f5e, #fb7185); }

.quota-reset {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  cursor: help;
  font-size: 10.6px;
  line-height: 1.25;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quota-reset.is-urgent {
  color: var(--attention-ink);
  font-weight: 580;
}
.account-grid.is-list .quota-reset {
  font-size: 10.2px;
}

.account-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.account-stats-inline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  pointer-events: none;
}
.stat-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.stat-pair strong {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.failure-count { color: var(--danger) !important; }
.stat-time {
  font-size: 10.8px;
  font-family: var(--font-mono);
  letter-spacing: -0.015em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-quick-actions {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-act-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  color: var(--muted);
}
.card-act-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--glass-border-strong);
  background: var(--btn-sec-hover);
  transform: translateY(-1px);
}
.card-act-btn.is-spinning .icon-svg {
  animation: spin360 0.8s linear infinite;
}

.card-act-btn .icon-play { display: none; }
.account-widget.is-paused .card-act-btn .icon-pause { display: none; }
.account-widget.is-paused .card-act-btn .icon-play { display: block; }

/* Compact Glass Table List Mode */
.account-list-header {
  position: sticky;
  top: -4px;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(220px, 1.32fr) minmax(215px, 1.12fr) minmax(245px, 1.30fr) minmax(150px, 0.86fr) 136px;
  align-items: center;
  gap: 14px;
  padding: 8px 16px 9px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  border-bottom-color: var(--glass-line);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 640;
  letter-spacing: 0.02em;
}
.account-list-header .col-center { text-align: center; }
.account-list-header .col-right { text-align: end; }

.account-grid.is-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}
.account-grid.is-list .account-widget {
  display: grid;
  grid-template-columns: minmax(220px, 1.32fr) minmax(215px, 1.12fr) minmax(245px, 1.30fr) minmax(150px, 0.86fr) 136px;
  align-items: center;
  padding: 10px 16px;
  gap: 8px 14px;
  border-radius: 14px;
}
.account-grid.is-list .account-top { align-items: center; }
.account-grid.is-list .account-proxy-bar {
  padding: 4px 6px;
  border-color: transparent;
  background: transparent;
}
.account-grid.is-list .account-note {
  grid-column: 1 / -1;
  order: 10;
  padding: 5px 10px;
  font-size: 11.2px;
}
.account-grid.is-list .account-quotas {
  margin-top: 0;
  padding: 6px 10px;
  background: transparent;
  border-color: transparent;
}
.account-grid.is-list .account-bottom { display: contents; }
.account-grid.is-list .account-stats-inline {
  justify-self: center;
  align-items: center;
  text-align: center;
}
.account-grid.is-list .account-stats-inline .stat-pair {
  justify-content: center;
}
.account-grid.is-list .card-quick-actions { justify-self: center; }

.load-more {
  display: flex;
  margin: 16px auto 2px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 46px 20px;
  gap: 8px;
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  color: var(--muted);
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.empty-icon svg { width: 32px; height: 32px; }
.empty-state strong { font-size: 16px; font-weight: 700; }
.empty-state p { color: var(--muted); font-size: 13px; max-width: 40ch; }
.empty-state button { margin-top: 8px; }

/* Floating Batch Dock */
.batch-dock {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  border-radius: 18px;
  background: var(--glass-bg-strong);
  box-shadow: var(--shadow-dock);
  max-width: calc(100vw - 28px);
  animation: dockUp 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.batch-dock-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  padding-inline-end: 8px;
  border-inline-end: 1px solid var(--glass-line);
}
.batch-badge {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding-inline: 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
}
.batch-dock-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

/* ==========================================================================
   ADMIN VIEW 2: CLIENT KEYS & QUOTA GOVERNANCE
   ========================================================================== */
.issue-key-panel,
.keys-directory-panel {
  display: grid;
  gap: 16px;
  padding: 20px 22px 22px;
}

.quota-presets {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.preset-mini-btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  color: var(--ink-soft);
  font-size: 11.8px;
  font-weight: 580;
}
.preset-mini-btn:hover {
  background: var(--accent-soft);
  border-color: var(--info-border);
  color: var(--accent);
}

.key-create-grid {
  display: grid;
  gap: 14px;
}

.key-form-row-top {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(160px, 1.2fr) minmax(136px, 0.72fr) auto;
  gap: 12px;
  align-items: end;
}
.key-form-row-top .glass-select { width: 100%; }
.key-form-row-top button.select-trigger { width: 100%; min-height: 41px; }
.field-submit .btn-glass-primary { min-height: 41px; padding-inline: 22px; }

.key-form-row-quotas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.key-form-row-protocols {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding-top: 2px;
}
.proto-row-label {
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink-soft);
}
.proto-toggles {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.proto-check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.proto-check-pill input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.proto-check-pill:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}
.proto-check-pill:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.key-cards-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.key-cards-grid:empty { display: none; }

.key-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: var(--glass-card-bg);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.22s ease, border-color 0.2s ease;
}
.key-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--glass-border-strong);
}
.key-card.is-revoked { opacity: 0.62; }

.key-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.key-identity { min-width: 0; display: grid; gap: 3px; }
.key-identity strong {
  font-size: 14.5px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.key-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.key-secret-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.key-secret-code {
  padding: 2.5px 8px;
  border-radius: 7px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  word-break: break-all;
}
.key-secret-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  color: var(--muted);
}
.key-secret-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--glass-border-strong);
  background: var(--btn-sec-hover);
}
.key-secret-btn .icon-svg { width: 13px; height: 13px; }
.key-secret-hint {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.8;
}
.key-note-line {
  font-size: 12px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proto-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.proto-mini-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}
.proto-mini-tag .proto-dot { width: 6px; height: 6px; box-shadow: none; }

.key-quotas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
}

.key-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid var(--glass-line);
}
.key-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.key-card-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.key-card-actions .btn-glass-secondary {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 9px;
}

/* ==========================================================================
   CLIENT VIEW 1: FULL-WIDTH CONNECTED HERO BANNER + INTEGRATIONS
   ========================================================================== */
.client-hero {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) minmax(300px, 1.25fr) auto;
  align-items: center;
  gap: 18px 22px;
  padding: 18px 22px;
  border-radius: 22px;
  background: var(--glass-bg-strong);
}

.client-hero-left {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.client-hero-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.hero-name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-name-line h2 {
  font-size: 16.5px;
  font-weight: 720;
  letter-spacing: -0.02em;
}
.hero-meta-line {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11.8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.meta-sep { margin-inline: 5px; opacity: 0.5; }

.client-quota-ribbon {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ribbon-stat {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 13px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  min-width: 0;
}
.ribbon-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.ribbon-val {
  font-size: 14px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ribbon-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-hero-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.client-card {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 20px 22px 22px;
  border-radius: 22px;
  background: var(--glass-card-bg);
  box-shadow: var(--shadow-card);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.section-head h2, .section-head h3 {
  font-size: 16px;
  font-weight: 720;
  letter-spacing: -0.02em;
}
.section-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.section-head-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline-form.wrap { flex-wrap: wrap; }

.issued-key {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--ready-border);
  background: var(--ready-bg);
}
.issued-key-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ready-ink);
}
.issued-key-head label {
  margin: 0;
  color: inherit;
  font-size: 12.5px;
}
.issued-value-row input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-input-focus);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
}

.empty-inline {
  padding: 24px;
  text-align: center;
  border-radius: 14px;
  border: 1px dashed var(--glass-border);
  color: var(--muted);
  font-size: 13px;
}

/* CC Switch & cURL Grid */
.client-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.target-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.target-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  text-align: start;
  white-space: normal;
}
.target-card:hover:not(:disabled) {
  background: var(--glass-well-strong);
  border-color: var(--glass-border-strong);
  transform: translateY(-1px);
}
.target-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.target-card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-bottom: 2px;
}
.target-card strong { font-size: 13px; font-weight: 700; color: var(--ink); }
.target-card span { font-size: 11px; color: var(--muted); font-weight: 500; }

.connection-details {
  display: grid;
  gap: 8px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  font-size: 12.8px;
}
.connection-details > div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.connection-details dt { color: var(--muted); font-weight: 580; }
.connection-details dd {
  font-family: var(--font-mono);
  font-size: 12.2px;
  overflow-wrap: anywhere;
}
.dd-copyable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#config-text {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-input);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

.code-well {
  padding: 15px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   CLIENT VIEW 2: FIXED-VIEWPORT WEB PLAYGROUND
   ========================================================================== */
.playground-shell {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  padding: 0;
}

.pg-sidebar {
  flex: 0 0 264px;
  width: 264px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-line);
  background: var(--glass-well);
  transition: width 220ms cubic-bezier(0.22, 1, 0.36, 1),
              flex-basis 220ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 180ms ease;
  overflow: hidden;
}
.playground-shell.is-sidebar-collapsed .pg-sidebar {
  flex-basis: 0;
  width: 0;
  border-right-color: transparent;
  opacity: 0;
  pointer-events: none;
}

.pg-sidebar-top {
  flex: 0 0 auto;
  padding: 13px 13px 10px;
}
.pg-new-btn {
  width: 100%;
  min-height: 36px;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  border-radius: 11px;
}

.pg-sidebar-search {
  flex: 0 0 auto;
  padding: 0 13px 10px;
}
.pg-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pg-search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}
.pg-search-wrap input {
  width: 100%;
  padding: 7px 10px 7px 31px;
  font-size: 12.2px;
  border-radius: 10px;
}
.pg-search-wrap input::-webkit-search-cancel-button {
  display: none;
}

.pg-session-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
}

.pg-session-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.pg-session-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
  min-width: 0;
}
.pg-session-item:hover {
  background: var(--glass-card-bg);
  border-color: var(--glass-line);
  color: var(--ink);
}
.pg-session-item.is-active {
  background: var(--glass-card-selected);
  border-color: var(--glass-border-strong);
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--glass-top-glint);
}
.pg-session-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent, #38bdf8);
}

.pg-session-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pg-session-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.pg-pin-badge {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  color: var(--accent, #38bdf8);
}
.pg-session-title {
  font-size: 12.8px;
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pg-session-item.is-active .pg-session-title {
  font-weight: 650;
}
.pg-session-meta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pg-rename-input {
  width: 100%;
  padding: 3px 7px;
  border-radius: 7px;
  border: 1px solid var(--accent, #38bdf8);
  background: var(--glass-bg-strong);
  color: var(--ink);
  font-size: 12.5px;
  outline: none;
}

.pg-session-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 140ms ease;
}
.pg-session-item:hover .pg-session-actions,
.pg-session-item:focus-within .pg-session-actions,
.pg-session-item.is-active .pg-session-actions {
  opacity: 1;
}
.pg-session-act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.pg-session-act-btn:hover {
  background: var(--glass-well-strong);
  color: var(--ink);
}
.pg-session-act-btn.is-pinned {
  color: var(--accent, #38bdf8);
}
.pg-session-act-btn.is-danger:hover {
  background: rgba(244, 63, 94, 0.16);
  color: #fb7185;
}
.pg-session-act-btn .icon-svg {
  width: 13px;
  height: 13px;
}

.pg-sidebar-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 13px;
  border-top: 1px solid var(--glass-line);
}
.pg-session-count {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pg-clear-all-btn {
  font-size: 11.5px;
  padding: 4px 8px;
  min-height: 26px;
}
.pg-clear-all-btn.is-armed {
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.12);
}

.pg-sidebar-backdrop {
  display: none;
}

.pg-main {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pg-head-left {
  min-width: 0;
}
.pg-head-titles {
  min-width: 0;
}
.pg-head-titles h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}
.pg-sidebar-toggle {
  flex: 0 0 auto;
  margin-right: 2px;
}

@media (max-width: 860px) {
  .pg-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 25;
    width: 268px;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow-float);
    transform: translateX(0);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .playground-shell.is-sidebar-collapsed .pg-sidebar {
    width: 268px;
    flex-basis: 268px;
    transform: translateX(-104%);
    opacity: 1;
    pointer-events: none;
  }
  .pg-sidebar-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(4, 8, 18, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
  .pg-sidebar-backdrop[hidden] {
    display: none;
  }
}

.playground-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--glass-line);
}

.playground-controls {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.pg-system-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--glass-line);
  background: var(--glass-well);
}
.pg-system-bar input { padding-block: 7px; font-size: 12.8px; }

.stream-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  font-size: 12.2px;
  color: var(--ink-soft);
}
.stream-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.pg-messages-wrap {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pg-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
}

.pg-scroll-bottom {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 6;
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-bg-strong);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: fadeIn 0.18s ease both;
}
.pg-scroll-bottom:hover {
  border-color: var(--accent);
}

.pg-welcome {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 560px;
  padding-bottom: 18px;
}
.pg-welcome-orb {
  width: 60px;
  height: 60px;
  border-radius: 19px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-card-bg);
  color: var(--accent);
  display: grid;
  place-items: center;
  box-shadow: 0 0 36px rgba(56, 189, 248, 0.16), var(--shadow-card);
}
.pg-welcome-orb svg { width: 34px; height: 34px; }
.pg-welcome h3 {
  font-size: 23px;
  font-weight: 660;
  letter-spacing: -0.02em;
  color: var(--ink);
  animation: fadeIn 0.35s ease;
}
.pg-welcome p { color: var(--muted); font-size: 13px; }

.prompt-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.preset-chip {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-card-bg);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 560;
}
.preset-chip:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.pg-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.msg-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 86%;
}
.msg-row.msg-user {
  align-self: flex-end;
  align-items: flex-end;
}
.msg-row.msg-assistant {
  align-self: flex-start;
  align-items: flex-start;
  width: fit-content;
  max-width: min(86%, 820px);
}
.msg-row.msg-assistant:has(.msg-code-block, .msg-media-gallery) {
  width: min(820px, 86%);
}

.msg-meta-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  padding-inline: 4px;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: 17px;
  border: 1px solid var(--glass-border);
  background: var(--glass-card-bg);
  line-height: 1.65;
  font-size: 13.8px;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-card);
  width: fit-content;
  max-width: 100%;
}
.msg-row.msg-assistant:has(.msg-code-block, .msg-media-gallery) .msg-bubble {
  width: 100%;
}
.msg-user .msg-bubble {
  width: auto;
  background: var(--accent-soft);
  border-color: var(--info-border);
  border-bottom-right-radius: 5px;
  white-space: pre-wrap;
}
.msg-assistant .msg-bubble {
  border-bottom-left-radius: 5px;
}

.msg-text-block { white-space: pre-wrap; }
.msg-heading {
  font-size: 15px;
  font-weight: 720;
  margin-block: 10px 4px;
  letter-spacing: -0.01em;
}
.msg-code-block {
  margin-block: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--code-bg);
  color: var(--code-ink);
  overflow: hidden;
}
.msg-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono);
}
.msg-code-head button {
  color: #cbd5e1;
  font-size: 11px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
}
.msg-code-head button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.msg-code-block pre {
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.2px;
  line-height: 1.58;
}
.msg-inline-code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--glass-well-strong);
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.msg-media-gallery {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.msg-media-card {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: min(100%, 540px);
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.msg-attachment-video {
  display: block;
  width: 100%;
  max-width: 540px;
  max-height: 400px;
  background: #05070d;
  outline: none;
}
.msg-attachment-img {
  display: block;
  max-width: min(100%, 480px);
  max-height: 440px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.16);
  cursor: zoom-in;
  transition: opacity 0.18s ease;
}
.msg-attachment-img:hover {
  opacity: 0.94;
}
.msg-attachment-audio {
  display: block;
  width: min(360px, 100%);
  padding: 10px 12px 4px;
}
.msg-media-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--glass-line);
  background: var(--glass-card-bg);
}
.msg-media-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.msg-media-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.msg-media-action {
  font-size: 11.8px;
  font-weight: 620;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.msg-media-action:hover {
  text-decoration: underline;
}
.msg-media-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
  font-size: 12px;
  color: var(--muted);
}
.msg-stream-timer {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent, #38bdf8);
  font-variant-numeric: tabular-nums;
}
.msg-error-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--attention-border);
  background: var(--attention-bg);
  color: var(--attention-ink);
  font-size: 12.2px;
  line-height: 1.45;
}
.msg-error-strip .btn-glass-ghost {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--ink);
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-card-bg);
}
.mini-media-spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.8px solid var(--glass-border-strong);
  border-top-color: var(--accent);
  animation: spin360 0.8s linear infinite;
}

/* Claude-Inspired Minimal Hark Logo Thinking Stage */
.pg-thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px;
}
.pg-hark-pulse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--accent, #38bdf8);
  flex: 0 0 auto;
  animation: harkThinkGesture 2.4s cubic-bezier(0.42, 0, 0.24, 1) infinite;
}
.pg-hark-pulse svg {
  width: 22px;
  height: 22px;
  display: block;
  overflow: visible;
}
.pg-hark-pulse .hark-horn-core {
  animation: harkThinkCore 2.4s ease-in-out infinite;
}
.pg-hark-pulse .hark-wave-1 {
  animation: harkThinkWave 1.55s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.pg-hark-pulse .hark-wave-2 {
  animation: harkThinkWave 1.55s cubic-bezier(0.22, 1, 0.36, 1) 0.36s infinite;
}
.pg-hark-pulse.is-mini {
  width: 18px;
  height: 18px;
}
.pg-hark-pulse.is-mini svg {
  width: 17px;
  height: 17px;
}

@keyframes harkThinkGesture {
  0%, 100% { transform: scale(0.95) rotate(-5deg); }
  38% { transform: scale(1.07) rotate(6deg); }
  70% { transform: scale(0.99) rotate(-2deg); }
}
@keyframes harkThinkCore {
  0%, 100% {
    opacity: 0.78;
    filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.28));
  }
  45% {
    opacity: 1;
    filter: drop-shadow(0 0 9px rgba(56, 189, 248, 0.72));
  }
}
@keyframes harkThinkWave {
  0% {
    opacity: 0;
    transform: translateX(-1.5px) scale(0.84);
  }
  30% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translateX(3.2px) scale(1.16);
  }
}

.pg-thinking-phrase {
  font-size: 13.8px;
  font-weight: 540;
  letter-spacing: 0.015em;
  color: var(--ink-soft);
}
.pg-thinking-phrase.is-compact {
  font-size: 12.4px;
}
.pg-thinking-phrase.is-shimmer {
  background: linear-gradient(
    90deg,
    var(--muted) 0%,
    var(--muted) 32%,
    var(--ink) 50%,
    var(--muted) 68%,
    var(--muted) 100%
  );
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: thinkingShimmer 2.1s linear infinite;
}
@keyframes thinkingShimmer {
  0% { background-position: 115% 0; }
  100% { background-position: -115% 0; }
}
.pg-thinking-timer {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  opacity: 0.78;
  flex: 0 0 auto;
}

/* Inline 3-dot wave typing indicator once tokens begin arriving */
.pg-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  margin-left: 6px;
  vertical-align: middle;
}
.pg-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
  animation: dotBounce 1.05s ease-in-out infinite;
}
.pg-typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.pg-typing-dots span:nth-child(3) { animation-delay: 0.32s; }

.media-lightbox {
  z-index: 120;
}
.lightbox-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: min(92vw, 980px);
  max-height: 90vh;
  padding: 16px;
  border-radius: 22px;
  background: var(--glass-bg-strong);
  animation: panelRise 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}
.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 90px);
  object-fit: contain;
  border-radius: 12px;
}
.lightbox-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lightbox-foot a.btn-glass-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex: 0 0 auto;
}
.lightbox-name {
  font-family: var(--font-mono);
  font-size: 12.2px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.streaming-cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  border-radius: 2px;
  background: var(--accent);
  animation: blinkCursor 0.9s steps(2) infinite;
}

.pg-feedback { flex: 0 0 auto; margin: 0 20px 10px; }

.pg-composer {
  flex: 0 0 auto;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--glass-line);
}
.composer-box {
  flex-direction: column;
  align-items: stretch;
  border-radius: 18px;
  padding: 6px 6px 4px;
}
.composer-box textarea {
  resize: none;
  min-height: 92px;
  max-height: 200px;
  padding: 11px 14px 6px;
  font-size: 14.2px;
  line-height: 1.58;
}
.composer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 4px 8px 6px;
}
.try-actions { display: inline-flex; align-items: center; gap: 8px; }

/* ==========================================================================
   FEEDBACK BANNERS
   ========================================================================== */
.feedback {
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--ink);
  font-size: 12.8px;
  overflow-wrap: anywhere;
}
.feedback.error {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

/* ==========================================================================
   CUSTOM GLASS SELECT DROPDOWN (Centered Trigger & Centered Glass Menu)
   ========================================================================== */
/* Elevate parent containers when any custom dropdown inside is open — prevents z-index bleed-through */
.glass-select { position: relative; min-width: 0; }
.glass-select:has([aria-expanded="true"]) { z-index: 90; }
.field-group:has([aria-expanded="true"]),
.key-form-row-top:has([aria-expanded="true"]),
.accounts-toolbar:has([aria-expanded="true"]),
.modal-form-grid:has([aria-expanded="true"]) {
  position: relative;
  z-index: 90 !important;
}

button.select-trigger {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  min-width: 144px;
  padding: 0 11px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--btn-sec-bg);
  color: var(--ink-soft);
  font-size: 12.8px;
  font-weight: 590;
  box-shadow: inset 0 1px 0 var(--glass-top-glint);
}
button.select-trigger:hover:not(:disabled),
button.select-trigger[aria-expanded="true"] {
  color: var(--ink);
  border-color: var(--glass-border-strong);
  background: var(--btn-sec-hover);
}
.select-trigger-label {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.select-chevron {
  grid-column: 3;
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.16s ease;
}
button.select-trigger:hover .select-chevron,
button.select-trigger[aria-expanded="true"] .select-chevron {
  color: var(--ink);
}
button.select-trigger[aria-expanded="true"] .select-chevron {
  transform: rotate(180deg);
}

.select-options {
  position: absolute;
  z-index: 65;
  top: calc(100% + 6px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  display: grid;
  gap: 2px;
  min-width: max(100%, 152px);
  max-width: min(100vw - 32px, 260px);
  max-height: min(60vh, 360px);
  padding: 5px;
  overflow-y: auto;
  border: 1px solid var(--glass-border-strong);
  border-radius: 14px;
  background: var(--glass-menu);
  box-shadow: var(--shadow-dock);
  -webkit-backdrop-filter: blur(24px) saturate(185%);
  backdrop-filter: blur(24px) saturate(185%);
}
.opens-up .select-options {
  top: auto;
  bottom: calc(100% + 6px);
}

button.select-option {
  min-height: 33px;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 12.8px;
  font-weight: 540;
  text-align: center;
  white-space: nowrap;
}
button.select-option:hover,
button.select-option:focus-visible {
  background: var(--glass-menu-hover);
  color: var(--ink);
}
button.select-option[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 660;
}

/* ==========================================================================
   MODALS & FLOATING GLASS TOASTS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--backdrop-modal);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.18s ease both;
}

.modal-card {
  width: min(540px, 100%);
  padding: 22px 24px;
  border-radius: 24px;
  background: var(--glass-bg-strong);
  display: grid;
  gap: 18px;
  animation: panelRise 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.modal-compact { width: min(420px, 100%); }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.modal-head h3 {
  font-size: 17px;
  font-weight: 720;
  word-break: break-all;
}
.modal-sub {
  margin-top: 4px;
  font-size: 12.2px;
  color: var(--muted);
}

.modal-note {
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--attention-border);
  background: var(--attention-bg);
  color: var(--attention-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.inspector-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: var(--glass-well);
}
.inspector-item dt {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.inspector-item dd {
  margin-top: 3px;
  font-size: 13.5px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.confirm-body {
  color: var(--ink-soft);
  font-size: 13.8px;
  line-height: 1.6;
}

.modal-secret-box {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass-well);
}
.modal-secret-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.modal-secret-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.modal-secret-code {
  font-family: var(--font-mono);
  font-size: 12.6px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
  line-height: 1.45;
}
.modal-secret-hint {
  font-size: 11.4px;
  color: var(--attention-ink);
  line-height: 1.45;
}
.modal-secret-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-secret-actions .btn-glass-secondary {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}
.key-legacy-rotate-btn {
  min-height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--glass-border);
  background: var(--btn-sec-bg);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 620;
}
.key-legacy-rotate-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--glass-border-strong);
  background: var(--btn-sec-hover);
}

.modal-form-grid {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.modal-form-grid .span-2 { grid-column: 1 / -1; }
.modal-form-grid .glass-select { width: 100%; }
.modal-form-grid button.select-trigger { width: 100%; min-height: 40px; }

.modal-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}
.modal-foot-split { justify-content: space-between; }

/* Floating Toast Stack */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 8px;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 32px));
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-radius: 14px;
  border: 1px solid var(--glass-border-strong);
  background: var(--glass-bg-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 580;
  box-shadow: var(--shadow-dock);
  -webkit-backdrop-filter: blur(22px) saturate(185%);
  backdrop-filter: blur(22px) saturate(185%);
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast-item.is-leaving {
  animation: toastOut 0.22s ease forwards;
}
.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  flex: 0 0 auto;
}
.toast-item.is-success .toast-dot { background: #10b981; }
.toast-item.is-error .toast-dot { background: #f43f5e; }
.toast-item.is-error { border-color: var(--danger-border); }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes panelRise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes dockUp {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(18px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(18px) scale(0.96); }
}
@keyframes spin360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes spinReverse {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}
@keyframes orbPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1.25); opacity: 1; }
}
@keyframes waveDance {
  0%, 100% { transform: scaleY(0.28); opacity: 0.45; }
  50% { transform: scaleY(1); opacity: 1; }
}
@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.38; }
  40% { transform: translateY(-3.5px); opacity: 1; }
}
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-5px); }
  55% { transform: translateX(5px); }
  80% { transform: translateX(-3px); }
}
@keyframes orbDriftA {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(40px, 28px) scale(1.07); }
}
@keyframes orbDriftB {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-36px, -24px) scale(1.06); }
}
@keyframes harkCoreBreathe {
  0%, 100% { transform: scale(1); opacity: 0.94; }
  50% { transform: scale(1.045); opacity: 1; }
}
@keyframes harkWavePulse {
  0% { opacity: 0; transform: translateX(-2px) scale(0.86); }
  28% { opacity: 0.85; }
  75% { opacity: 0.22; }
  100% { opacity: 0; transform: translateX(3.5px) scale(1.08); }
}
@keyframes orbDriftC {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-24px, 32px) scale(1.05); }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-list-header { display: none !important; }
  .account-grid.is-list .account-widget {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .account-grid.is-list .account-stats-inline { justify-self: start; align-items: flex-start; text-align: start; }
  .account-grid.is-list .account-stats-inline .stat-pair { justify-content: flex-start; }
  .account-grid.is-list .card-quick-actions { justify-self: end; }
  .key-form-row-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .key-form-row-quotas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-hero { grid-template-columns: minmax(0, 1fr); }
  .client-hero-actions { justify-content: flex-start; }
  .topbar { grid-template-columns: auto 1fr; }
  .topbar-nav { grid-column: 1 / -1; justify-self: center; order: 3; }
}

@media (max-width: 900px) {
  .gate-shell { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .gate-showcase { border-inline-end: 0; border-bottom: 1px solid var(--glass-line); }
  .client-config-grid, .key-cards-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 680px) {
  .gate-stage, .workspace-shell { width: calc(100% - 22px); }
  .topbar { padding: 10px; gap: 10px; }
  .kpi-grid, .account-grid, .target-cards, .inspector-grid,
  .key-form-row-top, .key-form-row-quotas, .client-quota-ribbon, .modal-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .accounts-panel, .issue-key-panel, .keys-directory-panel { padding: 14px; }
  .client-card, .client-hero { padding: 16px; }
  .batch-dock { bottom: 12px; padding: 10px 12px; }
  .batch-dock-info { border-inline-end: 0; padding-inline-end: 0; }
  .inline-form { flex-wrap: wrap; }
  .inline-form > .btn-glass-primary { width: 100%; }
  .topbar-nav { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-tab { padding-inline: 8px; font-size: 12.5px; }
  .nav-tab .icon-svg { display: none; }
  .composer-hint { display: none; }
}

@media (pointer: coarse) {
  .glass-input-wrap input, .glass-input-wrap textarea { font-size: 16px; }
  .copy-inline-btn { opacity: 1; }
}

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

@media (prefers-reduced-transparency: reduce) {
  .glass-panel, .account-widget, .select-options, .toast-item, .health-pill {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--opaque);
  }
}
