/* ===================================================================
   Garena & Game Tool Checker — Award-Winning Dark Console Theme
   Design standard: Linear.app / Raycast / Supabase caliber.
   Deep obsidian canvas, precision hairline bevels, executive typography.
   Zero AI slop, zero neon glow, zero tacky vibrating animations.
=================================================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root,
[data-theme="dark"] {
  /* Surface Layers (Deep Obsidian & Machined Slate) */
  --bg-app: #08090e;
  --bg-sidebar: #0e111a;
  --bg-topbar: #0e111a;
  --bg-card: #121522;
  --bg-card-hover: #171c2c;
  --bg-input: #0a0c13;
  --bg-pill: #191f32;
  --bg-table-header: #151928;
  --bg-modal: #161a29;
  --bg-toast: #1a1f33;
  --bg-hover-row: rgba(255, 255, 255, 0.04);

  /* Borders & Hairline Bevels */
  --border: rgba(255, 255, 255, 0.10);
  --border-subtle: rgba(255, 255, 255, 0.055);
  --border-strong: rgba(255, 255, 255, 0.20);
  --border-dashed: rgba(255, 255, 255, 0.18);
  --border-dashed-hover: rgba(255, 255, 255, 0.32);
  --border-specular: rgba(255, 255, 255, 0.22);

  /* Typography Hierarchy - High Contrast for Dark Mode Readability */
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  /* Brand Accent — Deep Bordeaux & Wine Red (Đỏ Rượu Vang Đẳng Cấp) */
  --accent: #b31d3f;
  --accent-hover: #c9284e;
  --accent-active: #8f1430;
  --accent-subtle: rgba(179, 29, 63, 0.14);
  --accent-border: rgba(179, 29, 63, 0.38);

  /* Semantic Status Colors */
  --success: #10b981;
  --success-subtle: rgba(16, 185, 129, 0.14);
  --success-border: rgba(16, 185, 129, 0.32);

  --error: #f43f5e;
  --error-subtle: rgba(244, 63, 94, 0.14);
  --error-border: rgba(244, 63, 94, 0.32);

  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.14);
  --warning-border: rgba(245, 158, 11, 0.32);

  --info: #38bdf8;
  --info-subtle: rgba(56, 189, 248, 0.14);
  --info-border: rgba(56, 189, 248, 0.32);

  /* Geometry & Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Tactile Depth Shadows */
  --shadow-bevel: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-button: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border-strong);
  --shadow-input: inset 0 1px 2px rgba(0, 0, 0, 0.4);

  /* Component specifics */
  --badge-bg: rgba(255, 255, 255, 0.06);
  --badge-bg-active: rgba(255, 255, 255, 0.12);
  --modal-backdrop: rgba(0, 0, 0, 0.75);
  --bg-dropzone: rgba(255, 255, 255, 0.015);
  --bg-dropzone-hover: rgba(255, 255, 255, 0.03);
  --scrollbar-thumb: rgba(255, 255, 255, 0.12);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.22);
  --radial-glow: rgba(179, 29, 63, 0.055);
}

