/* ==========================================================================
   AutoSubAI Design System — Full Dashboard Layout
   Typography: Inter (English/Code) + Prompt (Thai)
   Style: Enterprise Dark, Sidebar + Top Navbar + Stats Cards + Tables
   ========================================================================== */

:root {
  /* Background Layers */
  --bg-darkest:   #070b14;
  --bg-sidebar:   #0d1117;
  --bg-base:      #111827;
  --bg-surface:   #1a2235;
  --bg-card:      rgba(26, 34, 53, 0.85);
  --bg-glass:     rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --bg-input:     #0f1623;

  /* Borders */
  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-glass:   rgba(255, 255, 255, 0.09);
  --border-focus:   rgba(99, 102, 241, 0.65);
  --border-glow:    rgba(6, 182, 212, 0.35);
  --sidebar-border: rgba(255, 255, 255, 0.07);

  /* Brand Colors */
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-hover:  #5558e8;
  --primary-glow:   rgba(99, 102, 241, 0.35);
  --primary-muted:  rgba(99, 102, 241, 0.15);

  --cyan:       #22d3ee;
  --cyan-glow:  rgba(34, 211, 238, 0.25);
  --cyan-muted: rgba(34, 211, 238, 0.12);

  --emerald:       #10b981;
  --emerald-glow:  rgba(16, 185, 129, 0.25);
  --emerald-muted: rgba(16, 185, 129, 0.12);

  --amber:       #f59e0b;
  --amber-muted: rgba(245, 158, 11, 0.12);

  --rose:       #f43f5e;
  --rose-muted: rgba(244, 63, 94, 0.12);

  --violet:       #8b5cf6;
  --violet-muted: rgba(139, 92, 246, 0.12);

  /* Text */
  --text-main:  #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim:   #64748b;
  --text-sidebar-inactive: #718096;

  /* Fonts */
  --font-thai: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-en:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Spacing & Shape */
  --sidebar-width:          240px;
  --sidebar-collapsed-width: 64px;
  --navbar-height:          60px;
  --radius-xs:  6px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  22px;
  --radius-full: 9999px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-sidebar: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-darkest);
  color: var(--text-main);
  font-family: var(--font-thai);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ==========================================================================
   App Layout Shell
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  transition: width var(--transition-sidebar), transform var(--transition-sidebar);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

/* Sidebar Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1rem 1rem 1.1rem;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: var(--navbar-height);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--cyan) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 0 18px var(--primary-glow);
  letter-spacing: -0.5px;
  font-family: var(--font-en);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--transition-sidebar);
}

.sidebar-brand-name {
  font-family: var(--font-en);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.sidebar-brand-tag {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar.collapsed .sidebar-brand-text {
  opacity: 0;
  pointer-events: none;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.75rem 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 1rem 1.1rem 0.4rem;
  white-space: nowrap;
  transition: opacity var(--transition-sidebar);
}

.sidebar.collapsed .sidebar-section-label {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.62rem 1.1rem;
  margin: 1px 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar-inactive);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-glass);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-muted);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-label {
  transition: opacity var(--transition-sidebar);
  overflow: hidden;
}

.sidebar.collapsed .nav-label {
  opacity: 0;
  width: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--primary-muted);
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  transition: opacity var(--transition-sidebar);
}

.sidebar.collapsed .nav-badge {
  opacity: 0;
}

/* Sidebar Divider */
.sidebar-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 0.5rem 1rem;
}

/* Sidebar User */
.sidebar-user {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  overflow: hidden;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: var(--bg-glass);
}

.user-avatar {
  width: 32px;
  min-width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-en);
}

.user-info {
  overflow: hidden;
  transition: opacity var(--transition-sidebar);
}

.sidebar.collapsed .user-info {
  opacity: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ==========================================================================
   Main Area
   ========================================================================== */
.main-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-sidebar), width var(--transition-sidebar), max-width var(--transition-sidebar);
  overflow-x: hidden;
}

.main-area.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
  max-width: calc(100% - var(--sidebar-collapsed-width));
}

/* ==========================================================================
   Top Navbar
   ========================================================================== */
.top-navbar {
  height: var(--navbar-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-toggle {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.navbar-toggle:hover {
  background: var(--bg-glass);
  color: var(--text-main);
}

.navbar-search {
  flex: 1;
  max-width: 360px;
  position: relative;
}

.navbar-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.45rem 0.9rem 0.45rem 2.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.navbar-search input:focus {
  border-color: var(--border-focus);
}

.navbar-search input::placeholder {
  color: var(--text-dim);
}

.search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.navbar-spacer { flex: 1; }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Notification Button */
.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.notif-btn:hover {
  background: var(--bg-glass);
  color: var(--text-main);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--emerald);
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Status Badge in Navbar */
.navbar-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald);
  background: var(--emerald-muted);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.navbar-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 6px var(--emerald);
  animation: pulse-dot 2s infinite;
}

/* Profile Button */
.profile-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.3rem 0.7rem 0.3rem 0.4rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.82rem;
  font-weight: 600;
}

.profile-btn:hover {
  border-color: var(--border-glass);
  background: var(--bg-glass);
}

.profile-avatar {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-en);
}

/* ==========================================================================
   Page Content
   ========================================================================== */
.page-content {
  flex: 1;
  padding: 1.75rem 2rem;
  max-width: 1400px;
  width: 100%;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title-group {}

.page-breadcrumb {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.breadcrumb-sep { color: var(--text-dim); }

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Pages (Sections that show/hide)
   ========================================================================== */
.page-section {
  display: none;
}
.page-section.active {
  display: block;
}

/* ==========================================================================
   Stats Cards
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

@media (max-width: 1080px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 580px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
  cursor: default;
}

.stat-card:hover {
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-1px);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card-label,
.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.stat-card-value,
.stat-value {
  font-family: var(--font-en);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-card-change {
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-card-change.up   { color: var(--emerald); }
.stat-card-change.down { color: var(--rose); }
.stat-card-change.neutral { color: var(--text-muted); }

/* Stat card color variants */
.stat-icon-indigo  { background: var(--primary-muted); color: var(--primary); }
.stat-icon-cyan    { background: var(--cyan-muted);    color: var(--cyan); }
.stat-icon-emerald { background: var(--emerald-muted); color: var(--emerald); }
.stat-icon-amber   { background: var(--amber-muted);   color: var(--amber); }
.stat-icon-violet  { background: var(--violet-muted);  color: var(--violet); }
.stat-icon-rose    { background: var(--rose-muted);    color: var(--rose); }

/* ==========================================================================
   Glass Panel / Cards
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.4rem;
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   Data Table
   ========================================================================== */
.data-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-glass);
}

.data-table .cell-muted {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.data-table .cell-mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.data-table .cell-bold {
  font-weight: 600;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.badge-success  { background: var(--emerald-muted); color: var(--emerald); border: 1px solid rgba(16,185,129,0.2); }
.badge-success .badge-dot  { background: var(--emerald); }

.badge-processing { background: var(--cyan-muted); color: var(--cyan); border: 1px solid rgba(34,211,238,0.2); }
.badge-processing .badge-dot { background: var(--cyan); animation: pulse-dot 1.5s infinite; }

.badge-error    { background: var(--rose-muted); color: var(--rose); border: 1px solid rgba(244,63,94,0.2); }
.badge-error .badge-dot { background: var(--rose); }

.badge-warning  { background: var(--amber-muted); color: var(--amber); border: 1px solid rgba(245,158,11,0.2); }
.badge-warning .badge-dot { background: var(--amber); }

.badge-neutral  { background: var(--bg-glass); color: var(--text-muted); border: 1px solid var(--border-subtle); }

.cluster-badge { /* alias */ }
.cluster-badge { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.7rem; border-radius: var(--radius-full); }
.cluster-badge.online { background: var(--emerald-muted); color: var(--emerald); border: 1px solid rgba(16,185,129,0.2); }
.cluster-badge.down   { background: var(--rose-muted); color: var(--rose); border: 1px solid rgba(244,63,94,0.2); }
.cluster-badge:not(.online):not(.down) { background: var(--emerald-muted); color: var(--emerald); border: 1px solid rgba(16,185,129,0.2); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-smooth);
  box-shadow: 0 3px 15px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-glass);
  border-color: var(--border-glass);
  color: var(--text-main);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.btn-ghost:hover {
  background: var(--bg-glass);
  color: var(--text-main);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--rose);
  border: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger-ghost:hover {
  background: var(--rose-muted);
}

.btn-download {
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-download:hover {
  background: var(--bg-glass);
  border-color: var(--primary);
  color: #fff;
}

.btn-icon {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
}

.btn-icon:hover {
  background: var(--bg-glass);
  color: var(--text-main);
}

/* ==========================================================================
   Form Inputs
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.custom-select,
.custom-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.custom-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2.2rem;
}

.custom-select:focus,
.custom-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ==========================================================================
   Dropzone
   ========================================================================== */
.dropzone {
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  background: rgba(15, 22, 35, 0.5);
  cursor: pointer;
  transition: all var(--transition-smooth);
  position: relative;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: var(--primary-muted);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.dropzone-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ==========================================================================
   Options Row
   ========================================================================== */
.options-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

/* ==========================================================================
   Media Player & Results
   ========================================================================== */
.player-container {
  margin-top: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1.4rem;
}

.media-player-wrapper {
  margin-bottom: 1.25rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

audio {
  width: 100%;
  outline: none;
  border-radius: 4px;
}

.subtitles-box {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(7, 11, 20, 0.6);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.subtitle-item {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-xs);
  background: transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  border-left: 3px solid transparent;
}

.subtitle-item:hover  { background: var(--bg-glass-hover); }
.subtitle-item.active { background: rgba(99,102,241,0.12); border-left-color: var(--primary); }

.sub-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cyan);
  white-space: nowrap;
  padding-top: 2px;
}

.sub-text {
  font-size: 0.92rem;
  color: var(--text-main);
  flex: 1;
}

.download-toolbar {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Code Block
   ========================================================================== */
.code-box {
  background: #0d1117;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 1rem;
}

.code-header {
  background: #161b22;
  padding: 0.55rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.code-tabs {
  display: flex;
  gap: 0.3rem;
}

.code-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.28rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
}

.code-tab.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.code-content {
  padding: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #e6edf3;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.55;
}

/* ==========================================================================
   GPU Status Cards
   ========================================================================== */
.gpu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.gpu-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gpu-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.gpu-card-title {
  font-size: 0.9rem;
  font-weight: 700;
}

.gpu-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  line-height: 1.7;
}

/* ==========================================================================
   Quick Actions Panel
   ========================================================================== */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.quick-action-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.quick-action-btn:hover {
  border-color: var(--primary);
  background: var(--primary-muted);
}

.quick-action-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.quick-action-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quick-action-btn:hover .quick-action-label {
  color: var(--primary);
}

/* ==========================================================================
   Two-column layout for dashboard
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Usage / Stats Section
   ========================================================================== */
.usage-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
}

.credit-display {
  font-family: var(--font-en);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--cyan);
  line-height: 1;
  margin: 0.5rem 0 0.25rem;
  letter-spacing: -1px;
}

