@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Outfit:wght@500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   THEME DEFINITIONS & COLOR SYSTEM
   ========================================================================== */

/* Theme 1 (Default): Midnight Iris & Electric Aurora */
:root,
[data-theme="iris"] {
  --bg-base: #090b11;
  --bg-surface: rgba(16, 21, 33, 0.78);
  --bg-surface-elevated: rgba(25, 33, 52, 0.85);
  --bg-surface-hover: rgba(38, 50, 78, 0.75);
  --bg-input: rgba(13, 17, 27, 0.92);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(139, 92, 246, 0.7);
  --border-hover: rgba(255, 255, 255, 0.18);

  --primary: #8b5cf6;
  --primary-light: #a78bfa;
  --primary-dark: #6d28d9;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --primary-glow: 0 0 28px rgba(139, 92, 246, 0.4);
  --accent-glow: 0 0 32px rgba(217, 70, 239, 0.25);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.14);

  --glow-bg-1: radial-gradient(ellipse at 15% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 45%);
  --glow-bg-2: radial-gradient(ellipse at 85% 10%, rgba(217, 70, 239, 0.10) 0%, transparent 45%);
  --glow-bg-3: radial-gradient(ellipse at 50% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
}

/* Theme 2: Cyber Emerald */
[data-theme="emerald"] {
  --bg-base: #060e0c;
  --bg-surface: rgba(11, 25, 20, 0.78);
  --bg-surface-elevated: rgba(18, 42, 33, 0.85);
  --bg-surface-hover: rgba(26, 62, 49, 0.75);
  --bg-input: rgba(9, 20, 16, 0.92);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.7);
  --border-hover: rgba(16, 185, 129, 0.3);

  --primary: #10b981;
  --primary-light: #34d399;
  --primary-dark: #059669;
  --primary-gradient: linear-gradient(135deg, #10b981 0%, #06b6d4 50%, #3b82f6 100%);
  --primary-glow: 0 0 28px rgba(16, 185, 129, 0.4);
  --accent-glow: 0 0 32px rgba(6, 182, 212, 0.25);

  --text-main: #f0fdf4;
  --text-muted: #86efac;
  --text-dim: #4ade80;

  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.14);

  --glow-bg-1: radial-gradient(ellipse at 15% 0%, rgba(16, 185, 129, 0.12) 0%, transparent 45%);
  --glow-bg-2: radial-gradient(ellipse at 85% 10%, rgba(6, 182, 212, 0.10) 0%, transparent 45%);
  --glow-bg-3: radial-gradient(ellipse at 50% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
}

/* Theme 3: Solar Amber */
[data-theme="amber"] {
  --bg-base: #0d0a07;
  --bg-surface: rgba(26, 19, 13, 0.78);
  --bg-surface-elevated: rgba(43, 31, 21, 0.85);
  --bg-surface-hover: rgba(62, 45, 29, 0.75);
  --bg-input: rgba(20, 15, 10, 0.92);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(245, 158, 11, 0.7);
  --border-hover: rgba(245, 158, 11, 0.3);

  --primary: #f59e0b;
  --primary-light: #fbbf24;
  --primary-dark: #d97706;
  --primary-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 50%, #e11d48 100%);
  --primary-glow: 0 0 28px rgba(245, 158, 11, 0.4);
  --accent-glow: 0 0 32px rgba(234, 88, 12, 0.25);

  --text-main: #fffbeb;
  --text-muted: #fcd34d;
  --text-dim: #d97706;

  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.14);

  --glow-bg-1: radial-gradient(ellipse at 15% 0%, rgba(245, 158, 11, 0.12) 0%, transparent 45%);
  --glow-bg-2: radial-gradient(ellipse at 85% 10%, rgba(234, 88, 12, 0.10) 0%, transparent 45%);
  --glow-bg-3: radial-gradient(ellipse at 50% 100%, rgba(225, 29, 72, 0.08) 0%, transparent 50%);
}