[data-theme="light"] {
  /* Surface Layers (Pure Alabaster & Warm Porcelain) */
  --bg-app: #f4f5f8;
  --bg-sidebar: #ffffff;
  --bg-topbar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fc;
  --bg-input: #f8f9fb;
  --bg-pill: #eceff5;
  --bg-table-header: #f1f3f7;
  --bg-modal: #ffffff;
  --bg-toast: #ffffff;
  --bg-hover-row: rgba(0, 0, 0, 0.025);

  /* Borders & Hairline Bevels */
  --border: rgba(15, 23, 42, 0.08);
  --border-subtle: rgba(15, 23, 42, 0.045);
  --border-strong: rgba(15, 23, 42, 0.16);
  --border-dashed: rgba(15, 23, 42, 0.16);
  --border-dashed-hover: rgba(179, 29, 63, 0.4);
  --border-specular: rgba(15, 23, 42, 0.14);

  /* Typography Hierarchy */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* Brand Accent — Deep Bordeaux & Wine Red (Đỏ Rượu Vang Đẳng Cấp) */
  --accent: #b31d3f;
  --accent-hover: #9b1836;
  --accent-active: #7d1029;
  --accent-subtle: rgba(179, 29, 63, 0.08);
  --accent-border: rgba(179, 29, 63, 0.25);

  /* Semantic Status Colors (Calibrated for crisp readability on light) */
  --success: #059669;
  --success-subtle: rgba(5, 150, 105, 0.09);
  --success-border: rgba(5, 150, 105, 0.25);

  --error: #e11d48;
  --error-subtle: rgba(225, 29, 72, 0.09);
  --error-border: rgba(225, 29, 72, 0.25);

  --warning: #d97706;
  --warning-subtle: rgba(217, 119, 6, 0.09);
  --warning-border: rgba(217, 119, 6, 0.25);

  --info: #0284c7;
  --info-subtle: rgba(2, 132, 199, 0.09);
  --info-border: rgba(2, 132, 199, 0.25);

  /* Tactile Depth Shadows */
  --shadow-bevel: 0 1px 3px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-button: 0 1px 2px rgba(179, 29, 63, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  --shadow-modal: 0 20px 45px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.08);
  --shadow-input: inset 0 1px 2px rgba(15, 23, 42, 0.05);

  /* Component specifics */
  --badge-bg: rgba(15, 23, 42, 0.06);
  --badge-bg-active: rgba(15, 23, 42, 0.12);
  --modal-backdrop: rgba(15, 23, 42, 0.45);
  --bg-dropzone: rgba(15, 23, 42, 0.02);
  --bg-dropzone-hover: rgba(179, 29, 63, 0.04);
  --scrollbar-thumb: rgba(15, 23, 42, 0.15);
  --scrollbar-thumb-hover: rgba(15, 23, 42, 0.28);
  --radial-glow: rgba(179, 29, 63, 0.035);
}

html, body {
  height: 100%;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  background: radial-gradient(1200px 500px at 50% -80px, var(--radial-glow), transparent 75%), var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
}

.only-mobile {
  display: none !important;
}

/* ===================================================================
   MOBILE TOPBAR
=================================================================== */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
}

.mobile-menu-btn {
  position: relative;
}

.mobile-menu-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  font-size: 8.5px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0 4px;
  font-weight: 700;
  line-height: 12px;
  min-width: 12px;
  text-align: center;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-topbar-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}

.mobile-stop-btn {
  background: var(--error);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(244, 63, 94, 0.45);
  transition: transform 0.1s, opacity 0.15s;
}

.mobile-stop-btn:active {
  transform: scale(0.95);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background-color 0.15s;
}

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