.credit-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.open { display: flex !important; }

.modal-content {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ==========================================================================
   Divider
   ========================================================================== */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 1.25rem 0;
}

/* ==========================================================================
   Utility
   ========================================================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-mono { font-family: var(--font-mono); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    width: var(--sidebar-width);
  }
  .main-area,
  .main-area.sidebar-collapsed {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .page-content {
    padding: 1.25rem 1rem;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .navbar-search {
    display: none;
  }
}

/* ==========================================================================
   NEW FEATURE STYLES — Phase 1-5 Addition
   ========================================================================== */

/* ---- Light Theme Override ---- */
[data-theme="light"] {
  --bg-darkest:   #f8fafc;
  --bg-sidebar:   #1e293b;
  --bg-base:      #f1f5f9;
  --bg-surface:   #ffffff;
  --bg-card:      rgba(255, 255, 255, 0.95);
  --bg-input:     #f8fafc;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-glass:  rgba(0, 0, 0, 0.12);
  --text-main:  #1e293b;
  --text-muted: #64748b;
  --text-dim:   #94a3b8;
  --text-sidebar-inactive: #cbd5e1;
}

/* ---- Auth Modal ---- */
.auth-modal-box { max-width: 400px; width: 100%; }
.auth-modal-header { display: flex; align-items: center; gap: 12px; justify-content: center; padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 20px; }
.auth-modal-header h2 { margin: 0; font-size: 22px; }
.auth-tabs { display: flex; gap: 2px; background: var(--bg-input); border-radius: var(--radius-md); padding: 3px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 8px; border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-family: var(--font-thai); transition: all 0.2s; }
.auth-tab.active { background: var(--primary); color: white; }
.form-note { font-size: 12px; color: var(--text-muted); text-align: center; margin-bottom: 12px; }
.form-error { color: var(--rose); font-size: 13px; padding: 8px 12px; background: var(--rose-muted); border-radius: var(--radius-sm); margin-bottom: 12px; }

/* ---- Playground Tabs ---- */
.tab-nav { display: flex; gap: 2px; background: var(--bg-input); border-radius: var(--radius-md); padding: 4px; margin-bottom: 20px; width: fit-content; }
.tab-btn { padding: 8px 16px; border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-thai); font-size: 14px; transition: all 0.2s; white-space: nowrap; }
.tab-btn.active { background: var(--primary); color: white; }

/* ---- URL Input ---- */
.url-input-wrap { padding: 8px 0; }
.input-hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* ---- Audio Recorder ---- */
.record-panel { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 32px 24px; }
.record-viz { width: 100%; height: 64px; display: flex; align-items: center; justify-content: center; }
.record-wave { display: flex; gap: 4px; align-items: flex-end; height: 48px; }
.wave-bar { width: 6px; background: var(--primary); border-radius: 3px; height: 12px; transition: height 0.1s; }
.wave-bar.animate { animation: wave-anim 0.5s ease-in-out infinite alternate; }
.wave-bar:nth-child(1).animate { animation-delay: 0s; }
.wave-bar:nth-child(2).animate { animation-delay: 0.07s; }
.wave-bar:nth-child(3).animate { animation-delay: 0.14s; }
.wave-bar:nth-child(4).animate { animation-delay: 0.21s; }
.wave-bar:nth-child(5).animate { animation-delay: 0.28s; }
.wave-bar:nth-child(6).animate { animation-delay: 0.35s; }
.wave-bar:nth-child(7).animate { animation-delay: 0.42s; }
.wave-bar:nth-child(8).animate { animation-delay: 0.49s; }
@keyframes wave-anim { from { height: 8px; } to { height: 44px; } }
.record-timer { font-size: 40px; font-family: var(--font-mono); color: var(--text-main); font-weight: 700; letter-spacing: 2px; }
.record-controls { display: flex; gap: 12px; align-items: center; }

/* ---- Options Grid ---- */
.options-card { margin-top: var(--space-4); }
.options-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.options-flags { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.toggle-label input[type="checkbox"] { display: none; }
.toggle-slider { width: 36px; height: 20px; background: var(--bg-input); border-radius: 10px; position: relative; transition: background 0.2s; flex-shrink: 0; border: 1px solid var(--border-subtle); }
.toggle-slider::after { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: white; top: 2px; left: 2px; transition: transform 0.2s; }
.toggle-label input:checked + .toggle-slider { background: var(--primary); }
.toggle-label input:checked + .toggle-slider::after { transform: translateX(16px); }

/* ---- Progress Bar ---- */
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; }
.progress-bar-wrap { height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); border-radius: 4px; transition: width 0.4s ease; }
.progress-msg { font-size: 12px; color: var(--text-muted); }

/* ---- Result Card ---- */
.result-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.result-tab-nav { display: flex; gap: 4px; margin-bottom: 12px; }
.result-tab { padding: 6px 14px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-family: var(--font-thai); transition: all 0.2s; }
.result-tab.active { background: var(--primary-muted); color: var(--primary); border-color: var(--primary); }
.result-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.result-text-box { background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 16px; font-family: var(--font-thai); line-height: 1.8; max-height: 300px; overflow-y: auto; font-size: 15px; color: var(--text-main); white-space: pre-wrap; }
.keyword-badge { display: inline-block; padding: 3px 10px; background: var(--primary-muted); color: var(--primary); border-radius: 20px; font-size: 12px; margin: 3px; }

/* ---- Dropdown ---- */
.dropdown-wrap { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 4px); right: 0; background: var(--bg-surface); border: 1px solid var(--border-glass); border-radius: var(--radius-md); min-width: 180px; z-index: 500; overflow: hidden; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.dropdown-menu.visible { display: block; }
.dropdown-menu button { display: block; width: 100%; padding: 10px 16px; border: none; background: transparent; color: var(--text-main); text-align: left; cursor: pointer; font-size: 14px; font-family: var(--font-thai); transition: background 0.15s; }
.dropdown-menu button:hover { background: var(--bg-glass-hover); }

/* ---- Subtitle Player ---- */
.sub-player { background: var(--bg-input); border-radius: var(--radius-md); padding: 16px; }
.sub-display { min-height: 48px; text-align: center; font-size: 20px; font-family: var(--font-thai); color: var(--text-main); padding: 12px; background: rgba(0,0,0,0.3); border-radius: var(--radius-sm); margin-top: 8px; font-weight: 500; }

/* ---- Toast ---- */
#toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border-glass); box-shadow: 0 4px 20px rgba(0,0,0,0.4); transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); max-width: 360px; pointer-events: all; }
.toast.visible { transform: translateX(0); }
.toast-success { border-left: 3px solid var(--emerald); }
.toast-error { border-left: 3px solid var(--rose); }
.toast-info { border-left: 3px solid var(--cyan); }
.toast-warning { border-left: 3px solid var(--amber); }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg { font-size: 14px; color: var(--text-main); font-family: var(--font-thai); }