/* Theme 4: Arctic Slate */
[data-theme="slate"] {
  --bg-base: #0b1120;
  --bg-surface: rgba(15, 23, 42, 0.82);
  --bg-surface-elevated: rgba(30, 41, 59, 0.88);
  --bg-surface-hover: rgba(51, 65, 85, 0.78);
  --bg-input: rgba(15, 23, 42, 0.94);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.7);
  --border-hover: rgba(56, 189, 248, 0.3);

  --primary: #38bdf8;
  --primary-light: #7dd3fc;
  --primary-dark: #0284c7;
  --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #6366f1 50%, #a855f7 100%);
  --primary-glow: 0 0 28px rgba(56, 189, 248, 0.4);
  --accent-glow: 0 0 32px rgba(99, 102, 241, 0.25);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.14);

  --glow-bg-1: radial-gradient(ellipse at 15% 0%, rgba(56, 189, 248, 0.12) 0%, transparent 45%);
  --glow-bg-2: radial-gradient(ellipse at 85% 10%, rgba(99, 102, 241, 0.10) 0%, transparent 45%);
  --glow-bg-3: radial-gradient(ellipse at 50% 100%, rgba(168, 85, 247, 0.08) 0%, transparent 50%);
}

/* Theme 5: Imperial Gold & Obsidian (Hoàng Kim Hắc Diệu) */
[data-theme="gold"] {
  --bg-base: #080705;
  --bg-surface: rgba(22, 18, 12, 0.82);
  --bg-surface-elevated: rgba(36, 29, 18, 0.88);
  --bg-surface-hover: rgba(54, 43, 26, 0.78);
  --bg-input: rgba(18, 14, 9, 0.94);

  --border-subtle: rgba(251, 191, 36, 0.12);
  --border-focus: rgba(245, 158, 11, 0.8);
  --border-hover: rgba(251, 191, 36, 0.35);

  --primary: #f59e0b;
  --primary-light: #fde047;
  --primary-dark: #b45309;
  --primary-gradient: linear-gradient(135deg, #f59e0b 0%, #eab308 50%, #facc15 100%);
  --primary-glow: 0 0 28px rgba(245, 158, 11, 0.45);
  --accent-glow: 0 0 32px rgba(234, 179, 8, 0.3);

  --text-main: #fffbeb;
  --text-muted: #fef08a;
  --text-dim: #ca8a04;

  --ok: #10b981;
  --ok-bg: rgba(16, 185, 129, 0.14);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.14);

  --glow-bg-1: radial-gradient(ellipse at 15% 0%, rgba(245, 158, 11, 0.14) 0%, transparent 45%);
  --glow-bg-2: radial-gradient(ellipse at 85% 10%, rgba(234, 179, 8, 0.12) 0%, transparent 45%);
  --glow-bg-3: radial-gradient(ellipse at 50% 100%, rgba(217, 119, 6, 0.09) 0%, transparent 50%);
}

/* ==========================================================================
   GLOBAL DESIGN TOKENS
   ========================================================================== */
:root {
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --font-sans: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', 'Be Vietnam Pro', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--bg-base);
  background-image: var(--glow-bg-1), var(--glow-bg-2), var(--glow-bg-3);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   TOPBAR NAVIGATION & BRANDING
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  background: rgba(9, 11, 17, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--primary-glow);
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  transition: transform var(--transition-bounce);
}

.brand-wrapper:hover .brand-logo {
  transform: rotate(5deg) scale(1.05);
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.03em;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--primary-light);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brand-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

/* Center Search Bar in Topbar */
.topbar-center {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
}

.topbar-search {
  width: 100%;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 8px 16px 8px 36px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition-normal);
}

.topbar-search input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.topbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
}