.sidebar-mobile-links {
  display: none;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-link-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.sidebar-link-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ===================================================================
   APP LAYOUT
=================================================================== */
.app {
  display: flex;
  height: 100vh;
}

/* ===================================================================
   SIDEBAR
=================================================================== */
.sidebar {
  width: 310px;
  min-width: 310px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 16px 14px;
  overflow: hidden;
  position: relative;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-right: 2px;
}

.sidebar-foot {
  flex-shrink: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* ===================== BRAND ===================== */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-logo.sm {
  width: 26px;
  height: 26px;
  font-size: 12px;
  border-radius: 6px;
}

.brand-title {
  font-weight: 650;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ===================== SIDEBAR SECTIONS ===================== */
.side-section {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.side-section.grow {
  flex: 1;
  min-height: 130px;
}

.side-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.side-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.side-hint code {
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ===================== INPUTS & TEXTAREA ===================== */
.input, .textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-input);
  color: var(--text-primary);
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  outline: none;
  font-family: var(--font-ui);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-faint);
}

.input:hover, .textarea:hover {
  border-color: var(--border-strong);
}

.input:focus, .textarea:focus {
  border-color: var(--accent);
}

.input-mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ===================== CHANGE PASSWORD SECTION ===================== */
.change-pass-tabs {
  display: flex;
  gap: 3px;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 2px;
}

.change-pass-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.change-pass-tab:hover {
  color: var(--text-primary);
}

.change-pass-tab.active {
  background: var(--bg-input);
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.input-with-actions {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-actions .input {
  padding-right: 62px;
}

.input-actions-group {
  position: absolute;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.input-action-btn {
  width: 25px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.input-action-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.input-action-btn.sm {
  width: 22px;
  height: 22px;
}

/* Random Password Card */
.random-pass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.random-pass-info-text {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.random-pass-info-text svg {
  color: var(--accent);
  flex-shrink: 0;
}

.random-preview-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.5px;
  word-break: break-all;
}

.new-pass-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.new-pass-badge:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--success);
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.input-error-shake {
  animation: inputShake 0.4s ease-in-out;
  border-color: var(--error) !important;
}

.textarea {
  flex: 1;
  min-height: 120px;
  resize: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
}

/* Drag overlay on textarea */
.drag-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 16, 0.94);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(2px);
}

.drag-overlay.show {
  display: flex;
}

.drag-overlay-text {
  font-weight: 650;
  color: var(--accent);
  font-size: 13px;
}

/* ===================================================================
   DEDICATED DRAG & DROP ZONE
=================================================================== */
.dropzone-box {
  border: 1.5px dashed var(--border-dashed);
  border-radius: var(--radius-sm);
  background: var(--bg-dropzone);
  padding: 10px 12px;
  margin-top: 6px;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
  user-select: none;
  position: relative;
}

.dropzone-box:hover {
  border-color: var(--border-dashed-hover);
  background: var(--bg-dropzone-hover);
}

.dropzone-box.drag-over {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.dropzone-idle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropzone-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: color 0.18s, border-color 0.18s;
}

.dropzone-box.drag-over .dropzone-icon {
  color: var(--accent);
  border-color: var(--accent-border);
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dropzone-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.dropzone-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.dropzone-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* Active Drag State */
.dropzone-active-state {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  padding: 5px 0;
}

.dropzone-box.drag-over .dropzone-idle {
  display: none;
}

.dropzone-box.drag-over .dropzone-active-state {
  display: flex;
}

.dropzone-box.drag-over .dropzone-file-card {
  display: none !important;
}

.dropzone-box.has-file {
  border: none;
  padding: 0;
  background: transparent;
  cursor: default;
}

.dropzone-box.has-file:hover {
  background: transparent;
  border-color: transparent;
}

/* File Loaded State Card - Single Unified Card */
.dropzone-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  box-shadow: none !important;
  transition: border-color 0.18s ease;
}

.dropzone-file-card:hover {
  border-color: var(--accent-border);
}

.loaded-file-icon {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.loaded-file-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.loaded-file-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.loaded-file-meta {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.loaded-file-meta .remaining-count {
  color: var(--accent);
  font-weight: 600;
}

.loaded-file-remove {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.loaded-file-remove:hover {
  color: var(--error);
  background: var(--error-subtle);
  border-color: rgba(248, 113, 113, 0.25);
}

/* ===================== BUTTONS ===================== */
.btn-group {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
  flex: 1;
  font-family: var(--font-ui);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-sm {
  padding: 7px 11px;
  font-size: 12px;
  flex: none;
  width: 100%;
  margin-top: 6px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 2px 4px rgba(0, 0, 0, 0.4);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 3px 12px rgba(179, 29, 63, 0.35);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-active);
  transform: scale(0.97);
}

.btn-danger {
  background: var(--bg-card);
  color: #fb7185;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  font-weight: 650;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.4);
  color: #fda4af;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 8px rgba(244, 63, 94, 0.2);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  width: 100%;
}

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

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
}

.btn-mini {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-mini:hover {
  color: var(--text-primary);
  background: var(--bg-pill);
}

/* ===================================================================
   MAIN PANEL & TOPBAR
=================================================================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg-app);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-topbar);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

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

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-primary);
}

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

.topbar-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

.topbar-link:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

#statEta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-idle {
  background: var(--text-faint);
}

@keyframes pulse-radar {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    transform: scale(0.95);
  }
  60% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    transform: scale(1.08);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    transform: scale(0.95);
  }
}

.dot-running {
  background: var(--success);
  animation: pulse-radar 2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.dot-stopped {
  background: var(--error);
}

/* ===================================================================
   METRIC CARDS (ANALYTICS COMMAND CENTER)
=================================================================== */
.stat-strip {
  display: grid;
  grid-template-columns: 160px repeat(6, 1fr);
  gap: 10px;
  margin: 14px 20px 0;
  background: transparent;
  flex-shrink: 0;
}

.strip-ring,
.strip-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  box-shadow: var(--shadow-bevel);
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.strip-ring {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-top: 1.5px solid rgba(179, 29, 63, 0.45);
}

.strip-cell:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* Precision top-edge specular line for each metric card */
.strip-cell:nth-child(2) { border-top: 1.5px solid var(--border-specular); }
.strip-cell:nth-child(3) { border-top: 1.5px solid rgba(16, 185, 129, 0.55); }
.strip-cell:nth-child(4) { border-top: 1.5px solid rgba(244, 63, 94, 0.55); }
.strip-cell:nth-child(5) { border-top: 1.5px solid rgba(245, 158, 11, 0.55); }
.strip-cell:nth-child(6) { border-top: 1.5px solid rgba(56, 189, 248, 0.55); }
.strip-cell:nth-child(7) { border-top: 1.5px solid var(--border-specular); }

.strip-icon {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
}

.strip-icon.c-dim {
  color: var(--text-muted);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-feature-settings: 'tnum' 1, 'cv05' 1;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-top: 1px;
}

/* High contrast metric numbers — zero text-shadow */
.c-green { color: var(--success); }
.c-red { color: var(--error); }
.c-yellow { color: var(--warning); }
.c-accent { color: var(--accent); }

/* Progress Ring — Lớn, rõ ràng, hiển thị trực quan nổi bật */
.ring {
  position: relative;
  width: 66px;
  height: 66px;
  flex-shrink: 0;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 8;
}

.ring-bg {
  stroke: var(--bg-pill);
}

.ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 0 4px rgba(179, 29, 63, 0.4));
  will-change: stroke-dashoffset;
}

.ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#ringPercent {
  font-size: 17px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.ring-label {
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 750;
  margin-top: 2px;
}

/* ===================================================================
   FILTER BAR & SEARCH
=================================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.filter-tabs {
  display: inline-flex;
  gap: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.filter-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.filter-tab:active {
  transform: scale(0.96);
}

.filter-tab:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

.filter-tab.active {
  background: var(--bg-pill);
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--border-subtle);
}

.tab-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  background: var(--badge-bg);
  color: var(--text-muted);
  line-height: 1.2;
}

.filter-tab.active .tab-badge {
  background: var(--badge-bg-active);
  color: var(--text-primary);
}

.tab-badge.hit {
  background: var(--success-subtle);
  color: var(--success);
}

.tab-badge.fail {
  background: var(--error-subtle);
  color: var(--error);
}

.tab-badge.reload {
  background: var(--warning-subtle);
  color: var(--warning);
}

.search-wrap {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  color: var(--text-primary);
  padding: 6px 12px 6px 30px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  outline: none;
  width: 200px;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.search-box::placeholder {
  color: var(--text-muted);
}

.search-box:focus {
  border-color: var(--accent);
}

/* ===================================================================
   RESULTS TABLE (DATA GRID CARD)
=================================================================== */
.results-wrap {
  flex: 1;
  overflow: auto;
  margin: 4px 20px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  position: relative;
  box-shadow: var(--shadow-bevel);
  min-height: 0;
  contain: paint layout;
}

.results-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
}

.results-table thead th {
  white-space: nowrap;
  text-align: left;
  padding: 9px 12px;
  background: var(--bg-table-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--text-muted);
  font-weight: 650;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
}

/* STT / ID (#) — Strictly 75px fixed with subtle right vertical divider if present */
.results-table th.col-idx,
.results-table td.col-idx {
  width: 75px !important;
  min-width: 75px !important;
  max-width: 75px !important;
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  text-align: left;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  border-right: 1px solid var(--border-subtle);
}

.cell-ellipsis {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-table tbody tr {
  transition: background-color 0.1s ease;
}

.results-table tbody tr:hover {
  background: var(--bg-hover-row);
}

.results-table tbody tr:hover td.col-idx {
  color: var(--text-secondary);
}

@keyframes hit-glow {
  0% {
    background-color: rgba(16, 185, 129, 0.28);
    box-shadow: inset 4px 0 0 var(--success);
  }
  100% {
    background-color: transparent;
    box-shadow: inset 0 0 0 transparent;
  }
}

.row-hit-flash {
  animation: hit-glow 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Status Chips with mini illuminated dot indicator */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5.5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 650;
  font-family: var(--font-ui);
  letter-spacing: 0.4px;
  white-space: nowrap;
  line-height: 1;
}

.status-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 5px currentColor;
  flex-shrink: 0;
}

.status-success {
  background: var(--success-subtle);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.status-error {
  background: var(--error-subtle);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.status-reload {
  background: var(--warning-subtle);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

/* Empty State */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 12px;
  text-align: center;
  padding: 60px 20px;
  font-size: 13px;
  user-select: none;
}

.empty-state.show {
  display: flex;
}

@keyframes subtle-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  animation: subtle-float 3.5s ease-in-out infinite;
}

.empty-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.empty-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===================================================================
   MODALS (EXPORT & GUIDE)
=================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.24s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.modal-backdrop.show .modal {
  transform: scale(1) translateY(0);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-weight: 650;
  font-size: 14px;
  color: var(--text-primary);
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Export Modal */
.export-modal-body {
  padding: 16px 18px;
}

.export-section-label {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.export-format-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.export-fmt-btn {
  flex: 1;
  padding: 8px 0;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s, transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.export-fmt-btn:active {
  transform: scale(0.97);
}

.export-fmt-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.export-fmt-btn.active {
  background: var(--bg-pill);
  border-color: var(--accent);
  color: var(--accent);
}

.export-multi-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.export-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.export-type-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.export-type-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.export-type-card:active {
  transform: scale(0.98);
}

.export-type-card.selected {
  background: var(--bg-card-hover);
  border-color: var(--accent-border);
}

.export-type-card.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.export-type-card.all-card {
  grid-column: 1 / -1;
}

.export-type-info {
  flex: 1;
  min-width: 0;
}

.export-type-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.export-type-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  font-family: var(--font-mono);
}

.check-mark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.export-type-card.selected .check-mark {
  background: var(--accent);
  border-color: var(--accent);
}

.export-type-card.selected .check-mark::after {
  content: '✓';
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
}

.export-confirm-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.btn-copy {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bevel);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-copy:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-copy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dot-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  background: currentColor;
}

.dot-mini.c-green { color: var(--success); }
.dot-mini.c-red { color: var(--error); }
.dot-mini.c-yellow { color: var(--warning); }
.dot-mini.c-dim { color: var(--text-muted); }

/* ===== Session Choice Modal ===== */
.session-modal {
  max-width: 440px;
}

.session-modal .modal-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.session-modal .modal-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text-primary);
  width: auto;
  margin: 0 auto;
}

.session-modal .modal-title svg {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.session-modal-body {
  padding: 16px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.session-modal-intro {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Thống kê chi tiết Hits / Fails / Reloads / Chưa check */
.session-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.session-stat-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-bevel);
}

.session-stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.session-stat-dot.c-green { background: var(--success); }
.session-stat-dot.c-red { background: var(--error); }
.session-stat-dot.c-yellow { background: var(--warning); }
.session-stat-dot.c-info { background: var(--info); }

.session-stat-pill-label {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.session-stat-pill-val {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.session-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session-opt-btn {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
  position: relative;
  font-family: inherit;
}

.session-opt-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.session-opt-btn.primary {
  border-color: var(--accent-border);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(179, 29, 63, 0.08) 100%);
}

.session-opt-btn.primary:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--bg-card-hover) 0%, rgba(179, 29, 63, 0.16) 100%);
}

.session-opt-btn.secondary {
  border-color: var(--border);
  background: var(--bg-card);
}

.session-opt-btn.secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.session-opt-btn.danger {
  border-color: var(--border);
}

.session-opt-btn.danger:hover {
  border-color: var(--error-border);
  background: linear-gradient(135deg, var(--bg-card-hover) 0%, rgba(244, 63, 94, 0.08) 100%);
}

.session-opt-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.session-opt-btn.primary .session-opt-icon {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(179, 29, 63, 0.35);
}

.session-opt-btn.secondary .session-opt-icon {
  background: var(--bg-pill);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.session-opt-btn.secondary:hover .session-opt-icon {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.session-opt-btn.danger .session-opt-icon {
  background: var(--bg-pill);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.session-opt-btn.danger:hover .session-opt-icon {
  background: var(--error-subtle);
  color: var(--error);
  border-color: var(--error-border);
}

.badge-rec {
  position: absolute;
  top: 10px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.35px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(179, 29, 63, 0.16);
  color: #ff5277;
  border: 1px solid rgba(255, 82, 119, 0.55);
  box-shadow: 0 1px 4px rgba(179, 29, 63, 0.22);
  user-select: none;
  pointer-events: none;
  text-transform: uppercase;
  transition: all 0.16s ease;
}

[data-theme="light"] .badge-rec {
  background: rgba(179, 29, 63, 0.08);
  color: var(--accent);
  border-color: rgba(179, 29, 63, 0.45);
}

.session-opt-btn.primary:hover .badge-rec {
  background: rgba(179, 29, 63, 0.25);
  border-color: rgba(255, 82, 119, 0.85);
  box-shadow: 0 1px 6px rgba(179, 29, 63, 0.35);
}

.session-opt-btn.primary .session-opt-title {
  padding-right: 68px;
}

.session-opt-text {
  flex: 1;
  min-width: 0;
}

.session-opt-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.session-opt-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 4px;
}

.session-opt-desc b {
  color: var(--text-primary);
  font-weight: 600;
}

/* Guide Modal */
.modal-wide { max-width: 540px; }
.modal-tall { max-height: 85vh; }
.guide-body { max-height: 65vh; }
.guide-section { margin-bottom: 16px; }
.guide-section:last-of-type { margin-bottom: 6px; }

.guide-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.guide-num {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: var(--bg-pill);
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.guide-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 6px;
}

.guide-text b {
  color: var(--text-primary);
}

.guide-text code {
  background: var(--bg-card);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.guide-example {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.guide-status-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}

.guide-status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.guide-status-item .status-chip {
  flex-shrink: 0;
}

.guide-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

/* ===================================================================
   TOAST NOTIFICATION
=================================================================== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-toast);
  border: 1px solid var(--border-strong);
  border-left: 3.5px solid var(--text-muted);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 550;
  box-shadow: var(--shadow-modal);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
  pointer-events: none;
  z-index: 100000;
  max-width: 360px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.toast.error {
  border-left-color: var(--error);
}

.toast.success {
  border-left-color: var(--success);
}

/* ===================================================================
   SCROLLBAR
=================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* ===================================================================
   APP INITIAL LOADING SCREEN
=================================================================== */
.app-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: all;
  user-select: none;
  transition: opacity 0.25s ease, visibility 0.25s;
  visibility: visible;
  opacity: 1;
}

.app-loading-screen.loaded {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.loading-spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--bg-pill);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 12.5px;
  font-family: var(--font-ui);
  color: var(--text-secondary);
  font-weight: 500;
}

.loading-error-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  text-align: center;
}

.loading-error-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--error);
}