/* ---- Transcript Editor ---- */
.editor-layout { display: grid; grid-template-columns: 380px 1fr; gap: var(--space-4); align-items: start; }
.editor-segments-list { max-height: 70vh; overflow-y: auto; }
.editor-segment { display: grid; grid-template-columns: 28px 1fr auto; grid-template-rows: auto auto; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); transition: background 0.15s; }
.editor-segment:hover { background: var(--bg-glass); }
.editor-segment.active { background: var(--primary-muted); border-left: 3px solid var(--primary); }
.seg-index { grid-row: 1 / 3; font-size: 11px; color: var(--text-dim); display: flex; align-items: center; justify-content: center; }
.seg-timestamps { display: flex; align-items: center; gap: 6px; }
.seg-timestamps input { width: 68px; padding: 3px 6px; font-size: 12px; font-family: var(--font-mono); }
.seg-play-btn { padding: 3px 8px; font-size: 11px; }
.seg-text { width: 100%; resize: vertical; min-height: 48px; }
.seg-actions { display: flex; gap: 4px; flex-direction: column; }
.seg-split-btn, .seg-merge-btn, .seg-delete-btn { padding: 3px 6px; font-size: 12px; border-radius: 4px; cursor: pointer; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-muted); transition: all 0.15s; }
.seg-delete-btn:hover { background: var(--rose-muted); color: var(--rose); }
.seg-split-btn:hover, .seg-merge-btn:hover { background: var(--primary-muted); color: var(--primary); }
.editor-toolbar-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.editor-meta-row { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.has-changes { animation: pulse-glow 1.5s ease-in-out infinite; }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); } 50% { box-shadow: 0 0 0 6px rgba(99,102,241,0); } }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 24px; text-align: center; gap: 16px; }
.empty-icon { font-size: 56px; }
.empty-state h3 { font-size: 20px; color: var(--text-main); margin: 0; }
.empty-state p { color: var(--text-muted); margin: 0; max-width: 400px; }
.empty-state-sm { text-align: center; padding: 32px; color: var(--text-muted); }

/* ---- Batch Upload ---- */
.batch-options { display: flex; gap: 16px; margin: 16px 0; flex-wrap: wrap; }
.batch-file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; max-height: 300px; overflow-y: auto; }
.batch-file-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-input); border-radius: var(--radius-sm); }
.batch-file-name { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-file-size { font-size: 12px; color: var(--text-muted); }
.batch-queue-item { display: grid; grid-template-columns: 1fr 150px 80px 32px; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.batch-q-filename { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-q-progress { height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.batch-q-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); transition: width 0.3s; }

/* ---- Playground Multi-Job Queue (1 Row Per File) ---- */
.playground-queue-card {
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  background: rgba(15, 23, 42, 0.85) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-lg);
}
.playground-queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.playground-job-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) minmax(200px, 2fr) 120px 140px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-left: 4px solid #38bdf8;
  border-radius: 8px;
  transition: all 0.25s ease;
}
.playground-job-row:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-1px);
}
.playground-job-row.completed {
  border-left-color: #10b981;
}
.playground-job-row.failed {
  border-left-color: #ef4444;
}
.pg-job-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.pg-job-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.pg-job-filename {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pg-job-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
}
.pg-job-progress-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pg-job-msg {
  font-size: 11px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pg-job-bar-wrap {
  height: 6px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.pg-job-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.pg-job-bar.completed {
  background: linear-gradient(90deg, #10b981, #059669);
}
.pg-job-status-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  text-align: center;
  white-space: nowrap;
  display: inline-block;
}
.pg-job-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
@media (max-width: 860px) {
  .playground-job-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .pg-job-actions {
    justify-content: flex-start;
  }
}

/* ---- Webhooks ---- */
.webhook-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px; border-bottom: 1px solid var(--border-subtle); }
.webhook-info { flex: 1; min-width: 0; }
.webhook-url code { font-size: 13px; word-break: break-all; }
.webhook-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.webhook-secret { margin-top: 6px; }
.webhook-secret code { font-size: 11px; color: var(--text-dim); }
.checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* ---- Topup Modal (High-Contrast & Elevated) ---- */
#topup-modal .modal-box {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%) !important;
  border: 1.5px solid rgba(148, 163, 184, 0.35) !important;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 40px rgba(99, 102, 241, 0.2) !important;
  color: #ffffff !important;
}
#topup-modal .modal-header h3 {
  color: #ffffff !important;
  font-size: 18px;
  font-weight: 700;
}
#topup-modal .modal-close {
  color: #cbd5e1 !important;
  font-size: 16px;
}
#topup-modal .modal-close:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.1);
}
.topup-packages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.topup-pkg {
  background: rgba(30, 41, 59, 0.85) !important;
  border: 1.5px solid rgba(148, 163, 184, 0.3) !important;
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.topup-pkg:hover {
  background: rgba(99, 102, 241, 0.2) !important;
  border-color: #818cf8 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}
.topup-pkg.selected {
  background: rgba(99, 102, 241, 0.3) !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5), 0 4px 20px rgba(99, 102, 241, 0.35) !important;
}
.topup-pkg.popular {
  border-color: rgba(245, 158, 11, 0.7) !important;
  background: rgba(245, 158, 11, 0.1) !important;
}
.topup-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: #f59e0b !important;
  color: #0f172a !important;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
}
.topup-amount {
  font-size: 24px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  font-family: var(--font-en);
}
.topup-min {
  font-size: 13px !important;
  color: #38bdf8 !important;
  font-weight: 600 !important;
  margin-top: 4px;
}
#topup-modal .input-label {
  color: #e2e8f0 !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
}
#topup-modal .input-field {
  background: #0b1120 !important;
  border: 1.5px solid #475569 !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-weight: 600;
  padding: 9px 12px;
}
#topup-modal .input-field:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
}
#topup-modal .form-note {
  font-size: 12px !important;
  color: #f1f5f9 !important;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 12px;
  text-align: left;
  line-height: 1.4;
  font-weight: 500;
}
#topup-modal .btn-outline {
  border-color: #475569 !important;
  color: #cbd5e1 !important;
  font-weight: 600;
}
#topup-modal .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

/* ---- GPU Cards ---- */
.gpu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.gpu-card { background: var(--bg-card); border: 1px solid var(--border-glass); border-radius: var(--radius-lg); padding: 20px; transition: all 0.2s; }
.gpu-card.gpu-online { border-color: var(--emerald); box-shadow: 0 0 20px rgba(16,185,129,0.1); }
.gpu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.gpu-name { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.gpu-model { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.gpu-stats { display: flex; gap: 16px; }
.gpu-stat { display: flex; flex-direction: column; gap: 2px; }
.gpu-stat span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; }
.gpu-stat strong { font-size: 15px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.online { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); animation: blink 2s infinite; }
.status-dot.offline { background: var(--rose); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---- Admin ---- */
.big-stat { font-size: 48px; font-weight: 800; color: var(--emerald); text-align: center; padding: 20px; }
.billing-summary { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }
.billing-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; font-size: 14px; border-bottom: 1px solid var(--border-subtle); }
.billing-row.accent { color: var(--emerald); font-weight: 600; border: none; padding-top: 12px; }
.billing-divider { height: 1px; background: var(--border-subtle); margin: 6px 0; }

/* ---- Charts ---- */
.chart-container { position: relative; }

/* ---- Info Banner ---- */
.info-banner { display: flex; gap: 14px; align-items: flex-start; font-size: 14px; line-height: 1.6; padding: 16px 20px; margin-bottom: 20px; border-left: 3px solid var(--cyan); }
.info-banner code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-input); padding: 1px 6px; border-radius: 4px; }

/* ---- Docs ---- */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.docs-grid .card {
  padding: 1.5rem 1.6rem !important;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.docs-grid .card .card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.docs-grid .card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.docs-endpoints { display: flex; flex-direction: column; gap: 16px; }
.endpoint-card { padding: 0; overflow: hidden; }
.endpoint-header { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.endpoint-body { padding: 16px 20px; }
.endpoint-desc { color: var(--text-muted); font-size: 14px; margin-left: auto; }
.endpoint-note { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.endpoint-params { margin-bottom: 12px; }
.param-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); font-size: 14px; }
.param-type { font-size: 11px; padding: 2px 8px; background: var(--violet-muted); color: var(--violet); border-radius: 10px; }
.method-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 6px; font-family: var(--font-mono); }
.method-badge.post { background: var(--emerald-muted); color: var(--emerald); }
.method-badge.get { background: var(--cyan-muted); color: var(--cyan); }
.code-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.code-tab { padding: 5px 12px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-muted); border-radius: 6px; cursor: pointer; font-size: 12px; font-family: var(--font-mono); transition: all 0.15s; }
.code-tab.active { background: var(--primary-muted); color: var(--primary); border-color: var(--primary); }
.code-block { background: var(--bg-darkest); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 14px 16px; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; overflow-x: auto; color: var(--text-main); white-space: pre; margin: 0; }

/* ---- Profile Dropdown ---- */
.profile-menu { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--bg-glass); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); cursor: pointer; color: var(--text-main); font-family: var(--font-thai); font-size: 14px; transition: background 0.15s; }
.profile-btn:hover { background: var(--bg-glass-hover); }
.profile-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: white; }
.profile-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: var(--bg-surface); border: 1px solid var(--border-glass); border-radius: var(--radius-md); min-width: 180px; z-index: 1000; overflow: hidden; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.profile-dropdown.visible { display: block; }
.profile-dropdown a { display: block; padding: 10px 16px; color: var(--text-main); font-size: 14px; cursor: pointer; transition: background 0.15s; font-family: var(--font-thai); }
.profile-dropdown a:hover { background: var(--bg-glass-hover); }
.profile-dropdown a.text-danger { color: var(--rose); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* ---- Credit Widget ---- */
.credit-card-widget {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-glass) !important;
  border-radius: var(--radius-md) !important;
  padding: 1.3rem 1.4rem !important;
  box-shadow: none !important;
}
.credit-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; color: var(--text-muted); }
.credit-amount { font-size: 32px; font-weight: 800; color: var(--text-main); margin-bottom: 12px; }
.credit-bar-wrap { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-bottom: 12px; }
.credit-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--cyan)); border-radius: 3px; transition: width 0.5s ease; }
.credit-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-muted); }