/* Topbar Right Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Selector Pills */
.theme-picker {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.theme-btn {
  border: none;
  background: transparent;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.theme-btn:hover {
  transform: scale(1.15);
}

.theme-btn.active {
  box-shadow: 0 0 0 2px #fff;
  transform: scale(1.1);
}

.theme-btn[data-set-theme="iris"] { background: linear-gradient(135deg, #6366f1, #d946ef); }
.theme-btn[data-set-theme="emerald"] { background: linear-gradient(135deg, #10b981, #06b6d4); }
.theme-btn[data-set-theme="amber"] { background: linear-gradient(135deg, #f59e0b, #e11d48); }
.theme-btn[data-set-theme="slate"] { background: linear-gradient(135deg, #38bdf8, #6366f1); }
.theme-btn[data-set-theme="gold"] { background: linear-gradient(135deg, #fbbf24, #b45309); }

/* System Health Indicator Pill */
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  cursor: help;
  transition: all var(--transition-fast);
}

.health-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Navigation Tabs */
nav {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 7px 15px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition-normal);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 2px 14px rgba(139, 92, 246, 0.35);
}

/* ==========================================================================
   MAIN CONTAINER & TYPOGRAPHY
   ========================================================================== */
main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

h2 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view { display: none; }
.view.active { display: block; animation: viewFade 0.28s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes viewFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   CARDS & GLASSMORPHISM
   ========================================================================== */
.card {
  background: var(--bg-surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.45);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
  border-color: var(--border-hover);
}

/* ==========================================================================
   DASHBOARD STATS GRID (BALANCED 4-CARD OVERVIEW)
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-gradient);
  opacity: 0.6;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.4);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

@media (max-width: 960px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   BUTTONS & INTERACTIVE ELEMENTS
   ========================================================================== */
.btn {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--bg-surface-hover);
  color: #fff;
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.35);
}

.btn.primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5);
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.btn.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.25);
}

.btn.danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn.small {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn.wide {
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  border-radius: var(--radius-md);
}

.btn.link {
  background: transparent;
  border: none;
  color: var(--primary-light);
  padding: 4px 8px;
}

.btn.link:hover {
  text-decoration: underline;
  background: transparent;
  transform: none;
}

/* ==========================================================================
   INPUTS & FORM CONTROLS
   ========================================================================== */
input[type="text"],
input[type="url"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  width: 100%;
}

input[type="text"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
}

textarea {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

/* ==========================================================================
   TABLES & LISTS
   ========================================================================== */
.table-wrap {
  background: var(--bg-surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.45);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ==========================================================================
   BADGES & PLATFORM CHIPS
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-platform {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.badge-platform.tiktok {
  background: rgba(236, 72, 153, 0.14);
  color: #f472b6;
  border-color: rgba(236, 72, 153, 0.3);
}

.badge-platform.douyin {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.badge-platform.bilibili {
  background: rgba(14, 165, 233, 0.14);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.3);
}

.badge-status {
  font-weight: 700;
}

.badge-status.ok {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-status.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* ==========================================================================
   PROGRESS BARS
   ========================================================================== */
.progress {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.eta {
  margin: -4px 0 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.eta b {
  color: var(--primary-light);
}

.eta-mini {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--primary-light);
}

.progress.mini {
  height: 6px;
  width: 80px;
  display: inline-block;
  margin: 0 10px 0 0;
  vertical-align: middle;
}

.bar {
  background: var(--primary-gradient);
  height: 100%;
  width: 0;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

/* ==========================================================================
   BALANCED 2-COLUMN STUDIO LAYOUT
   ========================================================================== */
.detail-layout {
  display: grid;
  grid-template-columns: 52% 48%;
  gap: 24px;
  align-items: start;
}

.left-col {
  position: sticky;
  top: 76px;
}

@media (max-width: 1080px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .left-col {
    position: static;
  }
}

/* Video Player Hub */
.preview-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

#detail-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  outline: none;
}

#preview-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  margin: 0;
}

.preview-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.preview-switch .btn.active {
  background: rgba(139, 92, 246, 0.18);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* Pipeline Step Actions */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* Sliders & Mixers */
.mixer {
  margin-top: 16px;
  padding: 16px;
  background: rgba(16, 21, 33, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.mixer summary {
  cursor: pointer;
  color: var(--text-main);
  font-weight: 700;
  padding: 2px 0;
  user-select: none;
}

.mixer summary:hover {
  color: var(--primary-light);
}

.slider-row {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
}

.slider-row label {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.slider-row input[type="range"] {
  accent-color: var(--primary);
  cursor: pointer;
}

.slider-value {
  color: var(--primary-light);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
  margin: 12px 0;
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   RIGHT COLUMN STUDIO TABS & PANELS
   ========================================================================== */
.studio-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: rgba(16, 21, 33, 0.75);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.studio-tab {
  flex: 1 1 105px;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 9px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.studio-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.studio-tab.active {
  background: var(--bg-surface-elevated);
  color: var(--primary-light);
  border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.studio-content {
  display: none;
}

.studio-content.active {
  display: block;
  animation: viewFade 0.22s ease;
}

/* Artifacts Download Chips */
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.downloads a {
  text-decoration: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  font-size: 12px;
  color: var(--text-main);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-normal);
}

.downloads a:hover {
  border-color: var(--primary);
  color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

/* Scroll Containers */
.scroll {
  max-height: 440px;
  overflow-y: auto;
  padding-right: 6px;
}

.scroll::-webkit-scrollbar {
  width: 6px;
}

.scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 999px;
}

.scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.scroll::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Segments in Transcript, Scenes & Logs */
.seg {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  gap: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  font-size: 13px;
  align-items: baseline;
}

.seg:hover {
  background: rgba(255, 255, 255, 0.04);
}

.seg.active-speaking {
  background: rgba(139, 92, 246, 0.18);
  border-left: 3px solid var(--primary);
}

.seg .time {
  color: var(--primary-light);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.seg .vi {
  color: var(--ok);
  font-weight: 500;
}

dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px 16px;
  margin: 0;
  font-size: 13px;
}

dt {
  color: var(--text-dim);
  font-weight: 600;
}

dd {
  margin: 0;
  color: var(--text-main);
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.muted { color: var(--text-muted); }
.error { color: var(--danger); font-weight: 600; }
.warn { color: var(--warning); }
.result { margin-top: 10px; font-weight: 600; font-size: 13px; min-height: 20px; }
.break { word-break: break-all; }
.hint { font-size: 12px; margin-top: 8px; line-height: 1.5; color: var(--text-dim); }

/* ==========================================================================
   9-STAGE PIPELINE STEPPER
   ========================================================================== */
.pipeline-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  backdrop-filter: blur(16px);
  position: relative;
  overflow-x: auto;
  gap: 6px;
}

.step-node {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  cursor: pointer;
  transition: all var(--transition-normal);
  opacity: 0.5;
}

.step-node.completed {
  opacity: 1;
}

.step-node.completed .step-num {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: var(--ok);
}

.step-node.active {
  opacity: 1;
  transform: scale(1.03);
}

.step-node.active .step-num {
  background: var(--primary-gradient);
  color: #fff;
  border-color: var(--primary-light);
  box-shadow: var(--primary-glow);
  animation: pulseNode 1.8s infinite;
}

@keyframes pulseNode {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.6); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(139, 92, 246, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.step-meta {
  display: flex;
  flex-direction: column;
}

.step-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
  white-space: nowrap;
}

.step-sub {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.step-line {
  flex: 1;
  min-width: 14px;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 6px;
  transition: background var(--transition-normal);
}

.step-line.completed {
  background: var(--ok);
}

/* ==========================================================================
   INTERACTIVE SUBTITLE STUDIO & KARAOKE SYNC
   ========================================================================== */
.seg {
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.seg:hover {
  background: rgba(255, 255, 255, 0.05);
}

.seg.karaoke-active {
  background: rgba(139, 92, 246, 0.16) !important;
  border-left: 3px solid var(--primary) !important;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.2);
  transform: translateX(3px);
}

.seg-actions {
  opacity: 0;
  transition: opacity var(--transition-fast);
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.seg:hover .seg-actions {
  opacity: 1;
}

.seg-edit-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.seg-edit-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-hover);
}

.seg-edit-box {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
}

.seg-edit-box input {
  flex: 1;
  font-size: 12.5px;
  padding: 6px 10px;
}

/* ==========================================================================
   BATCH IMPORT TOGGLE & TEXTAREA
   ========================================================================== */
.batch-tab-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.batch-toggle-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.batch-toggle-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--primary-light);
  border-color: var(--primary);
}

.batch-textarea {
  width: 100%;
  height: 140px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  resize: vertical;
  margin-bottom: 12px;
}

.batch-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}


/* ==========================================================================
   FAST HARDSUB STUDIO & ROI CANVAS STYLES
   ========================================================================== */

.roi-container {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.roi-video-wrapper {
  position: relative;
  width: 100%;
  display: inline-block;
}

.roi-video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
}

.roi-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  pointer-events: auto;
}

.roi-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  margin-top: 10px;
}

.roi-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(139, 92, 246, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.cue-table-wrap {
  max-height: 440px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.cue-row {
  display: grid;
  grid-template-columns: 50px 90px 110px 1fr 1fr 60px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.cue-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.cue-crop-thumb {
  width: 80px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cue-input {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-main);
  font-size: 13px;
}

.cue-input:focus {
  border-color: var(--primary);
  outline: none;
}

.step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color var(--transition-normal), background var(--transition-normal), opacity var(--transition-normal);
}

.step-card.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.10), var(--bg-surface));
  box-shadow: inset 3px 0 0 var(--primary);
}

.step-card.completed {
  border-color: rgba(16, 185, 129, 0.34);
}

.step-card.completed .step-number {
  background: var(--ok-bg);
  color: var(--ok);
}

.step-card.locked {
  opacity: 0.62;
}

.step-state-badge {
  font-size: 10px;
  line-height: 1;
  padding: 5px 7px;
  border-radius: 999px;
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
  font-weight: 700;
}

.step-card.completed .step-state-badge {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(16, 185, 129, 0.3);
}

.step-card.active .step-state-badge {
  color: var(--primary-light);
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.35);
}

.automation-card {
  padding: 14px 16px;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.015);
}

.task-activity {
  margin: 0 0 18px;
  padding: 20px;
  border: 1px solid rgba(96, 165, 250, 0.34);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98));
  box-shadow: 0 12px 34px rgba(2, 6, 23, 0.24);
}
.task-activity-head, .task-progress-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.task-activity-head h2 { margin: 3px 0 2px; font-size: 18px; }
.task-activity-head p { margin: 0; color: var(--text-muted, #94a3b8); }
.task-state { padding: 7px 10px; border-radius: 999px; background: rgba(59,130,246,.16); color: #93c5fd; font-size: 11px; font-weight: 800; letter-spacing: .05em; }
.task-state.done { background: rgba(16,185,129,.16); color: #6ee7b7; }
.task-state.failed, .task-state.cancelled { background: rgba(239,68,68,.16); color: #fca5a5; }
.task-progress-line { margin-top: 16px; }
.task-progress-track { flex: 1; height: 12px; overflow: hidden; border-radius: 999px; background: rgba(148,163,184,.16); }
.task-progress-track > div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#2563eb,#22d3ee); transition: width .35s ease; }
.task-progress-line > strong { min-width: 46px; text-align: right; font-size: 16px; }
.task-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.task-metrics > div { padding: 10px 12px; border-radius: 10px; background: rgba(148,163,184,.07); }
.task-metrics span, .task-metrics strong { display: block; }
.task-metrics span { margin-bottom: 4px; color: var(--text-muted,#94a3b8); font-size: 11px; }
.task-metrics strong { font-size: 13px; }
.task-history-wrap { margin-top: 16px; border-top: 1px solid rgba(148,163,184,.14); padding-top: 13px; }
.task-history-title { margin-bottom: 8px; font-size: 12px; font-weight: 700; color: #cbd5e1; }
.task-history { display: grid; gap: 6px; max-height: 190px; overflow: auto; }
.task-event { display: grid; grid-template-columns: 70px 52px 1fr; gap: 8px; font-size: 12px; color: #cbd5e1; }
.task-event time { color: #94a3b8; font-variant-numeric: tabular-nums; }
.task-event b { color: #67e8f9; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .task-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } .task-activity-head { align-items: flex-start; } }

.next-action-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  margin: 0 0 18px;
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.14), rgba(16, 21, 33, 0.82));
}

.next-action-index {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-gradient);
  color: #fff;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
}

.next-action-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.next-action-copy .eyebrow {
  color: var(--primary-light);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

.next-action-copy strong {
  font-size: 15px;
}

.next-action-copy > span:last-child {
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 700px) {
  .next-action-card {
    grid-template-columns: 40px 1fr;
  }

  .next-action-card .btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

.step-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.step-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

.key-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.modal-card {
  width: 100%;
  max-width: 580px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 26px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

/* QA Verification Scorecard */
.cue-header-row {
  display: grid;
  grid-template-columns: 50px 90px 110px 1fr 1fr 60px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.qa-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
}

.qa-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.qa-metric-row:last-child {
  border-bottom: none;
}

.qa-pass {
  color: var(--ok);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.qa-fail {
  color: var(--danger);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.qa-warn {
  color: var(--warning);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}


/* Custom cue grids for 9-step studio */
.cue-ocr-grid {
  display: grid;
  grid-template-columns: 45px 90px 105px 1fr 65px 175px;
  gap: 8px;
  align-items: center;
}

.cue-trans-grid {
  display: grid;
  grid-template-columns: 32px 40px 105px 1fr 1.2fr 165px;
  gap: 8px;
  align-items: center;
}

.cue-voice-grid {
  display: grid;
  grid-template-columns: 45px 110px 1fr 130px 160px;
  gap: 8px;
  align-items: center;
}

.cue-action-btns {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}

.cue-ocr-grid .cue-action-btns { flex-wrap: wrap; }
.cue-ocr-grid .btn-delete-cue { white-space: nowrap; font-weight: 600; }

.cue-action-btn {
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cue-action-btn:hover {
  background: var(--bg-surface);
  border-color: var(--primary-light);
}

.cue-action-btn.danger {
  color: var(--danger);
}
.cue-action-btn.danger:hover {
  border-color: var(--danger);
}

/* Durable provider usage: responsive cards and horizontal log scrolling. */
.usage-panel { width:min(1180px,96vw); max-width:1180px; max-height:92vh; overflow:auto; }
.usage-filters { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin:18px 0; }
.usage-filters label { flex:1; min-width:160px; display:grid; gap:6px; }
.usage-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; margin:16px 0; }
.usage-card { border:1px solid var(--border-subtle); border-radius:10px; padding:16px; background:var(--bg-input); }
.usage-card strong { display:block; font-size:22px; margin:8px 0; }
.usage-scroll { overflow-x:auto; margin-bottom:20px; }
.usage-scroll table { width:100%; border-collapse:collapse; font-size:12px; white-space:nowrap; }
.usage-scroll th,.usage-scroll td { text-align:left; padding:10px; border-bottom:1px solid var(--border-subtle); }
.usage-panel details { max-width:330px; white-space:normal; }
.usage-panel summary { cursor:pointer; }
.cloud-controls { display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }
.cloud-policy { display:flex; align-items:center; gap:10px; margin:12px 0; }
#cloud-setup { border:1px solid var(--border-subtle); padding:16px; border-radius:8px; margin:16px 0; max-width:none; }
#cloud-modal a { color:var(--primary); }
#cloud-cancel-task[hidden] { display:none; }
#cloud-message { color:var(--text-main); overflow-wrap:anywhere; }
#cloud-library td { white-space:normal; min-width:130px; }
.usage-filters input { width:100%; padding:9px 12px; border:1px solid var(--border-subtle); border-radius:6px; background:var(--bg-input); color:var(--text-main); font:inherit; }
@media (max-width:800px) {
  .topbar { flex-wrap:wrap; padding:12px; }
  .topbar-center { display:none; }
  .topbar-right { width:100%; min-width:0; flex-wrap:wrap; justify-content:flex-start; }
  .topbar nav { flex-wrap:wrap; }
  .usage-panel { padding:16px; }
}