.loading-error-msg {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.loading-error-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ===================================================================
   RESPONSIVE (TABLET & MOBILE)
=================================================================== */
@media (max-width: 1024px) {
  .stat-strip {
    grid-template-columns: 145px repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg-app) !important;
  }

  .only-mobile {
    display: flex !important;
  }

  /* TOPBAR: Chỉ hiển thị thanh mobile duy nhất, gọn gàng và tinh tế */
  .mobile-topbar {
    display: flex;
    height: 48px;
    padding: 6px 14px;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .mobile-menu-btn {
    width: 36px;
    height: 36px;
    padding: 7px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
  }

  .mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .mobile-topbar-actions .icon-btn {
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
  }

  .main .topbar,
  .topbar {
    display: none !important;
  }

  .app {
    height: calc(100% - 48px);
    height: calc(100dvh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
  }

  /* SIDEBAR: Drawer toàn màn hình cao, bo góc phải, mượt mà chuẩn native */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(340px, 86vw);
    min-width: unset;
    z-index: 999;
    visibility: hidden;
    pointer-events: none;
    box-shadow: none !important;
    border-right: 1px solid var(--border);
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
  }

  .sidebar.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: var(--modal-backdrop);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    display: block;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: all;
  }

  .sidebar-scroll {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    gap: 12px;
    overflow-y: auto;
  }

  .sidebar-head {
    padding: 12px 14px;
  }

  .side-section {
    margin-bottom: 0;
  }

  .side-section.grow {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 180px;
  }

  /* Textarea account co giãn tự nhiên theo chiều cao như bản PC */
  .textarea {
    flex: 1;
    min-height: 160px;
    height: auto !important;
    max-height: none !important;
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 8px;
  }

  .side-hint {
    font-size: 10.5px;
    margin: 4px 0 6px;
    line-height: 1.4;
  }

  /* Dropzone trên mobile: đồng bộ chuẩn đẹp như PC */
  .dropzone-box {
    padding: 9px 12px;
    border: 1.5px dashed var(--border-dashed);
    border-radius: 8px;
    background: var(--bg-dropzone);
    min-height: unset;
    margin-top: 4px;
    cursor: pointer;
  }

  .dropzone-idle {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: center;
  }

  .dropzone-icon {
    margin-bottom: 0;
    color: var(--accent);
  }

  .dropzone-title {
    display: inline;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .dropzone-sub {
    display: inline;
    font-size: 11.5px;
    color: var(--text-muted);
  }

  .dropzone-link {
    display: inline;
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
  }

  .sidebar-foot {
    padding: 10px 14px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
  }

  .btn-group {
    display: flex;
    flex-direction: row;
    gap: 8px;
  }

  #btnStart {
    flex: 2;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
  }

  #btnStop {
    flex: 1;
    padding: 10px 10px;
    font-size: 12px;
    border-radius: 8px;
  }

  #btnExport {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 8px;
    margin-top: 6px;
    width: 100%;
  }

  .sidebar-mobile-links {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
  }

  .sidebar-link-btn {
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 6px;
  }

  /* ===================================================================
     STAT STRIP TRÊN MOBILE:
     - Card 1 (Tiến độ): Hero Banner ngang ở trên (100% width)
     - 6 Cards còn lại: Lưới 3 cột x 2 hàng cân đối 100%
  =================================================================== */
  .stat-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 8px 10px 0;
    flex-shrink: 0;
  }

  .stat-strip .strip-ring {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 10px 14px;
    min-height: 60px;
    text-align: left;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
  }

  .stat-strip .strip-cell {
    min-width: 0;
    padding: 9px 4px 8px;
    min-height: 56px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
  }

  .strip-icon {
    display: none;
  }

  .stat-label {
    order: 1;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .stat-value {
    order: 2;
    font-size: 17px;
    line-height: 1.1;
    font-weight: 700;
    font-family: var(--font-mono);
  }

  #statEta {
    display: block;
    font-size: 8.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
  }

  .ring {
    width: 58px;
    height: 58px;
    flex-shrink: 0;
  }

  .ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #ringPercent {
    font-size: 15px;
    font-weight: 800;
    font-family: var(--font-mono);
  }

  .strip-ring .ring-label {
    display: none;
  }

  .strip-ring-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .strip-ring-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
  }

  .strip-ring-sub {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 3px;
    font-family: var(--font-mono);
  }

  /* Filter bar & table */
  .filter-bar {
    padding: 6px 10px 4px;
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
  }

  .filter-tabs {
    display: flex;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    box-shadow: var(--shadow-bevel);
  }

  .filter-tab {
    flex: 1;
    justify-content: center;
    padding: 5px 2px;
    font-size: 11px;
    gap: 4px;
    border-radius: 4px;
    border: 1px solid transparent;
  }

  .filter-tab.active {
    background: var(--bg-pill);
    border-color: var(--border-subtle);
  }

  .tab-badge {
    font-size: 9.5px;
    padding: 1px 4px;
  }

  .search-wrap {
    width: 100%;
    margin-left: 0;
  }

  .search-box {
    width: 100%;
    height: 32px;
    padding: 5px 10px 5px 28px;
    font-size: 11.5px;
    border-radius: var(--radius-sm);
  }

  .results-wrap {
    flex: 1 1 auto;
    min-height: 0;
    margin: 4px 10px 10px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    position: relative;
    box-shadow: var(--shadow-bevel);
  }

  .results-table {
    min-width: 620px;
    font-size: 11.5px;
    border-collapse: separate;
    border-spacing: 0;
  }

  .results-table thead th {
    padding: 8px 10px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-table-header);
    border-bottom: 1px solid var(--border);
  }

  .results-table td {
    padding: 7px 10px;
    font-size: 11.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-subtle);
  }

  .results-table th.col-idx,
  .results-table td.col-idx {
    position: sticky;
    left: 0;
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    padding: 7px 4px;
    text-align: center;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    box-shadow: none;
    z-index: 3;
    color: var(--text-muted);
  }

  .results-table thead th.col-idx {
    z-index: 5;
    background: var(--bg-table-header);
    border-right: 1px solid var(--border);
  }

  .cell-ellipsis {
    max-width: 120px;
  }

  .empty-state {
    padding: 32px 14px;
    gap: 10px;
  }
}

@media (max-width: 520px) {
  .btn-group {
    flex-direction: column;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    max-width: 100%;
    max-height: 94vh;
  }

  .export-type-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .export-confirm-bar {
    flex-wrap: wrap;
  }

  .export-confirm-bar button {
    flex: 1 1 45%;
  }
}

@media (max-width: 380px) {
  .stat-strip {
    gap: 4px;
    margin: 6px 6px 0;
  }

  .strip-ring,
  .strip-cell {
    padding: 5px 4px;
  }

  .stat-value {
    font-size: 13px;
  }

  .stat-label {
    font-size: 8px;
  }

  .results-wrap {
    margin: 4px 6px 6px;
  }
}

/* Hiệu ứng phản hồi xúc giác thị giác khi click copy ô dữ liệu */
@keyframes cellCopiedPulse {
  0% {
    background-color: rgba(16, 185, 129, 0.45);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.6);
  }
  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

.cell-copied-flash {
  animation: cellCopiedPulse 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