/* ---- Topnav Search ---- */
.topnav-search { display: flex; align-items: center; gap: 8px; background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 6px 12px; min-width: 280px; }
.search-icon { color: var(--text-dim); font-size: 14px; }
.topnav-search input { background: transparent; border: none; outline: none; color: var(--text-main); font-size: 14px; font-family: var(--font-thai); width: 100%; }
.topnav-search input::placeholder { color: var(--text-dim); }

/* ---- Theme & Lang Buttons ---- */
.theme-toggle-btn { background: transparent; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; font-size: 16px; transition: all 0.15s; color: var(--text-muted); }
.theme-toggle-btn:hover { background: var(--bg-glass); }

/* ---- Btn extras ---- */
.btn-full { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-icon-sm { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 13px; transition: all 0.15s; }
.btn-icon-sm:hover { background: var(--rose-muted); color: var(--rose); }
.btn-warning { background: var(--amber); color: #000; }
.btn-warning:hover { background: #d97706; }

/* ---- Badges extras ---- */
.badge-info { background: var(--cyan-muted); color: var(--cyan); }
.badge-danger { background: var(--rose-muted); color: var(--rose); }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .editor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .topnav-search { display: none; }
  .options-grid { grid-template-columns: 1fr 1fr; }
  .topup-packages { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   PREMIUM GLASSMORPHISM ENHANCEMENT — Phase 2 Upgrade
   ========================================================================== */

/* Animated Mesh Gradient Background */
body {
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -20%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(34, 211, 238, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(139, 92, 246, 0.04) 0%, transparent 70%);
  background-attachment: fixed;
}

/* Premium Sidebar */
.sidebar {
  background: linear-gradient(180deg, rgba(13, 17, 23, 0.98) 0%, rgba(10, 14, 20, 0.99) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-logo-icon {
  animation: logo-pulse 4s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.5), 0 0 40px rgba(99, 102, 241, 0.15); }
  50%       { box-shadow: 0 0 28px rgba(99, 102, 241, 0.7), 0 0 55px rgba(99, 102, 241, 0.25); }
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.06) 100%);
}

.nav-item.active::before {
  background: linear-gradient(180deg, var(--primary) 0%, var(--cyan) 100%);
  box-shadow: 0 0 8px var(--primary);
}

.nav-item:hover { transform: translateX(2px); }

/* ==========================================================================
   Top Navbar (.topnav) System — Fully Aligned & Flex Responsive
   ========================================================================== */
.topnav, header.topnav {
  height: var(--navbar-height);
  background: rgba(13, 17, 23, 0.88) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 1.5rem !important;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  box-sizing: border-box;
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

/* Hamburger Button */
.hamburger-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.hamburger-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass);
}

.hamburger-btn:hover span {
  background: var(--text-main);
}

/* Topnav Search */
.topnav-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem;
  width: 100%;
  max-width: 340px;
  transition: all var(--transition-fast);
}

.topnav-search:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: rgba(15, 22, 35, 0.9);
}

.topnav-search .search-icon {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1;
  position: static;
  transform: none;
}

.topnav-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.85rem;
  font-family: var(--font-thai);
  width: 100%;
  padding: 0;
}

.topnav-search input::placeholder {
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* Notification Button in Topnav */
.nav-notif {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  user-select: none;
}

.nav-notif:hover {
  background: var(--bg-glass-hover);
  color: var(--text-main);
  border-color: var(--border-glass);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--rose);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* GPU Status Badge in Topnav */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.online {
  color: var(--emerald);
  background: var(--emerald-muted);
  border-color: rgba(16, 185, 129, 0.25);
}

.status-badge.online::before {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse-dot 2s infinite;
}

.status-badge.offline {
  color: var(--rose);
  background: var(--rose-muted);
  border-color: rgba(244, 63, 94, 0.25);
}

.status-badge.offline::before {
  background: var(--rose);
}

/* Button Foundation & Variants */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
}

.btn-sm {
  padding: 0.32rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-full {
  width: 100%;
}

.btn-outline {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-glass-hover);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--rose) 0%, #be123c 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(244, 63, 94, 0.3);
  border: none;
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.45);
  transform: translateY(-1px);
}

/* Form Inputs & Custom Select */
.input-group,
.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.input-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-field,
.input-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.input-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.3rem;
  cursor: pointer;
}

.input-select option {
  background: #0f1623;
  color: #f1f5f9;
  padding: 8px 12px;
}

.input-field:focus,
.input-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}

/* Options Card & Playground Spacing */
#page-playground .card {
  padding: 1.6rem 1.8rem !important;
}

#page-playground .tab-nav {
  margin-bottom: 1.4rem;
}

#page-playground .url-input-wrap {
  padding: 0.25rem 0 0.5rem;
}

.options-card {
  margin-top: 1.4rem;
  padding: 1.6rem 1.8rem !important;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.options-flags {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

#page-playground #result-card {
  padding: 0 !important;
}

#page-playground #result-card .card-header {
  padding: 1.1rem 1.5rem;
}

#page-playground #result-card > div:not(.card-header) {
  padding: 1.2rem 1.5rem 1.5rem;
}

@media (max-width: 960px) {
  .options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

/* Batch Upload Spacing */
#page-batch .card {
  padding: 1.6rem 1.8rem !important;
}

#page-batch .batch-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 1.4rem 0;
}

@media (max-width: 640px) {
  #page-batch .batch-options {
    grid-template-columns: 1fr;
  }
}

#page-batch .batch-file-list {
  margin-bottom: 1.4rem;
}

#page-batch #batch-queue-card {
  padding: 0 !important;
  margin-top: 1.5rem;
}

#page-batch #batch-queue-card .card-header {
  padding: 1.1rem 1.5rem;
}

#page-batch #batch-queue-list {
  padding: 0.5rem 1.5rem 1.5rem;
}

/* Transcript Editor Spacing */
.editor-player-col .card {
  padding-bottom: 1.25rem;
}

.editor-player-col .card > *:not(.card-header) {
  margin-left: 1.25rem;
  margin-right: 1.25rem;
}

/* System Status Page (SaaS Style) */
.status-hero-banner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.8rem !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(26, 34, 53, 0.9) 100%) !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.status-hero-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.status-hero-info {
  flex: 1;
}

.status-hero-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}

.status-hero-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

.status-hero-badge {
  background: var(--emerald-muted);
  color: var(--emerald);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
  white-space: nowrap;
}

.status-services-card {
  padding: 0 !important;
  overflow: hidden;
  margin-bottom: 1.75rem;
}

.status-services-card .card-header {
  padding: 1.1rem 1.6rem;
}

.status-services-list {
  display: flex;
  flex-direction: column;
}

.status-service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.6rem;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.status-service-item:last-child {
  border-bottom: none;
}

.status-service-item:hover {
  background: var(--bg-glass);
}

.service-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.service-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.service-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.service-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
}

.service-status-pill.operational {
  background: var(--emerald-muted);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.service-status-pill.degraded {
  background: var(--amber-muted);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

[data-theme="light"] .status-hero-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(255, 255, 255, 0.95) 100%) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

/* API Quickstart Guide Styles */
.api-guide-card {
  margin-bottom: 1.5rem;
}

.api-guide-card .card-header {
  padding: 1.1rem 1.6rem;
}

.api-guide-card .card-body {
  padding: 1.5rem 1.6rem;
}

.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1080px) {
  .guide-steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .guide-steps-grid {
    grid-template-columns: 1fr;
  }
}

.guide-step-box {
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: all var(--transition-fast);
}

.guide-step-box:hover {
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-2px);
}

.step-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.step-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.step-code-snippet {
  background: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  color: var(--text-main);
  margin-top: auto;
  line-height: 1.5;
}

.step-link {
  color: var(--primary);
  font-size: 0.83rem;
  font-weight: 600;
  text-decoration: none;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.step-link:hover {
  text-decoration: underline;
}

.step-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.tag-pill {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.openai-compat-box {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  font-size: 0.88rem;
  line-height: 1.6;
}

.compat-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.compat-content strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.3rem;
}

.compat-content p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.84rem;
}

[data-theme="light"] .guide-step-box {
  background: #f8fafc !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .openai-compat-box {
  background: rgba(99, 102, 241, 0.05) !important;
  border-color: rgba(99, 102, 241, 0.18) !important;
}

/* Tutorial Card Styles */
.tutorial-card .card-header {
  padding: 1.1rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tutorial-card .card-body {
  padding: 1.5rem 1.6rem;
}

.tutorial-intro {
  margin-bottom: 1rem;
}

.tutorial-intro h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.tutorial-intro p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.tutorial-prereq {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.prereq-label {
  font-weight: 600;
  color: var(--text-main);
}

.tutorial-prereq code {
  font-family: var(--font-mono);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.tutorial-code-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.code-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: rgba(15, 22, 35, 0.85);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tutorial-notes {
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  font-size: 0.86rem;
  line-height: 1.6;
}

.tutorial-notes strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.4rem;
}

.tutorial-notes ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.tutorial-notes li {
  margin-bottom: 0.35rem;
}

.tutorial-notes p {
  color: var(--text-muted);
  margin: 0;
}

[data-theme="light"] .tutorial-prereq,
[data-theme="light"] .tutorial-notes {
  background: #f8fafc !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .code-header-bar {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Dropzone Cleanup */
.dropzone-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.dropzone-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* Quick Actions in Sidebar/Overview */
.quick-actions,
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  padding: 1.2rem;
}

.quick-action-btn {
  background: rgba(26, 34, 53, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.qa-icon,
.quick-action-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.qa-label,
.quick-action-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Modals Cleanup */
.modal-box {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%) !important;
  border: 1.5px solid rgba(148, 163, 184, 0.35) !important;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 40px rgba(99, 102, 241, 0.15) !important;
  padding: 1.75rem;
  backdrop-filter: blur(20px);
  position: relative;
  animation: modal-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
  color: #f8fafc !important;
}

.modal-box.sm {
  max-width: 420px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.9rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff !important;
}

.modal-close {
  background: transparent;
  border: none;
  color: #cbd5e1 !important;
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.modal-body {
  margin-bottom: 1.25rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* Tables & Wrappers */
.table-wrap {
  overflow-x: auto;
  width: 100%;
}

.data-table th {
  background: rgba(15, 22, 35, 0.5);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.empty-row {
  text-align: center;
  color: var(--text-dim);
  padding: 2.5rem 1rem !important;
  font-size: 0.9rem;
}

/* Premium Stat Cards */
.stat-card {
  background: linear-gradient(135deg, rgba(26, 34, 53, 0.9) 0%, rgba(17, 24, 39, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

.stat-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(99,102,241,0.1);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-icon-indigo { background: rgba(99,102,241,0.18); box-shadow: 0 0 12px rgba(99,102,241,0.2); }
.stat-icon-cyan   { background: rgba(34,211,238,0.15); box-shadow: 0 0 12px rgba(34,211,238,0.2); }
.stat-icon-amber  { background: rgba(245,158,11,0.15); box-shadow: 0 0 12px rgba(245,158,11,0.2); }
.stat-icon-emerald{ background: rgba(16,185,129,0.15); box-shadow: 0 0 12px rgba(16,185,129,0.2); }
.stat-icon-violet { background: rgba(139,92,246,0.15); box-shadow: 0 0 12px rgba(139,92,246,0.2); }
.stat-icon-rose   { background: rgba(244,63,94,0.15);  box-shadow: 0 0 12px rgba(244,63,94,0.2); }

.stat-card-value {
  font-family: var(--font-en);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin-bottom: 0.4rem;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat-card-change { font-size: 0.78rem; font-weight: 600; display: flex; align-items: center; gap: 0.3rem; }
.stat-card-change.up      { color: var(--emerald); }
.stat-card-change.down    { color: var(--rose); }
.stat-card-change.neutral { color: var(--text-dim); }

/* Premium Cards */
.card {
  background: linear-gradient(135deg, rgba(26, 34, 53, 0.85) 0%, rgba(17, 24, 39, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Premium Buttons */
.btn-primary, button.btn.btn-primary, .btn.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #5558e8 50%, var(--primary-dark) 100%);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  border: none;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover:not(:disabled), .btn.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.55);
}

/* Dropzone Premium */
.dropzone {
  background: linear-gradient(135deg, rgba(15, 22, 35, 0.7) 0%, rgba(10, 15, 25, 0.8) 100%);
  border: 2px dashed rgba(99, 102, 241, 0.3);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  transform: scale(1.005);
}

/* GPU Cards Premium */
.gpu-card {
  background: linear-gradient(135deg, rgba(26, 34, 53, 0.9) 0%, rgba(17, 24, 39, 0.95) 100%);
  backdrop-filter: blur(10px);
}

.gpu-card.gpu-online {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.08);
}

/* Quick Actions */
.quick-action-btn {
  background: rgba(26, 34, 53, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-action-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(99, 102, 241, 0.08));
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.15);
}

/* Modal Premium */
.modal-overlay {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.modal-content {
  background: linear-gradient(135deg, rgba(26, 34, 53, 0.97) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  animation: modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-pop {
  from { transform: scale(0.92) translateY(10px); opacity: 0; }
  to   { transform: scale(1)    translateY(0px);  opacity: 1; }
}

/* Toast Premium */
.toast {
  background: linear-gradient(135deg, rgba(26, 34, 53, 0.97) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* Progress Bar shimmer */
.progress-bar {
  background: linear-gradient(90deg, var(--primary) 0%, var(--cyan) 50%, var(--primary) 100%);
  background-size: 200% 100%;
  animation: progress-shimmer 2s linear infinite;
}

@keyframes progress-shimmer {
  0%   { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* Input focus glow */
.input-field:focus, .input-select:focus, .custom-input:focus, .custom-select:focus {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  outline: none;
}

/* Scrollbar Premium */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(99,102,241,0.4), rgba(34,211,238,0.3));
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(99,102,241,0.6), rgba(34,211,238,0.5));
}

/* Selection */
::selection { background: rgba(99, 102, 241, 0.3); color: var(--text-main); }

/* Page Transition */
.page-section { animation: page-fade 0.2s ease; }

@keyframes page-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Credit Card Surface Standard */
.credit-card-widget {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-glass) !important;
  box-shadow: none !important;
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Light Theme Improvements */
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #1e293b 0%, #162033 100%);
}

[data-theme="light"] .card,
[data-theme="light"] .stat-card {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0,0,0,0.08) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

[data-theme="light"] .card:hover,
[data-theme="light"] .stat-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: rgba(99,102,241,0.2) !important;
}

[data-theme="light"] .topnav, [data-theme="light"] header.topnav {
  background: rgba(255, 255, 255, 0.9) !important;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

[data-theme="light"] .modal-content, [data-theme="light"] .toast {
  background: white;
  border-color: rgba(0,0,0,0.1);
}

[data-theme="light"] .input-field,
[data-theme="light"] .input-select,
[data-theme="light"] .custom-input,
[data-theme="light"] .custom-select {
  background: white;
  border-color: rgba(0,0,0,0.12);
  color: #1e293b;
}

[data-theme="light"] .profile-dropdown,
[data-theme="light"] .dropdown-menu {
  background: white;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

[data-theme="light"] .gpu-card { background: white !important; }
[data-theme="light"] .quick-action-btn { background: #f8fafc !important; border-color: rgba(0,0,0,0.08) !important; }
[data-theme="light"] .quick-action-btn:hover { background: #f1f5f9 !important; }
[data-theme="light"] .dropzone { background: #f8fafc !important; border-color: rgba(0,0,0,0.12) !important; }
[data-theme="light"] .tab-nav { background: #f1f5f9 !important; }

/* Lang Toggle */
.lang-toggle-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.lang-toggle-btn:hover {
  background: var(--primary-muted);
  color: var(--primary);
  border-color: rgba(99,102,241,0.3);
}

/* Sidebar Overlay */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  backdrop-filter: blur(4px);
}

#sidebar-overlay.visible { display: block; }

/* ============================================================
   GOOGLE AUTH & MODERN AUTH MODAL EXTENSIONS
   ============================================================ */
.btn-google-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.btn-google-custom:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.btn-google-custom svg {
  flex-shrink: 0;
}
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0;
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}
.auth-divider span {
  padding: 0 12px;
}
.auth-terms-note {
  margin-top: 1.2rem;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.5;
}
.auth-terms-note a {
  color: var(--primary);
  text-decoration: underline;
}

/* ============================================================
   INTERACTIVE PRICING CALCULATOR & COMPARISON TABLE
   ============================================================ */
.pricing-calculator-wrap {
  margin: 3.5rem auto 2.5rem;
  max-width: 960px;
  background: linear-gradient(135deg, rgba(26, 34, 53, 0.85) 0%, rgba(15, 22, 35, 0.95) 100%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 2.2rem 2.5rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}
.pricing-calculator-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--cyan), var(--emerald));
}
.calc-header {
  text-align: center;
  margin-bottom: 2rem;
}
.calc-header h3 {
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}
.calc-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.calc-slider-box {
  margin: 2rem 0;
}
.calc-slider-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}
.calc-slider-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--cyan);
  font-family: var(--font-en);
}
.calc-range-input {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.calc-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  cursor: pointer;
  box-shadow: 0 0 14px var(--primary-glow);
  border: 2px solid #fff;
  transition: transform 0.15s ease;
}
.calc-range-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.calc-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-subtle);
}
.calc-metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}
.calc-metric-card.highlight {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(34, 211, 238, 0.08));
  border-color: rgba(99, 102, 241, 0.35);
}
.calc-metric-title {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}
.calc-metric-num {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-en);
}
.calc-metric-card.highlight .calc-metric-num {
  color: var(--emerald);
}
.calc-metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Feature Comparison Table */
.comparison-section {
  margin: 4.5rem auto 3rem;
  max-width: 1140px;
}
.comparison-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  background: var(--bg-surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}
.comparison-table th {
  padding: 1.2rem 1.4rem;
  background: rgba(13, 17, 23, 0.9);
  color: var(--text-main);
  font-weight: 700;
  border-bottom: 1px solid var(--border-glass);
}
.comparison-table td {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}
.comparison-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.table-category-row td {
  background: rgba(99, 102, 241, 0.08) !important;
  color: var(--cyan) !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.check-yes {
  color: var(--emerald);
  font-weight: 700;
  font-size: 1.1rem;
}
.check-no {
  color: var(--text-dim);
  font-size: 1.1rem;
}
.badge-plan {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-free { background: rgba(255, 255, 255, 0.1); color: var(--text-main); }
.badge-pro { background: var(--primary-muted); color: var(--primary); }
.badge-ent { background: var(--cyan-muted); color: var(--cyan); }

@media (max-width: 768px) {
  .calc-metric-grid {
    grid-template-columns: 1fr;
  }
  .pricing-calculator-wrap {
    padding: 1.5rem 1rem;
  }
}

/* ============================================================
   CHECKOUT MODAL (Bright High-Contrast & Compact Edition)
============================================================ */
#checkout-modal.open {
  display: flex !important;
}

.modal-box.checkout-modal-box {
  max-width: 440px;
  width: 92%;
  padding: 1.35rem 1.4rem;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%) !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.9), 0 0 50px rgba(99, 102, 241, 0.25) !important;
  border-radius: var(--radius-lg);
  max-height: 94vh;
  overflow-y: auto;
  color: #f8fafc !important;
}

.checkout-header-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff !important;
}

.checkout-header-sub {
  font-size: 12px;
  color: #cbd5e1 !important;
  font-weight: 500;
}

.checkout-compact-plan {
  background: rgba(30, 41, 59, 0.9) !important;
  border: 1px solid rgba(129, 140, 248, 0.45) !important;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.checkout-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(34, 211, 238, 0.4));
  color: #ffffff !important;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 4px;
}

.checkout-plan-name-compact {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff !important;
}

.checkout-plan-subtext {
  font-size: 12px;
  color: #cbd5e1 !important;
  margin-top: 2px;
}

.checkout-price-label {
  font-size: 11.5px;
  color: #cbd5e1 !important;
  font-weight: 500;
}

.checkout-price-highlight {
  font-size: 20px;
  font-weight: 800;
  color: #38bdf8 !important;
  line-height: 1.15;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.checkout-price-breakdown {
  font-size: 11.5px;
  color: #e2e8f0 !important;
  margin-top: 2px;
}

.checkout-mini-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
}

.mini-badge {
  font-size: 11.5px;
  color: #ffffff !important;
  background: rgba(99, 102, 241, 0.25) !important;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(165, 180, 252, 0.4) !important;
  font-weight: 600;
}

/* Payment Tabs */
.payment-tabs {
  display: flex;
  gap: 6px;
  background: #0b1120;
  padding: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid #334155;
  margin-bottom: 0.85rem;
}

.payment-tab {
  flex: 1;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #cbd5e1 !important;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.payment-tab:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.05);
}

.payment-tab.active {
  background: #4f46e5 !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(79, 70, 229, 0.5);
}

/* PromptPay Compact Card */
.promptpay-compact-card {
  background: #ffffff !important;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  text-align: center;
  padding-bottom: 12px;
}

.promptpay-compact-header {
  background: #003d6b !important;
  color: #ffffff !important;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.promptpay-compact-header .pp-brand {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff !important;
}

.promptpay-compact-header .pp-brand strong {
  font-weight: 800;
  margin-left: 3px;
  color: #ffffff !important;
}

.pp-badge-pill {
  background: rgba(255, 255, 255, 0.22);
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff !important;
  font-weight: 600;
}

.promptpay-qr-center {
  padding: 12px 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-svg-compact {
  width: 140px;
  height: 140px;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.qr-amount-compact {
  margin-top: 8px;
  background: #0f172a !important;
  color: #38bdf8 !important;
  border: 1px solid #1e293b;
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 14px;
  font-weight: 800;
}

.promptpay-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px 0;
  font-size: 12px;
  color: #0f172a !important;
  font-weight: 600;
}

.qr-timer-text {
  color: #b91c1c !important;
  font-weight: 700;
}

.checkout-hint {
  font-size: 12px;
  color: #ffffff !important;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  padding: 9px 12px;
  text-align: center;
  margin-top: 10px;
  line-height: 1.4;
  font-weight: 600;
}

.checkout-action-btn {
  margin-top: 12px;
  padding: 11px;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4) !important;
}

/* Card Inputs */
.card-input-box {
  background: rgba(15, 23, 42, 0.85) !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  border-radius: var(--radius-md);
  padding: 1.1rem;
}

.card-input-box .input-label {
  color: #e2e8f0 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

.card-input-box .input-field {
  background: #0b1120 !important;
  border: 1px solid #475569 !important;
  color: #ffffff !important;
  font-weight: 500;
}

.card-brands {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.card-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: #ffffff !important;
}

.checkout-security-note {
  font-size: 11.5px;
  color: #cbd5e1 !important;
  text-align: center;
  margin-top: 10px;
  line-height: 1.4;
  font-weight: 500;
}

/* Success View */
.checkout-success-icon {
  font-size: 44px;
  margin-bottom: 8px;
  animation: bounce-in 0.5s ease-out;
}

.checkout-receipt-box {
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1px solid rgba(16, 185, 129, 0.45) !important;
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  max-width: 100%;
  margin: 0 auto;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #cbd5e1 !important;
  margin-bottom: 6px;
  font-weight: 500;
}

.receipt-row strong {
  color: #ffffff !important;
}

.receipt-row:last-child {
  margin-bottom: 0;
}

@keyframes bounce-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.15); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   EASYSUB-STYLE UPGRADE: PROJECTS HUB, MULTI-STEP MODALS & 3-PANEL STUDIO
   ========================================================================== */

/* --- 1. Projects Workspace Hub --- */
.projects-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.projects-action-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  min-width: 260px;
}

.search-input-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: var(--transition-fast);
}

.search-input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.project-card {
  position: relative;
  background: linear-gradient(145deg, rgba(26, 34, 53, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.15);
}

.project-thumb-box {
  position: relative;
  width: 100%;
  height: 165px;
  background: #090d16;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.project-card:hover .project-thumb-img {
  transform: scale(1.04);
}

.project-thumb-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.project-thumb-fallback .icon {
  font-size: 32px;
  opacity: 0.7;
}

/* Circular SVG Progress Ring Overlay */
.progress-ring-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 20, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}

.progress-ring-svg {
  transform: rotate(-90deg);
  width: 72px;
  height: 72px;
}

.progress-ring-circle-bg {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 6;
  fill: transparent;
}

.progress-ring-circle-val {
  stroke: var(--cyan);
  stroke-width: 6;
  stroke-linecap: round;
  fill: transparent;
  transition: stroke-dashoffset 0.35s ease;
}

.progress-ring-text {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.project-badge-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  z-index: 3;
}

.project-badge-tag.to_be_transcribed {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.project-badge-tag.transcribing,
.project-badge-tag.processing {
  background: rgba(34, 211, 238, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(34, 211, 238, 0.4);
  animation: pulse-ring 2s infinite;
}

.project-badge-tag.completed {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.project-menu-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xs);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  z-index: 4;
  transition: background 0.15s ease;
}

.project-menu-btn:hover {
  background: rgba(99, 102, 241, 0.8);
}

.project-content-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.project-updated-date {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* 3-dots Context Menu Dropdown */
.project-dropdown-menu {
  position: absolute;
  top: 42px;
  right: 8px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  padding: 4px;
  z-index: 100;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-dropdown-menu button {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 7px 10px;
  font-size: 12px;
  text-align: left;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.project-dropdown-menu button:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #ffffff;
}

.project-dropdown-menu button.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* --- 2. Multi-step Upload & Config Modals --- */
.easysub-modal-box {
  width: 100%;
  max-width: 560px;
  background: linear-gradient(145deg, #131a29, #0b0f19);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px 26px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.15);
  position: relative;
  color: var(--text-main);
}

.easysub-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.easysub-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.easysub-modal-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.upload-circle-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
}

.upload-coffee-subtext {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 14px;
}

.config-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.config-radio-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.config-radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.config-radio-card:hover {
  background: rgba(26, 34, 53, 0.9);
  border-color: rgba(99, 102, 241, 0.4);
}

.config-radio-card.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.config-radio-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.config-radio-card.active .config-radio-circle {
  border-color: var(--primary);
}

.config-radio-card.active .config-radio-circle::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.config-radio-info {
  flex: 1;
}

.config-radio-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-radio-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.quota-calc-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quota-calc-row {
  display: flex;
  justify-content: space-between;
}

/* Tooltip popover for segmentation mode */
.tooltip-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  position: relative;
}

.tooltip-popover-content {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 290px;
  padding: 12px 14px;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  font-size: 11.5px;
  line-height: 1.5;
  color: #e2e8f0;
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.tooltip-trigger-icon:hover .tooltip-popover-content {
  display: block;
}

/* --- 3. EasySub 3-Panel Studio Layout --- */
.easysub-studio-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  background: var(--bg-darkest);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.studio-topbar {
  height: 48px;
  background: #0d121f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.studio-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cloud-sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.cloud-sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.studio-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-workspace-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left Vertical Tool Rail */
.studio-tool-rail {
  width: 58px;
  background: #0b0f19;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 14px;
  flex-shrink: 0;
}

.rail-tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 6px;
  border-radius: var(--radius-xs);
  transition: all 0.15s;
  width: 48px;
}

.rail-tool-item .rail-icon {
  font-size: 18px;
}

.rail-tool-item:hover,
.rail-tool-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--cyan);
}

/* Left Subtitles Segments Column */
.studio-subtitles-panel {
  width: 340px;
  background: #0e1422;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.subtitles-panel-header {
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subtitles-panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-item-card {
  background: rgba(26, 34, 53, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: all 0.15s;
  cursor: pointer;
}

.sub-item-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(99, 102, 241, 0.3);
}

.sub-item-card.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.sub-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.sub-item-time {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--cyan);
}

.sub-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sub-item-actions button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 12px;
  border-radius: 4px;
}

.sub-item-actions button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sub-item-textarea {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-thai);
  line-height: 1.4;
  resize: vertical;
  padding: 4px;
  outline: none;
}

.sub-item-textarea:focus {
  background: rgba(15, 23, 42, 0.8);
  border-color: var(--primary);
}

/* Center Video Stage */
.studio-center-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #070a12;
  overflow: hidden;
  position: relative;
}

.video-canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.video-frame-box {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  background: #000000;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-frame-box video {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* Live Styled Subtitle Overlay Box */
.video-live-sub-overlay {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  user-select: none;
  max-width: 90%;
  z-index: 10;
  transition: all 0.1s ease;
}

.video-controls-bar {
  height: 48px;
  background: #0b0f19;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
  flex-shrink: 0;
}

.video-ctrl-left,
.video-ctrl-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Right Properties Inspector Panel */
.studio-inspector-panel {
  width: 290px;
  background: #0e1422;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px 14px;
  gap: 16px;
}

.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.inspector-section:last-child {
  border-bottom: none;
}

.inspector-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inspector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.inspector-row input[type="text"],
.inspector-row input[type="number"],
.inspector-row select {
  height: 30px;
  padding: 0 8px;
  background: #161e31;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xs);
  color: #ffffff;
  font-size: 12px;
  outline: none;
}

.inspector-row input[type="color"] {
  width: 32px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
}

/* --- 4. Bottom Multi-track Timeline Sequencer --- */
.studio-timeline-sequencer {
  height: 180px;
  background: #090d16;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.timeline-toolbar {
  height: 36px;
  background: #0d121f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 12px;
}

.timeline-playback-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-btn-round {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

.timeline-btn-round:hover {
  background: var(--primary);
}

.timeline-scroll-area {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  user-select: none;
  background: #060911;
}

.timeline-ruler {
  height: 24px;
  background: #0a0f1c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  min-width: 1600px;
}

.timeline-ruler-mark {
  position: absolute;
  top: 4px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.timeline-tracks-box {
  min-width: 1600px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0;
}

.timeline-track-row {
  height: 38px;
  position: relative;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
}

.timeline-track-label {
  position: sticky;
  left: 0;
  width: 48px;
  height: 100%;
  background: #111827;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  z-index: 5;
}

.timeline-sub-block {
  position: absolute;
  height: 28px;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: #ffffff;
  font-size: 11px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: border-color 0.15s;
}

.timeline-sub-block:hover {
  border-color: #ffffff;
}

.timeline-sub-block.active {
  background: linear-gradient(90deg, #6366f1, #4f46e5);
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.4);
}

.timeline-scrubber-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #38bdf8;
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 0 8px #38bdf8;
}

.timeline-scrubber-playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px;
  height: 12px;
  background: #38bdf8;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

/* Video Export Modal */
.export-quality-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.export-quality-card {
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s;
}

.export-quality-card:hover {
  background: rgba(26, 34, 53, 0.9);
  border-color: rgba(99, 102, 241, 0.4);
}

.export-quality-card.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
}

.export-quality-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.export-quality-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   SUBTITLE STUDIO — WATCHLAKORN STANDARD DUAL-PANE PRO STUDIO
   Directly ported and aligned with https://www.watchlakorn.org/sub_editor.php
   ========================================================================== */

.substudio-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 65px);
  min-height: calc(100vh - 65px);
  max-height: calc(100vh - 65px);
  background: #0b0f19;
  color: #f3f4f6;
  font-family: 'Inter', 'Prompt', sans-serif;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid #374151;
}

/* 1. Header (Height 65px) */
.substudio-header {
  flex: 0 0 65px;
  height: 65px;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #374151;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  box-sizing: border-box;
}

.substudio-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.substudio-brand-badge {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.substudio-drama-info {
  display: flex;
  flex-direction: column;
  max-width: 340px;
}

.substudio-drama-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.substudio-drama-meta {
  font-size: 0.78rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 6px;
}

.substudio-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 2. Workspace Split (Left 45% + Right Flex 1) */
.substudio-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 130px);
  max-height: calc(100vh - 130px);
  overflow: hidden;
}

.substudio-player-pane {
  flex: 0 0 45%;
  max-width: 45%;
  border-right: 1px solid #374151;
  background: #0d121f;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 14px;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

.substudio-video-container {
  width: 100%;
  background: #000000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
  border: 1px solid #1f2937;
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.substudio-video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.substudio-player-controls-card {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.substudio-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.substudio-rate-btn {
  background: #1f2937;
  border: 1px solid #374151;
  color: #d1d5db;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.substudio-rate-btn.active, .substudio-rate-btn:hover {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
}

.substudio-auto-follow-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #9ca3af;
  cursor: pointer;
}

.substudio-auto-follow-toggle input {
  accent-color: #6366f1;
  cursor: pointer;
}

.substudio-shortcut-tip {
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.4;
  background: rgba(31, 41, 55, 0.5);
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 3px solid #6366f1;
}

/* 3. Style Inspector Card */
.substudio-style-card {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.substudio-style-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.85rem;
  color: #e0e7ff;
  cursor: pointer;
}

.substudio-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.substudio-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.substudio-form-label {
  font-size: 0.72rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.substudio-input {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #f3f4f6;
  padding: 5px 8px;
  font-size: 0.82rem;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.substudio-input:focus {
  border-color: #6366f1;
}

/* 4. Right Timeline Pane */
.substudio-timeline-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0b0f19;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.substudio-timeline-toolbar {
  padding: 12px 18px;
  background: #111827;
  border-bottom: 1px solid #374151;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  box-sizing: border-box;
}

.substudio-search-box {
  position: relative;
  flex: 1;
  max-width: 280px;
}

.substudio-search-box input {
  width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 6px 12px 6px 32px;
  color: #ffffff;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.substudio-search-box input:focus {
  border-color: #6366f1;
}

.substudio-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 0.82rem;
}

.substudio-cues-container {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  box-sizing: border-box;
}

/* 5. Cue Cards */
.cue-card {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
  box-sizing: border-box;
}

.cue-card:hover {
  border-color: #4b5563;
}

.cue-card.active {
  background: #1e1b4b;
  border-color: #6366f1;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.25);
}

.cue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cue-index {
  font-size: 0.8rem;
  font-weight: 700;
  color: #9ca3af;
  min-width: 32px;
}

.cue-times {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-group {
  display: flex;
  align-items: center;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 6px;
  overflow: hidden;
}

.time-input {
  width: 104px;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-size: 0.78rem;
  font-family: monospace;
  padding: 4px 6px;
  text-align: center;
  outline: none;
}

.time-nudge {
  background: #374151;
  border: none;
  color: #d1d5db;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 0.72rem;
  transition: background 0.15s;
}

.time-nudge:hover {
  background: #6366f1;
  color: #ffffff;
}

.duration-badge {
  font-size: 0.72rem;
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  padding: 3px 8px;
  border-radius: 12px;
  font-family: monospace;
  font-weight: 600;
}

.cue-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cue-text-input {
  width: 100%;
  background: #0b0f19;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 10px 12px;
  color: #f3f4f6;
  font-size: 0.95rem;
  font-family: 'Prompt', sans-serif;
  resize: vertical;
  min-height: 48px;
  line-height: 1.5;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

.cue-text-input:focus {
  border-color: #6366f1;
  background: #131a2c;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.cue-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #6b7280;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  margin-right: 5px;
}

.status-dot.dirty {
  background: #f59e0b;
}

/* 6. Modals for Sub Editor (Search/Replace & Shift) */
.submodal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.submodal-card {
  width: 100%;
  max-width: 480px;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.submodal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   LIGHT THEME HARMONIZATION — PROJECTS HUB & SUBTITLE STUDIO
   ========================================================================== */

/* 1. Workspace Projects Cards & 3-Dot Context Menu */
[data-theme="light"] .project-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.09);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
[data-theme="light"] .project-card:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 12px 26px rgba(99, 102, 241, 0.12);
}
[data-theme="light"] .project-thumb-box {
  background: #e2e8f0;
}
[data-theme="light"] .project-title {
  color: #0f172a;
}
[data-theme="light"] .project-meta-line {
  color: #475569;
}
[data-theme="light"] .project-updated-date {
  color: #64748b;
}
[data-theme="light"] .project-menu-btn {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}
[data-theme="light"] .project-menu-btn:hover {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}
[data-theme="light"] .project-dropdown-menu {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
}
[data-theme="light"] .project-dropdown-menu button {
  color: #1e293b;
}
[data-theme="light"] .project-dropdown-menu button:hover {
  background: #eef2ff;
  color: #4338ca;
}
[data-theme="light"] .project-dropdown-menu button.danger {
  color: #dc2626;
}
[data-theme="light"] .project-dropdown-menu button.danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}
[data-theme="light"] .easysub-modal-box {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}
[data-theme="light"] .easysub-modal-title {
  color: #0f172a;
}
[data-theme="light"] .easysub-modal-desc {
  color: #475569;
}

/* 2. Subtitle Studio / Transcript Editor */
[data-theme="light"] .substudio-wrapper {
  background: #f8fafc;
  color: #0f172a;
  border-color: #e2e8f0;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}
[data-theme="light"] .substudio-header {
  background: rgba(255, 255, 255, 0.96);
  border-bottom-color: #e2e8f0;
}
[data-theme="light"] .substudio-drama-title {
  color: #0f172a;
}
[data-theme="light"] .substudio-drama-meta {
  color: #64748b;
}
[data-theme="light"] .substudio-player-pane {
  background: #f1f5f9;
  border-right-color: #e2e8f0;
}
[data-theme="light"] .substudio-video-container {
  border-color: #cbd5e1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}
[data-theme="light"] #editor-media-missing-banner {
  background: #f8fafc !important;
  color: #334155 !important;
  border: 1px dashed #cbd5e1;
}
[data-theme="light"] #editor-media-missing-banner > div:nth-child(2) {
  color: #0f172a !important;
}
[data-theme="light"] #editor-media-missing-banner > div:nth-child(3) {
  color: #64748b !important;
}
[data-theme="light"] .substudio-player-controls-card,
[data-theme="light"] .substudio-style-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
[data-theme="light"] .substudio-controls-row {
  border-top-color: #e2e8f0 !important;
}
[data-theme="light"] .substudio-rate-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
[data-theme="light"] .substudio-rate-btn.active,
[data-theme="light"] .substudio-rate-btn:hover {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}
[data-theme="light"] .substudio-auto-follow-toggle {
  color: #475569;
}
[data-theme="light"] .substudio-shortcut-tip {
  background: #f1f5f9;
  color: #475569;
  border-left-color: #6366f1;
}
[data-theme="light"] .substudio-shortcut-tip code {
  background: #e2e8f0;
  color: #1e293b;
  padding: 1px 5px;
  border-radius: 4px;
}
[data-theme="light"] .substudio-style-header {
  color: #1e293b;
}
[data-theme="light"] .substudio-form-label {
  color: #475569;
}
[data-theme="light"] .substudio-input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
[data-theme="light"] .substudio-input:focus {
  background: #ffffff;
  border-color: #6366f1;
}
[data-theme="light"] #insp-font-color-hex,
[data-theme="light"] #insp-pos-y-val {
  color: #334155 !important;
}
[data-theme="light"] .substudio-timeline-pane {
  background: #f8fafc;
}
[data-theme="light"] .substudio-timeline-toolbar {
  background: #ffffff;
  border-bottom-color: #e2e8f0;
}
[data-theme="light"] .substudio-search-box input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
[data-theme="light"] .substudio-search-box input:focus {
  background: #ffffff;
  border-color: #6366f1;
}
[data-theme="light"] .cue-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}
[data-theme="light"] .cue-card:hover {
  border-color: #94a3b8;
}
[data-theme="light"] .cue-card.active {
  background: #eef2ff;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.16);
}
[data-theme="light"] .cue-index {
  color: #475569;
}
[data-theme="light"] .time-group {
  background: #f8fafc;
  border-color: #cbd5e1;
}
[data-theme="light"] .time-input {
  color: #0f172a;
}
[data-theme="light"] .time-nudge {
  background: #e2e8f0;
  color: #334155;
}
[data-theme="light"] .time-nudge:hover {
  background: #6366f1;
  color: #ffffff;
}
[data-theme="light"] .duration-badge {
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
}
[data-theme="light"] .cue-text-input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
[data-theme="light"] .cue-text-input:focus {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
[data-theme="light"] .cue-footer {
  color: #64748b;
}
[data-theme="light"] #editor-export-dropdown {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14) !important;
}
[data-theme="light"] #editor-export-dropdown button {
  color: #1e293b !important;
  border-top-color: #e2e8f0 !important;
}
[data-theme="light"] #editor-export-dropdown button:hover {
  background: #eef2ff !important;
  color: #4338ca !important;
}
[data-theme="light"] .submodal-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}
[data-theme="light"] .submodal-title {
  color: #0f172a;
}
[data-theme="light"] .substudio-header .btn-secondary,
[data-theme="light"] .substudio-player-controls-card .btn-secondary,
[data-theme="light"] .substudio-timeline-toolbar .btn-secondary,
[data-theme="light"] .cue-actions .btn-secondary {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}
[data-theme="light"] .substudio-header .btn-secondary:hover,
[data-theme="light"] .substudio-player-controls-card .btn-secondary:hover,
[data-theme="light"] .substudio-timeline-toolbar .btn-secondary:hover,
[data-theme="light"] .cue-actions .btn-secondary:hover {
  background: #eef2ff;
  border-color: #6366f1;
  color: #4338ca;
}
[data-theme="light"] .draft-recovery-banner {
  background: #fffbeb !important;
  border-color: #fcd34d !important;
}
[data-theme="light"] .draft-recovery-banner strong,
[data-theme="light"] .draft-recovery-banner div,
[data-theme="light"] .draft-recovery-banner .btn-ghost {
  color: #92400e !important;
}

/* ==========================================================================
   MOBILE FULL-WIDTH RESPONSIVE OVERHAUL (v20261122_v25)
   Fixes: .main-area half-screen width lock, topnav overflow, subtitle studio
   stacking, member lock overlay scroll, and mobile drawer alignment (<= 900px)
   ========================================================================== */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 900px) {
  .app-shell {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  .main-area,
  .main-area.sidebar-collapsed {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .sidebar {
    width: min(270px, 84vw);
    transform: translateX(-105%);
    z-index: 1200;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    width: min(270px, 84vw);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.65);
  }

  .sidebar-overlay {
    z-index: 1150;
  }

  .topnav,
  header.topnav {
    padding: 0 0.75rem !important;
    gap: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .topnav-left {
    gap: 0.5rem !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    position: relative;
    z-index: 6;
  }

  #hamburger-btn {
    flex-shrink: 0 !important;
    position: relative;
    z-index: 6;
  }

  .topnav-search {
    display: none !important;
  }

  .topnav-right {
    gap: 0.35rem !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    max-width: calc(100% - 46px) !important;
    justify-content: flex-end;
    flex-shrink: 1 !important;
  }

  #gpu-cluster-pill-text {
    display: none !important;
  }

  #gpu-status-badge {
    padding: 4px 8px !important;
    gap: 0 !important;
  }

  /* Subtitle Studio: stack video player above cue list on mobile/tablet */
  .substudio-wrapper {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .substudio-header {
    flex: none !important;
    height: auto !important;
    padding: 10px 12px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .substudio-brand {
    max-width: 100%;
    min-width: 0;
  }

  .substudio-drama-info {
    max-width: calc(100vw - 130px) !important;
    min-width: 0;
  }

  .substudio-header-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px !important;
  }

  .substudio-workspace {
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .substudio-player-pane {
    flex: none !important;
    max-width: 100% !important;
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-subtle);
    overflow: visible !important;
  }

  .substudio-timeline-pane {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
}

@media (max-width: 640px) {
  .page-content {
    padding: 0.9rem 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .page-header,
  .projects-header-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  .projects-action-group {
    width: 100%;
  }

  .search-input-wrap {
    min-width: 0 !important;
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  .projects-grid,
  .overview-projects-grid,
  .smart-presets-grid {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
  }

  .card,
  .pro-studio-dock {
    padding: 14px 12px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #dock-cloud-url-input {
    min-width: 0 !important;
    width: 100% !important;
  }

  #projects-storage-bar {
    padding: 12px !important;
  }

  #projects-storage-meta {
    white-space: normal !important;
    line-height: 1.45;
  }

  .topnav-right a[href="/landing"],
  #topnav-desktop-app-btn,
  #pwa-install-btn,
  #gpu-status-badge {
    display: none !important;
  }

  .topnav-right {
    gap: 0.3rem !important;
    max-width: calc(100% - 44px) !important;
  }

  .topnav-right .theme-toggle-btn,
  .topnav-right .lang-toggle-btn,
  .topnav-right .nav-notif {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    font-size: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
  }

  .topnav-right .profile-btn {
    padding: 3px 6px !important;
    gap: 4px !important;
  }

  #nav-username-short {
    max-width: 58px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .table-wrap,
  .table-responsive,
  .dock-queue-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .export-quality-cards {
    grid-template-columns: 1fr !important;
  }

  .member-lock-overlay {
    align-items: flex-start !important;
    padding: 12px !important;
  }

  .member-lock-card {
    margin: auto 0;
    padding: 22px 16px !important;
    border-radius: 18px !important;
  }
}

@media (max-width: 768px) {
  #topnav-desktop-app-btn {
    display: none !important;
  }
}

@media (max-width: 480px) {
  #nav-username-short {
    display: none !important;
  }
}

/* Landscape / Short Viewport Menu Scroll Guard (e.g. Mobile Landscape 844x390) */
.profile-dropdown {
  max-height: calc(100dvh - 70px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

@media (max-height: 520px) {
  .sidebar {
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    bottom: 0 !important;
  }

  .sidebar-brand {
    padding: 0.55rem 0.9rem !important;
    min-height: 46px !important;
  }

  .sidebar-nav {
    padding: 0.35rem 0 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }

  .sidebar-section-label {
    padding: 0.5rem 1rem 0.2rem !important;
  }

  .nav-item {
    padding: 0.42rem 0.95rem !important;
    font-size: 0.84rem !important;
  }

  .sidebar-user {
    padding: 0.5rem 0.9rem !important;
  }

  .profile-dropdown a {
    padding: 0.48rem 0.85rem !important;
    font-size: 0.84rem !important;
  }
}
