/* ═══════════════════════════════════════════════════════════
   YumUp Production Manager — Design System
   Premium dark mode with glassmorphism & micro-animations
═══════════════════════════════════════════════════════════ */

/* ── Google Fonts fallback ── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  /* Background - Light Theme (Default) */
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-overlay: #e2e8f0;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;

  /* Accent Colors (Slightly adjusted for contrast on light mode) */
  --cyan: #0891b2;
  --cyan-light: #06b6d4;
  --cyan-dark: #164e63;
  --indigo: #4f46e5;
  --indigo-light: #6366f1;
  --indigo-dark: #312e81;
  --emerald: #059669;
  --emerald-light: #10b981;
  --amber: #d97706;
  --amber-light: #f59e0b;
  --rose: #e11d48;
  --rose-light: #f43f5e;
  --violet: #7c3aed;
  --violet-light: #8b5cf6;

  /* Text - Light Theme */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-disabled: #94a3b8;

  /* Borders - Light Theme */
  --border: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.16);
  --border-accent: rgba(8, 145, 178, 0.3);

  /* Glass - Light Theme */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(15, 23, 42, 0.1);
  --glass-shadow: 0 8px 32px rgba(15, 23, 42, 0.05);

  /* Gradients - Light Theme */
  --grad-primary: linear-gradient(135deg, var(--cyan), var(--indigo));
  --grad-success: linear-gradient(135deg, var(--emerald), #0891b2);
  --grad-warning: linear-gradient(135deg, var(--amber), #ea580c);
  --grad-danger: linear-gradient(135deg, var(--rose), #b91c1c);
  --grad-violet: linear-gradient(135deg, var(--violet), var(--indigo));

  /* Shadows - Light Theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow-cyan: 0 0 20px rgba(8, 145, 178, 0.2);
  --shadow-glow-indigo: 0 0 20px rgba(79, 70, 229, 0.2);

  /* --- Common Variables --- */
  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* Typography */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
  /* Background */
  --bg-base: #0a0c14;
  --bg-surface: #0f111a;
  --bg-elevated: #141828;
  --bg-overlay: #1a1f32;
  --bg-card: #1e2438;
  --bg-input: #12162a;

  /* Accent Colors */
  --cyan: #06b6d4;
  --cyan-light: #22d3ee;
  --cyan-dark: #0891b2;
  --indigo: #6366f1;
  --indigo-light: #818cf8;
  --indigo-dark: #4f46e5;
  --emerald: #10b981;
  --emerald-light: #34d399;
  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --rose: #f43f5e;
  --rose-light: #fb7185;
  --violet: #8b5cf6;
  --violet-light: #a78bfa;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-disabled: #475569;

  /* Borders */
  --border: rgba(148, 163, 184, 0.08);
  --border-hover: rgba(148, 163, 184, 0.16);
  --border-accent: rgba(6, 182, 212, 0.3);

  /* Glass */
  --glass-bg: rgba(30, 36, 56, 0.7);
  --glass-border: rgba(148, 163, 184, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

  /* Gradients */
  --grad-primary: linear-gradient(135deg, var(--cyan), var(--indigo));
  --grad-success: linear-gradient(135deg, var(--emerald), #06b6d4);
  --grad-warning: linear-gradient(135deg, var(--amber), #f97316);
  --grad-danger: linear-gradient(135deg, var(--rose), #dc2626);
  --grad-violet: linear-gradient(135deg, var(--violet), var(--indigo));

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.3);
  --shadow-glow-indigo: 0 0 20px rgba(99, 102, 241, 0.3);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* ── Login Screen ── */
/* Khôi phục phiên: tránh nháy màn đăng nhập khi F5 (script inline trong index.html) */
html.session-restore #login-screen {
  display: none !important;
}

html.session-restore #app-screen {
  display: flex !important;
  flex-direction: column;
  min-height: 100vh;
}

html.session-restore #server-offline-screen {
  display: none !important;
}

/* ── Server offline ── */
.server-offline-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 40%, rgba(244, 63, 94, 0.12) 0%, transparent 55%),
              radial-gradient(ellipse at 70% 60%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
              var(--bg-base);
}

.server-offline-card {
  max-width: 440px;
  width: calc(100% - 32px);
  padding: 36px 32px;
  text-align: center;
}

.server-offline-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: var(--rose-light);
}

.server-offline-icon i {
  width: 32px;
  height: 32px;
}

.server-offline-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.server-offline-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 24px;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.12) 0%, transparent 50%),
              radial-gradient(ellipse at 60% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
              var(--bg-base);
}

.login-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: orbFloat 8s ease-in-out infinite alternate;
}
.login-orb-1 { width: 400px; height: 400px; background: rgba(99, 102, 241, 0.2); top: -100px; left: -100px; animation-delay: 0s; }
.login-orb-2 { width: 300px; height: 300px; background: rgba(6, 182, 212, 0.15); bottom: -80px; right: 10%; animation-delay: -3s; }
.login-orb-3 { width: 250px; height: 250px; background: rgba(139, 92, 246, 0.12); top: 40%; right: -60px; animation-delay: -6s; }

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(30px, -20px) scale(1.05); }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: var(--space-6);
}

.login-brand { text-align: center; margin-bottom: var(--space-8); }

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.logo-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 20px rgba(6, 182, 212, 0.5));
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 20px rgba(6, 182, 212, 0.5)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 30px rgba(6, 182, 212, 0.7)); }
}

.login-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.login-subtitle {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-card {
  padding: var(--space-8);
  border-radius: var(--radius-xl);
}

.login-card-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: var(--space-6);
  color: var(--text-primary);
}

.auth-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tab:hover { color: var(--text-secondary); }

.auth-tab.active {
  background: rgba(99, 102, 241, 0.2);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.login-form-extras {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.login-remember input { accent-color: var(--indigo); }

.login-link {
  font-size: 0.875rem;
  color: var(--cyan-light);
  text-decoration: none;
}

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

.login-switch {
  text-align: center;
  margin-top: var(--space-4);
}

.login-switch a {
  color: var(--cyan-light);
  text-decoration: none;
}

.login-switch a:hover { text-decoration: underline; }

.auth-grid-2 {
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media (max-width: 480px) {
  .auth-grid-2 { grid-template-columns: 1fr; }
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.row-pending {
  background: rgba(245, 158, 11, 0.06);
}

.login-demo {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.login-demo-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-demo-btns {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin-bottom: var(--space-4);
}

.btn-demo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-accent);
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan-light);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-demo:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.25);
}
.btn-demo svg { width: 14px; height: 14px; }

.btn-demo-manager {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.1);
  color: var(--indigo-light);
}
.btn-demo-manager:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--indigo);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

.btn-demo-qc {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-light);
}
.btn-demo-qc:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--emerald);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

.login-accounts {
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius);
  padding: var(--space-4);
  border: 1px solid var(--border);
}

.accounts-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.accounts-grid { display: flex; flex-direction: column; gap: 6px; }

.account-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.account-item.clickable-account,
#account-list .account-item {
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  font-family: var(--font-body);
  width: 100%;
}

.account-item.clickable-account:hover,
#account-list .account-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ── Glassmorphism ── */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

.glass-panel-dark {
  background: rgba(10, 12, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

/* ── App Screen ── */
.app-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: radial-gradient(ellipse at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 90% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
              var(--bg-surface);
}

/* ── App Layout (sidebar + shell) ── */
.app-layout {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: radial-gradient(ellipse at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 90% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
              var(--bg-surface);
}

.app-sidebar {
  width: 256px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  z-index: 120;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: 60px;
  flex-shrink: 0;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.side-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-2);
}

.side-group + .side-group {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.side-group-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cyan-light);
  padding: 0 var(--space-3) var(--space-2);
  line-height: 1.2;
  user-select: none;
}

.app-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  height: 60px;
  border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: var(--space-3); min-width: 0; flex: 1; }

.topbar-heading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-sub {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  height: 60px;
}

.navbar-left, .navbar-right { display: flex; align-items: center; gap: var(--space-4); }

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo-icon-sm { font-size: 1.4rem; }

.brand-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-overlay);
}
.btn-icon svg { width: 16px; height: 16px; }

.notif-btn { position: relative; }

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--rose);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-surface);
}

.user-menu { position: relative; }

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.user-info:hover { background: var(--bg-overlay); border-color: var(--border); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; }

#user-name-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role-badge {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-chevron { width: 14px; height: 14px; color: var(--text-muted); transition: transform var(--transition); }
.user-info.open .user-chevron { transform: rotate(180deg); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
  z-index: 200;
}
.user-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}
.dropdown-item:hover { background: var(--bg-card); color: var(--text-primary); }
.dropdown-item svg { width: 15px; height: 15px; }
.dropdown-item-danger:hover { color: var(--rose); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── App Main ── */
.app-main {
  flex: 1;
  padding: var(--space-5) var(--space-6) var(--space-6);
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle,
.page-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 4px;
  margin-bottom: var(--space-6);
  line-height: 1.5;
}

#mgr-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-bottom: var(--space-2);
}

#mgr-header .stats-grid {
  margin-bottom: 0;
}

#mgr-header .chart-card {
  margin-top: var(--space-2);
}

#mgr-header .table-card {
  margin-top: 0;
}

/* ── Tabs ── */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 4px;
  border: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: var(--space-6);
  flex-wrap: nowrap;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn svg { width: 15px; height: 15px; }
.tab-btn:hover { color: var(--text-primary); background: var(--bg-overlay); }
.tab-btn.active {
  background: var(--grad-primary);
  color: white;
  box-shadow: var(--shadow-glow-cyan);
}

.tab-content-panel { display: none; animation: fadeInUp 300ms ease; }
.tab-content-panel.active { display: block; }

/* Tab buttons inside the sidebar become vertical nav items */
.sidebar-nav .tab-btn {
  width: 100%;
  justify-content: flex-start;
  gap: var(--space-3);
  padding: 10px 12px;
  font-size: 0.875rem;
  border-radius: var(--radius);
  position: relative;
}
.sidebar-nav .tab-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav .tab-btn:hover { color: var(--text-primary); background: var(--bg-overlay); }
.sidebar-nav .tab-btn.active {
  background: var(--bg-overlay);
  color: var(--text-primary);
  box-shadow: none;
  font-weight: 600;
}
.sidebar-nav .tab-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: var(--radius-full);
  background: var(--grad-primary);
}
.sidebar-nav .tab-btn.active svg { color: var(--cyan); }

/* Narrower sidebar on small screens to keep content readable */
@media (max-width: 640px) {
  .app-sidebar { width: 200px; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Stat Cards ── */
.stats-grid,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-primary);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--shadow-glow-cyan);
}

.stat-card:hover::before { opacity: 0.04; }

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
}
.stat-icon svg { width: 20px; height: 20px; }

.stat-icon-cyan { background: rgba(6, 182, 212, 0.15); color: var(--cyan); }
.stat-icon-indigo { background: rgba(99, 102, 241, 0.15); color: var(--indigo-light); }
.stat-icon-emerald { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }
.stat-icon-amber { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.stat-icon-rose { background: rgba(244, 63, 94, 0.15); color: var(--rose-light); }
.stat-icon-violet { background: rgba(139, 92, 246, 0.15); color: var(--violet-light); }

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-trend {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.stat-trend-up { background: rgba(16, 185, 129, 0.15); color: var(--emerald); }
.stat-trend-down { background: rgba(244, 63, 94, 0.15); color: var(--rose-light); }

.err-count {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.err-count--zero { color: var(--emerald); }
.err-count--warn { color: var(--amber); }
.err-count--high { color: var(--rose-light); }

/* ── Charts Grid ── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.charts-grid-3 {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.04), inset 0 1px 0 rgba(34, 211, 238, 0.06);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.chart-card:hover {
  border-color: rgba(34, 211, 238, 0.3);
  box-shadow: 0 0 25px rgba(34, 211, 238, 0.1), 0 0 60px rgba(34, 211, 238, 0.04), inset 0 0 30px rgba(34, 211, 238, 0.03);
}

.chart-card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.chart-card-title svg { width: 16px; height: 16px; color: var(--cyan); }

.chart-container { position: relative; height: 220px; }
.chart-container canvas { max-height: 220px !important; }

/* ── Tables ── */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.table-header,
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.table-title,
.table-head h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.table-title svg,
.table-head h3 svg { width: 16px; height: 16px; color: var(--cyan); }

.table-wrapper,
.table-scroll { overflow-x: auto; }

.table-card .table-wrapper,
.table-card .table-scroll {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.table-card .table-scroll table,
.table-wrapper table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.855rem;
}

thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.cat-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: var(--indigo-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.err-name { font-weight: 600; }
.err-name--compact {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
}
.err-desc { font-size: 0.78rem; color: var(--amber); margin-top: 2px; }

.mgr-top-errors-header {
  flex-wrap: wrap;
  gap: 12px;
}

.mgr-top-errors-header .table-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.mgr-top-errors-meta {
  padding: 10px var(--space-5) 14px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
}

.mgr-top-errors-meta.hidden {
  display: none;
}

.mgr-top-errors-wrap .mgr-top-errors-table {
  padding-top: var(--space-3);
}

.fail-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(244, 63, 94, 0.14);
  color: var(--rose-light);
  border: 1px solid rgba(244, 63, 94, 0.28);
}

.num-good { color: var(--emerald); font-weight: 700; }
.num-fail { color: var(--rose-light); font-weight: 700; }

.kpi-low { color: var(--amber); }
.kpi-mid { color: var(--indigo-light); }
.kpi-high { color: var(--cyan); }
.kpi-done { color: var(--emerald); }
.fill.kpi-low { background: var(--amber); }
.fill.kpi-mid { background: var(--indigo-light); }
.fill.kpi-high { background: var(--cyan); }
.fill.kpi-done { background: var(--emerald); }
.fill.quality { background: linear-gradient(90deg, #10b981, #34d399); }

.chart-row-accordion { background: var(--bg-elevated); }

.dual-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}
.dp-pct { font-weight: 700; font-size: 0.82rem; min-width: 42px; }
.dual-progress .track {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 5px;
  overflow: hidden;
  min-width: 70px;
}
.dual-progress .fill { height: 100%; border-radius: 5px; transition: width 0.5s; }
.dual-progress .num { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

.chart-wrap { position: relative; height: 220px; }
.chart-wrap canvas { max-height: 220px !important; }

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background var(--transition-fast);
  cursor: default;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.table-empty {
  text-align: center;
  padding: var(--space-10) !important;
  color: var(--text-muted) !important;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-admin { background: rgba(6, 182, 212, 0.15); color: var(--cyan-light); border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-manager { background: rgba(99, 102, 241, 0.15); color: var(--indigo-light); border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-qc { background: rgba(16, 185, 129, 0.15); color: var(--emerald-light); border: 1px solid rgba(16, 185, 129, 0.3); }

.badge-good { background: rgba(16, 185, 129, 0.15); color: var(--emerald-light); border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-ok { background: rgba(6, 182, 212, 0.15); color: var(--cyan-light); border: 1px solid rgba(6, 182, 212, 0.25); }
.badge-warn { background: rgba(245, 158, 11, 0.15); color: var(--amber-light); border: 1px solid rgba(245, 158, 11, 0.25); }
.badge-danger { background: rgba(244, 63, 94, 0.15); color: var(--rose-light); border: 1px solid rgba(244, 63, 94, 0.25); }

.badge-active { background: rgba(16, 185, 129, 0.12); color: var(--emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-inactive { background: rgba(100, 116, 139, 0.12); color: var(--text-muted); border: 1px solid rgba(100, 116, 139, 0.2); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--grad-primary);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.25);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35);
}

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

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

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose-light);
  border-color: rgba(244, 63, 94, 0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(244, 63, 94, 0.25); }

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border-color: rgba(16, 185, 129, 0.3);
}
.btn-success:hover:not(:disabled) { background: rgba(16, 185, 129, 0.25); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-full,
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.required { color: var(--rose); }

.input-icon-wrapper { position: relative; }

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-icon-right {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.form-input,
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  transition: all var(--transition);
  outline: none;
}

.form-input:focus,
.input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

.form-input::placeholder,
.input::placeholder { color: var(--text-muted); }

.input-icon-wrapper .form-input,
.input-icon-wrapper .input { padding-left: 40px; }

.form-group,
.field { margin-bottom: var(--space-4); }

.field label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.input-group { position: relative; display: flex; }
.input-group .input { flex: 1; border-radius: var(--radius) 0 0 var(--radius); }
.toggle-pwd {
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.toggle-pwd:hover { color: var(--text-primary); }
.toggle-pwd svg { width: 16px; height: 16px; }

.form-select,
.select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
  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='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-select:focus,
.select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12); }

.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: all var(--transition);
}
.form-textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12); }

.field textarea:not(.form-textarea) {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: all var(--transition);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--cyan);
}

/* ── Filter Row ── */
.filter-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.filter-row .form-select { width: auto; min-width: 160px; }
.filter-row .form-input { width: auto; flex: 1; min-width: 200px; }

/* ── Modals & Flatpickr Premium Style ── */
.flatpickr-calendar {
  z-index: 99999 !important;
  background: var(--bg-card) !important;
  border: 1px solid rgba(34, 211, 238, 0.25) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
  border-radius: var(--radius-xl) !important;
  padding: 14px !important;
  font-family: inherit !important;
  width: 248px !important;
  box-sizing: border-box !important;
}

.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after {
  display: none !important;
}

.flatpickr-innerContainer,
.flatpickr-rContainer {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}

.flatpickr-months {
  background: transparent !important;
  margin-bottom: 4px !important;
  width: 100% !important;
}

.flatpickr-month {
  color: var(--text-primary) !important;
  fill: var(--text-primary) !important;
  height: 30px !important;
}

.flatpickr-current-month {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
  padding-top: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  width: auto !important;
  left: 0 !important;
  right: 0 !important;
  padding-left: 28px !important;
  padding-right: 28px !important;
}

.flatpickr-current-month input.cur-year {
  color: var(--text-primary) !important;
  font-weight: 700 !important;
  padding: 0 2px !important;
  min-width: 3.5em !important;
  width: auto !important;
}

.flatpickr-current-month .numInputWrapper span.arrowUp:after { border-bottom-color: var(--text-primary) !important; }
.flatpickr-current-month .numInputWrapper span.arrowDown:after { border-top-color: var(--text-primary) !important; }

.flatpickr-prev-month, .flatpickr-next-month {
  color: var(--text-secondary) !important;
  fill: var(--text-secondary) !important;
  top: 10px !important;
  padding: 4px !important;
  border-radius: 50% !important;
  transition: all 0.2s ease !important;
}

.flatpickr-prev-month:hover, .flatpickr-next-month:hover {
  background: var(--bg-overlay) !important;
  color: var(--cyan) !important;
  fill: var(--cyan) !important;
}

.flatpickr-monthSelect-months {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 6px 4px !important;
  padding: 4px 0 0 0 !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.flatpickr-monthSelect-month {
  width: 100% !important;
  margin: 0 !important;
  padding: 11px 0 !important;
  border-radius: var(--radius-lg) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.88rem !important;
  cursor: pointer !important;
}

.flatpickr-monthSelect-month:hover {
  background: rgba(6, 182, 212, 0.1) !important;
  color: var(--cyan) !important;
  border-color: rgba(34, 211, 238, 0.2) !important;
}

.flatpickr-monthSelect-month.selected {
  background: linear-gradient(135deg, #0891b2, #06b6d4) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 14px rgba(8, 145, 178, 0.4) !important;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 720px);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
  animation: slideUp 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { transform: translateY(30px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-lg { max-width: 700px; }
.modal-xl { max-width: 1000px; }

.modal-header,
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.modal-header h3,
.modal-head h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.modal-header h3 svg,
.modal-head h3 svg { width: 18px; height: 18px; color: var(--cyan); }

.modal-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.modal-close,
.close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.modal-close:hover,
.close-btn:hover { background: var(--bg-overlay); color: var(--text-primary); }
.modal-close svg,
.close-btn svg { width: 15px; height: 15px; }

.modal-body {
  padding: var(--space-6);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.modal-body-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.modal-footer,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.modal-foot .btn-primary {
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.2);
}

.modal-foot .btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.28);
}

/* ── Alerts ── */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.alert-danger {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: var(--rose-light);
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--emerald-light);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--amber-light);
}

.alert-info {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--cyan-light);
}

.system-alerts { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
}

.toast-container .toast {
  opacity: 0;
  transform: translateX(110%);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-container .toast.show {
  opacity: 1;
  transform: translateX(0);
}

@keyframes toastIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

.toast-out {
  animation: toastOut 300ms ease forwards;
}

@keyframes toastOut {
  to { transform: translateX(100%) scale(0.9); opacity: 0; }
}

.toast-success {
  background: rgba(16, 185, 129, 0.95);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.toast-error {
  background: rgba(244, 63, 94, 0.95);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.toast-info {
  background: rgba(6, 182, 212, 0.95);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.toast-warning {
  background: rgba(245, 158, 11, 0.95);
  color: #111;
  border: 1px solid rgba(255,255,255,0.2);
}

/* ── Score Display ── */
.score-display {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.score-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-overlay);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 60px;
}

.score-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 600ms ease;
}

.score-fill-good { background: var(--grad-success); }
.score-fill-ok { background: var(--grad-primary); }
.score-fill-warn { background: var(--grad-warning); }
.score-fill-danger { background: var(--grad-danger); }

.score-value { font-weight: 700; font-size: 0.875rem; min-width: 42px; text-align: right; }

/* ── Checklist ── */
.checklist { display: flex; flex-direction: column; gap: 4px; }

.checklist-category,
.checklist-cat {
  padding: 8px 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  transition: all var(--transition-fast);
}

.checklist-item.is-passed {
  border-color: rgba(16, 185, 129, 0.22);
  background: rgba(16, 185, 129, 0.04);
}

.checklist-item.is-failed {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.1);
  box-shadow: inset 3px 0 0 var(--rose);
}

.checklist-item:hover { border-color: var(--border-hover); }
.checklist-item.is-passed:hover { border-color: rgba(16, 185, 129, 0.35); }
.checklist-item.is-failed:hover { border-color: rgba(244, 63, 94, 0.55); }

.checklist-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.checklist-item.is-failed .checklist-item-title {
  color: var(--rose-light);
}

.checklist-verdict {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
  min-width: 108px;
}

.verdict-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.checklist-item.is-passed .verdict-state--fail { display: none; }
.checklist-item.is-failed .verdict-state--pass { display: none; }

.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.verdict-badge i {
  width: 14px;
  height: 14px;
}

.verdict-badge--pass {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--emerald-light);
}

.verdict-badge--fail {
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: var(--rose-light);
}

.verdict-penalty {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.verdict-btn {
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}

.verdict-btn--fail:hover {
  border-color: rgba(244, 63, 94, 0.45);
  color: var(--rose-light);
  background: rgba(244, 63, 94, 0.08);
}

.verdict-btn--pass:hover {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--emerald-light);
  background: rgba(16, 185, 129, 0.08);
}

.checklist-item.passed { border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.06); }
.checklist-item.failed { border-color: rgba(244, 63, 94, 0.3); background: rgba(244, 63, 94, 0.06); }

.checklist-item-info,
.cinfo { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.checklist-item-code,
.ccode {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.checklist-item-name { font-size: 0.82rem; color: var(--text-secondary); }

.toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--font-body);
}

.toggle-pass { background: rgba(16, 185, 129, 0.15); color: var(--emerald); border-color: rgba(16, 185, 129, 0.3); }
.toggle-fail { background: rgba(244, 63, 94, 0.15); color: var(--rose-light); border-color: rgba(244, 63, 94, 0.3); }
.toggle-btn.active { font-weight: 800; }
.toggle-pass.active { background: rgba(16, 185, 129, 0.25); color: var(--emerald); border-color: rgba(16, 185, 129, 0.5); }
.toggle-fail.active { background: rgba(244, 63, 94, 0.25); color: var(--rose-light); border-color: rgba(244, 63, 94, 0.5); }
.readonly-item { opacity: 0.8; pointer-events: none; }

/* ── Score Live ── */
.score-live-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  position: sticky;
  top: 70px;
}

.score-live-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  line-height: 1;
  margin-bottom: 4px;
}

.score-live-status {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.live-score {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}
.live-score .big {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.review-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.review-col { display: flex; flex-direction: column; gap: var(--space-2); }

.big {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
}
.score-good { color: var(--emerald); }
.score-ok { color: var(--cyan); }
.score-warn { color: var(--amber); }
.score-danger { color: var(--rose-light); }

/* ── Comparison Table ── */
.comparison-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.comparison-table th { background: var(--bg-elevated); padding: 8px 12px; text-align: left; color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
.comparison-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.comparison-table .pass-cell { color: var(--emerald); font-weight: 600; }
.comparison-table .fail-cell { color: var(--rose-light); font-weight: 600; }

/* ── Accordion ── */
.accordion { display: flex; flex-direction: column; gap: var(--space-2); }

.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.accordion-item:hover { border-color: var(--border-hover); }

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  user-select: none;
  gap: var(--space-4);
}

.accordion-header-left { display: flex; align-items: center; gap: var(--space-3); flex: 1; min-width: 0; }
.accordion-header-right { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }

.accordion-title { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; }
.accordion-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.accordion-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.accordion-item.open .accordion-chevron { transform: rotate(180deg); }

.accordion-body {
  display: none;
  padding: 0 var(--space-5) var(--space-5);
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
}
.accordion-item.open .accordion-body { display: block; animation: fadeInUp 250ms ease; }

/* ── History Edit Panel ── */
.history-edit-panel {
  border-top: 1px solid var(--border);
  background: rgba(6, 182, 212, 0.03);
  animation: fadeInUp 250ms ease;
}

.history-edit-panel.hidden { display: none !important; }

.history-edit-panel-inner {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.history-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.history-edit-checklist {
  padding: var(--space-3) var(--space-4) var(--space-2);
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}


/* ── Notification Panel ── */
.notif-list { display: flex; flex-direction: column; gap: var(--space-2); }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.notif-item:hover { background: var(--bg-overlay); }
.notif-item.unread { border-left: 3px solid var(--cyan); }

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-item.read .notif-dot { background: var(--text-muted); }

.notif-message { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.notif-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.section-title svg { width: 18px; height: 18px; color: var(--cyan); }

/* ── Product session panel (batch form) ── */
.product-session-panel {
  background: var(--bg-card);
  border: 1px solid rgba(6, 182, 212, 0.22);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.product-session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.1) 0%, rgba(99, 102, 241, 0.06) 100%);
  border-bottom: 1px solid var(--border);
}

.product-session-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.product-session-title i,
.product-session-title svg {
  width: 16px;
  height: 16px;
  color: var(--cyan);
}

.product-session-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cyan);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.28);
  font-variant-numeric: tabular-nums;
}

.product-session-list {
  display: flex;
  flex-direction: column;
}

/* ── Product row in session ── */
.product-card.is-collapsed .product-wh-meta-slot {
  display: none;
}

.product-wh-meta-slot:empty {
  display: none;
}

.product-wh-meta {
  margin: 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.82rem;
}

.product-card.is-expanded .product-wh-meta-slot .product-wh-meta {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

.product-wh-meta--loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.product-wh-meta--warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.06);
}

.product-wh-meta--ok {
  border-color: rgba(6, 182, 212, 0.25);
}

.product-wh-meta-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--amber);
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.product-wh-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.product-wh-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.78rem;
}

.product-wh-badge svg {
  width: 14px;
  height: 14px;
}

.product-wh-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 8px;
}

.product-wh-kv {
  color: var(--text-secondary);
}

.product-wh-k {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 4px;
}

.product-wh-types {
  margin-bottom: 8px;
}

.product-wh-nas-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-wh-nas-input {
  font-size: 0.8rem;
  font-family: var(--font-mono, monospace);
}

.product-wh-compact-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 4px;
}

.product-wh-mini-chip {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.product-card {
  background: transparent;
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.product-card.is-last {
  border-bottom: none;
}

.product-card.is-expanded {
  background: rgba(6, 182, 212, 0.03);
}

.product-card-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

/* Header — mở rộng: 1 hàng ngang */
.product-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.product-card-head .product-card-code-input {
  flex: 1;
  min-width: 0;
}

.product-card-head-actions,
.product-card-compact-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.product-card-score-badge {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 6px 11px;
  border-radius: var(--radius);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.product-card-score-badge.score-good {
  background: rgba(16, 185, 129, 0.16);
  color: var(--emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.product-card-score-badge.score-ok {
  background: rgba(6, 182, 212, 0.14);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.28);
}

.product-card-score-badge.score-warn {
  background: rgba(245, 158, 11, 0.14);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.product-card-score-badge.score-danger {
  background: rgba(244, 63, 94, 0.14);
  color: var(--rose-light);
  border: 1px solid rgba(244, 63, 94, 0.32);
}

.product-card-submit,
.product-card-toggle,
.product-card-delete {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  min-height: 36px;
  padding: 0 12px !important;
  white-space: nowrap;
}

.product-card-submit i,
.product-card-toggle i,
.product-card-delete i {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.product-card-delete {
  width: 36px;
  padding: 0 !important;
  color: var(--rose-light) !important;
  border-color: rgba(244, 63, 94, 0.28) !important;
}

.product-card-delete:hover {
  background: rgba(244, 63, 94, 0.1) !important;
  border-color: rgba(244, 63, 94, 0.4) !important;
}

/* Header — thu gọn: 1 hàng trong phiên */
.product-card.is-collapsed .product-card-head--compact {
  background: var(--bg-elevated);
}

.product-card-head--compact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: none;
  background: var(--bg-elevated);
}

.product-card-head--compact .product-card-code-input {
  flex: 0 1 148px;
  width: 148px;
  min-width: 88px;
  max-width: 200px;
}

.product-card-compact-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.product-card-compact-meta-text {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.3;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.product-card-status--ok {
  color: var(--emerald-light);
  font-weight: 600;
}

.product-card-status--fail {
  color: var(--rose-light);
  font-weight: 600;
}

.product-card-status--muted {
  color: var(--text-muted);
  font-weight: 500;
}

.product-card-head--compact .product-card-score-badge {
  font-size: 0.9rem;
  padding: 5px 9px;
}

.product-card-head--compact .product-card-delete {
  width: 36px;
  padding: 0 !important;
}

.product-card-body {
  display: block;
  border-top: 1px dashed rgba(6, 182, 212, 0.2);
  background: rgba(15, 23, 42, 0.18);
}

.product-card.is-collapsed .product-card-body {
  display: none;
}

.product-card-collapse-foot {
  padding: 8px 16px 4px;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}

.product-card-collapse-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(6, 182, 212, 0.25);
  background: rgba(6, 182, 212, 0.08);
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}

.product-card-collapse-btn:hover {
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.4);
}

.product-card-collapse-btn i {
  width: 16px;
  height: 16px;
}

.criteria-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 10px;
}

.criteria-grid .checklist-cat {
  margin-top: 6px;
}

.criteria-grid .checklist-cat:first-child {
  margin-top: 0;
}

.product-card .field {
  padding: 0 16px 14px;
}

.product-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.product-card-header { transition: background var(--transition-fast); }
.product-card-header:hover { background: var(--bg-overlay); }

.product-card-body {
  padding: var(--space-4);
  animation: fadeInUp 200ms ease;
}

.product-action-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid rgba(6, 182, 212, 0.22);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
  padding: var(--space-3) var(--space-4);
  margin-bottom: 0;
}

/* Tab tạo phiên: danh sách SP + thanh gửi cố định dưới */
#tab-new {
  padding-bottom: 0;
}

.new-batch-tab {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Workspace liền khối cho "Tạo phiên mới" */
.batch-workspace {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.batch-workspace__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

.batch-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.batch-panel__title {
  margin-bottom: var(--space-4);
}

.batch-panel .form-label {
  margin-bottom: 6px;
}

.batch-panel .form-hint {
  margin: 0 0 10px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.batch-panel .form-input,
.batch-panel .form-select {
  background: var(--bg-elevated);
  border-color: var(--border-hover);
}

.batch-panel .form-input::placeholder {
  color: var(--text-disabled);
  opacity: 1;
}

.form-group--nas {
  margin-bottom: var(--space-3);
}

.nas-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.nas-input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--cyan);
  pointer-events: none;
  z-index: 1;
  flex-shrink: 0;
}

.form-input--nas {
  padding-left: 38px !important;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem !important;
  letter-spacing: 0.01em;
}

.batch-panel .nas-preview-box:empty {
  display: none;
}

.batch-panel .nas-preview-box:not(:empty) {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.batch-panel--summary {
  position: sticky;
  top: 70px;
}

.batch-workspace__products:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

#tab-new .product-action-bar--footer {
  position: sticky;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  margin-top: 0;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-bottom: 1px solid rgba(6, 182, 212, 0.28);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.28), var(--shadow-glow-cyan);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@media (max-width: 860px) {
  .batch-workspace__grid {
    grid-template-columns: 1fr;
  }
  .batch-panel--summary {
    position: static;
  }
}

/* Top lỗi — cuối trang quản lý, dưới mọi tab */
.mgr-top-errors-wrap {
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
}

.product-action-bar-spacer {
  flex: 1;
  min-width: 8px;
}

.product-action-bar + .product-session-panel,
.product-action-bar + #nb-products .product-session-panel {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
}

#nb-products:has(.empty-state) {
  margin-top: var(--space-3);
}

/* Tab view — không lặp title (topbar đã hiển thị) */
.tab-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.tab-view .period-toolbar {
  margin-bottom: 0;
}

.tab-view__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sys-self-card .table-head h3,
.table-card .table-head h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1rem;
}

.sys-self-body {
  padding: var(--space-4);
}

.sys-pl-hint {
  margin: 0;
  padding: var(--space-3) var(--space-5) var(--space-2);
  line-height: 1.5;
}

/* Admin → Hệ thống → Sao lưu */
.backup-workspace {
  max-width: 920px;
}

.backup-card .table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.backup-card__body {
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.backup-card__intro {
  margin: 0 0 var(--space-4);
  line-height: 1.55;
}

.backup-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.backup-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
}

.backup-stat--wide {
  grid-column: 1 / -1;
}

.backup-stat__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.backup-stat__value {
  font-size: 0.95rem;
  font-weight: 500;
  word-break: break-word;
}

.backup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.backup-form__row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.backup-auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.backup-interval-wrap {
  min-width: 160px;
  flex: 0 0 auto;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
}

.backup-card--help .backup-help-list {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  line-height: 1.55;
}

@media (max-width: 640px) {
  .backup-status-grid {
    grid-template-columns: 1fr;
  }

  .backup-actions .btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}

.backup-progress {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.backup-progress__meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
}

.backup-progress__bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.backup-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--emerald));
  transition: width 0.4s ease;
}

/* Dòng SP — mã con (Manager → Hệ thống) */
.pl-lines-table {
  table-layout: fixed;
}

.pl-lines-table th:nth-child(1) { width: 28%; }
.pl-lines-table th:nth-child(2) { width: 32%; }
.pl-lines-table th:nth-child(3) { width: 14%; }
.pl-lines-table th:nth-child(4) { width: 26%; }

.pl-main-row.is-expanded {
  background: rgba(6, 182, 212, 0.04);
}

.pl-main-row.is-expanded td {
  border-bottom-color: transparent;
}

.pl-name-cell {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.pl-name-meta {
  margin-top: 4px;
}

.pl-subcode-count {
  font-size: 0.72rem;
  font-weight: 500;
}

.pl-toggle-subcodes {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.pl-toggle-subcodes.is-open {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan-light);
}

.pl-toggle-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.pl-subcodes-row td {
  padding: 0 !important;
  background: rgba(6, 182, 212, 0.02);
  border-bottom: 1px solid var(--border);
}

.pl-subcodes-panel {
  margin: 0 var(--space-3) var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.18);
  background: var(--bg-card);
  box-shadow: inset 2px 0 0 var(--cyan);
}

.pl-subcodes-panel__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.pl-subcodes-panel__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
  flex-wrap: wrap;
}

.pl-subcodes-panel__head strong {
  font-size: 0.8125rem;
  color: var(--text-primary);
}

.pl-subcodes-panel__head > span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pl-subcodes-none {
  margin: 0;
  line-height: 1.4;
}

.pl-subcodes-editor {
  margin-bottom: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.04);
}

.pl-subcodes-editor-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pl-subcodes-inline-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 0;
}

.pl-inline-col-code { width: 96px; }
.pl-inline-col-actions { width: 44px; }

.pl-subcodes-inline-table thead th {
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: transparent;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.pl-subcodes-inline-table tbody td {
  padding: 4px 6px;
  vertical-align: middle;
}

.pl-subcodes-inline-table .form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  font-size: 0.8125rem;
  min-height: 32px;
}

.pl-subcode-entry-row__actions {
  text-align: center;
  width: 44px;
  padding-left: 0;
  padding-right: 0;
}

.pl-subcodes-editor__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pl-subcodes-editor__foot-actions {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}

.pl-subcodes-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex-shrink: 0;
}

.pl-subcode-modal-hint {
  margin: 0 0 var(--space-4);
}

.pl-subcode-modal-body .form-group + .form-group {
  margin-top: var(--space-4);
}

/* legacy grid layout — không dùng cho bảng inline */
.pl-subcode-entry-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding-right: 2px;
}

.pl-subcodes-inline-table tr.pl-subcode-entry-row {
  display: table-row;
}

.pl-subcode-entry-rows .pl-subcode-entry-row {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) minmax(120px, 1.2fr) minmax(120px, 1.2fr) 40px;
  gap: var(--space-3);
  align-items: end;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.pl-subcode-entry-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pl-subcode-entry-row .field {
  min-width: 0;
}

.pl-subcode-entry-row__actions {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 2px;
}

.pl-subcode-add-row {
  margin-top: var(--space-3);
}

@media (max-width: 640px) {
  .pl-subcode-entry-row {
    grid-template-columns: 1fr 1fr;
  }
  .pl-subcode-entry-row__actions {
    grid-column: 2;
    justify-content: flex-end;
  }
  .pl-subcode-entry-row .field:last-of-type {
    grid-column: 1 / -1;
  }
}

.pl-subcodes-panel__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.pl-subcodes-panel__title strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.pl-subcodes-panel__meta {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pl-subcodes-panel__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan-light);
  flex-shrink: 0;
}

.pl-subcodes-panel__icon svg {
  width: 18px;
  height: 18px;
}

.pl-subcodes-callout {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  line-height: 1.5;
}

.pl-subcodes-callout svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.7;
}

.pl-subcodes-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.pl-subcodes-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.8125rem;
  margin: 0;
}

.pl-subcodes-table thead th {
  padding: 6px 10px;
  font-size: 0.68rem;
  background: var(--bg-subtle);
}

.pl-subcodes-table tbody td {
  padding: 6px 10px;
  vertical-align: middle;
}

.pl-subcodes-table tbody tr:last-child td {
  border-bottom: none;
}

.pl-col-code { width: 96px; }
.pl-col-desc { width: auto; }
.pl-col-actions { width: 72px; }

.pl-subcodes-table td:last-child {
  text-align: right;
}

.pl-subcode-label {
  color: var(--text-primary);
  font-weight: 500;
}

.pl-subcode-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.pl-subcode-code {
  display: inline-block;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.14);
  color: var(--cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.25);
  letter-spacing: 0.02em;
}

.pl-subcode-code--inline {
  font-size: 0.75rem;
  padding: 1px 6px;
  vertical-align: baseline;
}

.pl-subcodes-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) var(--space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
}

.pl-subcodes-empty__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-3);
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan);
  opacity: 0.85;
}

.pl-subcodes-empty__icon svg {
  width: 22px;
  height: 22px;
}

.pl-subcodes-empty__title {
  margin: 0 0 var(--space-2);
  font-weight: 600;
  color: var(--text-secondary);
}

.pl-subcodes-empty__desc {
  margin: 0 0 var(--space-4);
  max-width: 360px;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 720px) {
  .pl-subcodes-panel {
    margin: 0 var(--space-2) var(--space-3);
    padding: var(--space-3);
  }

  .pl-subcodes-table-wrap {
    font-size: 0.8rem;
  }

  .pl-col-code { width: 72px; }
  .pl-col-actions { width: 72px; }
}

.sys-user-modal {
  max-width: 480px;
}

.sys-user-modal.modal-lg {
  max-width: 640px;
}

.sys-user-modal .modal-head {
  align-items: center;
  padding: var(--space-5) var(--space-6);
  background: var(--bg-card);
}

.sys-user-modal .modal-body {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sys-user-modal .modal-foot {
  padding: var(--space-4) var(--space-6) var(--space-5);
}

.sys-user-modal .form-group {
  margin-bottom: 0;
}

.sys-user-modal .form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sys-user-modal .form-label .required {
  color: var(--rose-light);
  font-weight: 700;
}

.sys-user-modal .form-input,
.sys-user-modal .form-textarea,
.sys-user-modal select.form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sys-user-modal .form-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.sys-user-modal .form-input:focus,
.sys-user-modal .form-textarea:focus,
.sys-user-modal select.form-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
  outline: none;
}

.sys-user-modal .form-hint {
  margin: 6px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.sys-user-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 640px) {
  .sys-user-form {
    grid-template-columns: 1fr;
  }
}

.sys-user-form__options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sys-user-form__options .checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
}

.sys-user-form__note {
  margin: var(--space-4) 0 0;
}

.sys-pos-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan-light);
  font-size: 0.8125rem;
  font-weight: 500;
}

.sys-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.sys-row-actions .btn-sm {
  padding: 6px 8px;
  min-width: 32px;
  justify-content: center;
}

.sys-row-actions .btn-icon-danger:hover:not(:disabled) {
  color: var(--danger, #f87171);
  background: rgba(248, 113, 113, 0.12);
}

.sys-pos-table td.text-right,
.table-scroll table td:last-child:has(.sys-row-actions) {
  text-align: right;
  white-space: nowrap;
}

.table-scroll table.sys-pos-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.period-toolbar__controls--split {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
  gap: 0;
}

.period-toolbar__cycle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 1;
  min-width: 0;
}

.period-toolbar__extra {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.period-toolbar__extra-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.period-toolbar__controls .wh-dept-filter {
  flex-shrink: 0;
  min-width: 160px;
  width: min(220px, 34vw);
}

/* Kho SP — workspace liền khối (legacy) */
.wh-workspace {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.wh-workspace__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: var(--space-4);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.wh-workspace__title {
  margin: 0;
}

.wh-workspace__sub {
  margin: 4px 0 0;
  max-width: 42rem;
}

.wh-dept-breakdown {
  width: 100%;
  margin: 0;
  padding: 0;
}

.wh-dept-card {
  width: 100%;
}

.wh-dept-card .table-header {
  padding: 12px 16px;
}

.wh-dept-name {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--cyan);
  cursor: pointer;
  text-align: left;
}

.wh-dept-name:hover {
  text-decoration: underline;
  color: var(--cyan-light, #06b6d4);
}

.wh-dept-row--empty td {
  color: var(--text-muted);
}

.wh-dept-row--empty .wh-dept-name {
  color: var(--text-muted);
  font-weight: 500;
}

.wh-dept-row--empty .wh-dept-name:hover {
  color: var(--cyan);
}

.wh-dept-filter {
  min-width: 220px;
  width: min(100%, 320px);
}

.wh-workspace__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wh-workspace .period-toolbar {
  margin-bottom: 0;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  gap: 12px;
}

.wh-workspace .period-toolbar__lead {
  flex: 1 1 200px;
  min-width: 0;
}

.wh-workspace .period-toolbar__controls {
  flex: 0 1 auto;
}

.wh-workspace__body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.wh-stats-grid {
  margin-bottom: 0;
}

/* Card con nổi lên trên nền surface tối của workspace */
.wh-workspace .stat-card {
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.wh-table-card {
  margin-bottom: 0;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.wh-table-card__filters {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.wh-table-card__header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.wh-table-card__header .table-title {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.wh-files-count {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--cyan);
  letter-spacing: 0.01em;
}

.wh-files-count--loading {
  color: var(--text-muted);
}

.wh-table-card__footer {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* Kho SP — dòng SP gọn (chip số, không biểu đồ) */
.wh-sublines-compact {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 0.82rem;
  overflow: visible;
}

.wh-sublines-compact__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  width: 100%;
}

.wh-sublines-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  width: 100%;
}

.wh-sublines-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.wh-chip-wrap.wh-chip--hidden {
  display: none;
}

.wh-sublines-chips.is-expanded .wh-chip-wrap.wh-chip--hidden {
  display: inline;
}

.wh-subline-more {
  align-self: flex-start;
  font-size: 0.78rem;
  padding-left: 0;
}

.wh-sublines-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 2px;
}

.wh-sublines-label svg {
  width: 14px;
  height: 14px;
}

.wh-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.wh-chip:hover {
  border-color: var(--cyan);
  color: var(--text-primary);
}

.wh-chip-active {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.12);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px var(--cyan);
}

.wh-filter-hint {
  margin-right: 10px;
  color: var(--text-muted);
}

.wh-filter-hint strong {
  color: var(--cyan);
}

.wh-subline-clear {
  margin-left: auto;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.wh-table-card .wh-sublines-compact {
  margin: 0;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.wh-chip b {
  color: var(--text-primary);
  font-weight: 700;
}

/* Tooltip tức thì (không dùng title — trình duyệt delay ~1s) */
.wh-tip {
  position: relative;
}

.wh-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 200;
  line-height: 1.3;
}

.wh-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 1px);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 201;
}

.wh-tip:hover::after,
.wh-tip:hover::before,
.wh-tip:focus-visible::after,
.wh-tip:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transition: none;
}

.wh-chip.wh-tip::after,
.wh-chip.wh-tip::before {
  transition: none;
}

.wh-subline-cell {
  display: inline-block;
}

.wh-tet-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  vertical-align: middle;
}


/* ── Info Cards ── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.info-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}

.info-item-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.info-item-value { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }

/* ── Dividers ── */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: var(--space-6) 0;
}

/* ── Department Grid ── */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.dept-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition);
  cursor: pointer;
}

.dept-card:hover, .dept-card.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), var(--shadow-glow-cyan);
}

.dept-card.selected { background: rgba(6, 182, 212, 0.08); }

.dept-card-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); margin-bottom: 4px; }
.dept-card-desc { font-size: 0.8rem; color: var(--text-muted); }

/* ── Two Column Layout ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }

/* ── File Upload ── */
.file-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
}

.file-upload-zone:hover, .file-upload-zone.dragover {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.05);
}

.file-upload-icon { font-size: 2rem; margin-bottom: var(--space-2); }
.file-upload-text { font-size: 0.875rem; color: var(--text-secondary); }
.file-upload-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Utilities ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-cyan { color: var(--cyan); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-rose { color: var(--rose-light); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8rem; }
.font-mono { font-family: monospace; }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.wrap { white-space: normal; word-break: break-word; }
.row { display: flex; align-items: center; gap: var(--space-2); }
.spacer { flex: 1; }
.mt { margin-top: var(--space-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-2-uneven { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); }

/* ── Spinner ── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  gap: var(--space-4);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  gap: var(--space-3);
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.empty-state-desc { font-size: 0.85rem; max-width: 300px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .charts-grid-3 { grid-template-columns: 1fr 1fr; }
  .modal-body-2col { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-main { padding: var(--space-4); }
  .charts-grid { grid-template-columns: 1fr; }
  .charts-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .tab-nav { gap: 2px; }
  .tab-btn { padding: 8px 12px; font-size: 0.8rem; }
  .three-col { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-container { padding: var(--space-4); }
  .login-card { padding: var(--space-5); }
  .three-col { grid-template-columns: 1fr; }
}

/* Custom Animated Smart Progress Bar */
.kpi-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
}

.kpi-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: var(--space-4);
}

.kpi-stat-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kpi-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--cyan);
  flex-shrink: 0;
}

.kpi-stat-icon i { width: 22px; height: 22px; }

.kpi-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.kpi-stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-stat-pct {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.kpi-stat-pct--over {
  color: var(--emerald);
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
}

/* Manager KPI panel — grid thẳng hàng, tách rõ tiêu đề / số liệu / bar */
.mgr-kpi-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.mgr-kpi-panel__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Admin — xét duyệt đề xuất KPI theo batch */
.kpi-review-modal__body {
  padding-top: var(--space-4);
}

.kpi-batch-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.kpi-batch-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  overflow: hidden;
}

.kpi-batch-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.kpi-batch-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.kpi-batch-card__title svg {
  width: 16px;
  height: 16px;
  color: var(--cyan);
}

.kpi-batch-card__sub {
  margin-top: 4px;
}

.kpi-batch-card__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.kpi-batch-card__body {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.kpi-batch-detail-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.855rem;
}

.kpi-batch-detail-table thead th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.kpi-batch-detail-table tbody td,
.kpi-batch-detail-table tfoot td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.kpi-batch-detail-table tbody tr:last-child td {
  border-bottom: none;
}

.kpi-batch-detail-table tfoot td {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

@media (max-width: 640px) {
  .kpi-batch-card__head {
    flex-direction: column;
  }

  .kpi-batch-card__actions {
    width: 100%;
  }

  .kpi-batch-card__actions .btn {
    flex: 1;
  }
}

.mgr-kpi-panel__month {
  flex-shrink: 0;
}

.mgr-kpi-panel__metrics {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
}

.mgr-kpi-panel .kpi-stat-info {
  min-width: 0;
}

.mgr-kpi-panel .kpi-stat-label {
  margin-bottom: 0;
  font-size: 0.88rem;
  line-height: 1.35;
}

.kpi-stat-ratio {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
  flex-wrap: nowrap;
}

.kpi-stat-ratio-hint {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-stat-ratio-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-progress-block {
  margin-bottom: 0;
  width: 100%;
}

@media (max-width: 640px) {
  .mgr-kpi-panel__top,
  .mgr-kpi-panel__metrics {
    flex-direction: column;
    align-items: stretch;
  }

  .mgr-kpi-panel__month {
    align-items: flex-start;
  }

  .mgr-kpi-panel .kpi-stat-pct {
    align-self: flex-start;
  }
}

.kpi-motivation {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: var(--space-4);
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  line-height: 1.55;
  border: 1px solid transparent;
}

.kpi-motivation i,
.kpi-motivation .kpi-motivation-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.kpi-motivation--good {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(34, 211, 238, 0.2);
  color: var(--cyan);
}

.kpi-motivation--exceed {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
  color: var(--emerald);
}

.kpi-progress-fill--over {
  background: linear-gradient(90deg, #10b981, #22d3ee, #06b6d4) !important;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.5) !important;
}

/* KPI inline trong bảng dòng SP — chữ trên, bar dưới */
.kpi-inline-track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.kpi-inline-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.kpi-inline-fraction {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.kpi-inline-bar {
  width: 100%;
  max-width: 140px;
  height: 8px;
}

.kpi-progress-wrapper {
  position: relative;
  height: 20px;
  background: rgba(15, 23, 42, 0.55);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.kpi-expected-marker {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.12);
  border-right: 2px solid rgba(255, 255, 255, 0.75);
  z-index: 5;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.kpi-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, #06b6d4, #22d3ee, #10b981);
  background-size: 200% 100%;
  animation: kpi-shimmer 2.5s linear infinite;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.45);
  position: relative;
  z-index: 2;
}

.kpi-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.22) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(255, 255, 255, 0.22) 75%,
    transparent 75%,
    transparent
  );
  background-size: 1.25rem 1.25rem;
  animation: progress-stripes 1s linear infinite;
}

/* Period filter toolbar (Quản lý + Admin) */
.period-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding: 10px var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.period-toolbar__lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.period-toolbar__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius);
  color: var(--cyan-light);
  background: rgba(8, 145, 178, 0.12);
}

.period-toolbar__icon svg {
  width: 18px;
  height: 18px;
}

.period-toolbar__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.period-toolbar__title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

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

.period-toolbar__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  flex-shrink: 1;
  min-width: 0;
  justify-content: flex-end;
  /* Token dùng chung — bo góc, font, chiều cao cho seg + picker */
  --pc-radius: var(--radius);
  --pc-font: var(--font-body);
  --pc-size: 0.875rem;
  --pc-weight: 500;
  --pc-height: 34px;
  --pc-pad-x: 14px;
  --pc-bg: var(--bg-elevated);
  --pc-border: 1px solid rgba(34, 211, 238, 0.35);
  --pc-border-hover: rgba(34, 211, 238, 0.65);
  --pc-focus-ring: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.period-toolbar--compact {
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: none;
  flex-shrink: 0;
}

.period-toolbar--compact .period-toolbar__controls {
  --pc-height: 34px;
  --pc-size: 0.8125rem;
  --pc-pad-x: 12px;
  gap: 8px;
}

.mgr-top-errors-header .period-toolbar--compact {
  margin-left: auto;
}

@media (max-width: 720px) {
  .mgr-top-errors-header .period-toolbar--compact {
    margin-left: 0;
    width: 100%;
  }
  .mgr-top-errors-header .period-toolbar--compact .period-toolbar__controls {
    width: 100%;
    justify-content: flex-end;
  }
  .mgr-top-errors-header .period-toolbar--compact .period-week-cluster {
    flex: 1;
    min-width: 0;
  }

  .mgr-top-errors-header .period-toolbar--compact .period-week-cluster__week {
    min-width: 0 !important;
    max-width: none;
  }
}

/* Segmented control: Tuần / Tháng / Quý / Năm */
.period-seg {
  display: inline-flex;
  padding: 3px;
  background: var(--pc-bg);
  border: var(--pc-border);
  border-radius: var(--pc-radius);
}

.period-seg__btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--pc-font);
  font-size: var(--pc-size);
  font-weight: var(--pc-weight);
  line-height: 1;
  height: calc(var(--pc-height) - 6px);
  padding: 0 var(--pc-pad-x);
  border-radius: calc(var(--pc-radius) - 3px);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.period-seg__btn:hover {
  color: var(--text-primary);
}

.period-seg__btn.active {
  color: #fff;
  font-weight: var(--pc-weight);
  background: var(--grad-primary);
  box-shadow: var(--shadow-sm);
}

/* Picker (đổi theo chu kỳ) */
.period-picker {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 1;
}

.period-picker__panel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.period-picker__panel.hidden {
  display: none;
}

.period-toolbar__controls .period-select,
.period-toolbar__controls select.period-select {
  width: auto !important;
  max-width: none;
  min-width: 0;
  height: var(--pc-height) !important;
  padding: 0 var(--pc-pad-x) !important;
  background: var(--pc-bg) !important;
  border: var(--pc-border) !important;
  border-radius: var(--pc-radius) !important;
  color: var(--text-primary) !important;
  font-family: var(--pc-font) !important;
  font-size: var(--pc-size) !important;
  font-weight: var(--pc-weight) !important;
  line-height: 1 !important;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.period-toolbar__controls .period-select:hover,
.period-toolbar__controls .period-select:focus {
  border-color: var(--pc-border-hover) !important;
  box-shadow: var(--pc-focus-ring) !important;
  outline: none;
}

.period-picker__panel:not(.period-picker__panel--week) .period-select {
  min-width: 124px;
}

.period-toolbar__controls .period-select-year {
  min-width: 84px;
}

/* Cụm chọn tuần: Năm + Tháng + Tuần — một khối liền mạch */
.period-week-cluster {
  display: inline-flex;
  align-items: stretch;
  flex-wrap: nowrap;
  height: var(--pc-height);
  max-width: 100%;
  background: var(--pc-bg);
  border: var(--pc-border);
  border-radius: var(--pc-radius);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.period-week-cluster:focus-within {
  border-color: var(--pc-border-hover);
  box-shadow: var(--pc-focus-ring);
}

.period-week-cluster select {
  width: auto !important;
  height: 100% !important;
  min-height: 0;
  margin: 0 !important;
  padding: 0 28px 0 12px !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background-color: transparent !important;
  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%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 12px !important;
  font-family: var(--pc-font) !important;
  font-size: var(--pc-size) !important;
  font-weight: var(--pc-weight) !important;
  line-height: 1.2 !important;
  color: var(--text-primary) !important;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.period-week-cluster select:hover,
.period-week-cluster select:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  background-color: rgba(6, 182, 212, 0.06) !important;
}

.period-toolbar__controls .period-week-cluster__year:hover,
.period-toolbar__controls .period-week-cluster__month:hover,
.period-toolbar__controls .period-week-cluster__week:hover,
.period-toolbar__controls .period-week-cluster__year:focus,
.period-toolbar__controls .period-week-cluster__month:focus,
.period-toolbar__controls .period-week-cluster__week:focus {
  border-color: transparent !important;
  box-shadow: none !important;
}

.period-week-cluster select + select {
  border-left: 1px solid rgba(34, 211, 238, 0.22) !important;
}

.period-week-cluster__year {
  min-width: 72px !important;
  max-width: 80px;
  flex: 0 0 auto;
  text-align: center;
  padding-left: 10px !important;
}

.period-week-cluster__month {
  min-width: 96px !important;
  max-width: 108px;
  flex: 0 0 auto;
}

.period-week-cluster__week {
  min-width: 168px !important;
  max-width: 220px;
  flex: 1 1 auto;
}

.period-picker__panel--week {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 1;
}

.period-seg {
  flex-shrink: 0;
}

.period-toolbar--compact .period-week-cluster__week {
  min-width: 150px !important;
  max-width: 190px;
}

.period-toolbar--compact .period-week-cluster__month {
  min-width: 88px !important;
  max-width: 100px;
}

.period-toolbar__controls .month-picker-wrap .month-picker-icon {
  left: var(--pc-pad-x);
  width: 15px;
  height: 15px;
}

.period-toolbar__controls .month-picker-input,
.period-toolbar__controls input.month-picker-input {
  min-width: 200px !important;
  height: var(--pc-height) !important;
  padding: 0 var(--pc-pad-x) 0 calc(var(--pc-pad-x) + 22px) !important;
  background: var(--pc-bg) !important;
  border: var(--pc-border) !important;
  border-radius: var(--pc-radius) !important;
  color: var(--text-primary) !important;
  font-family: var(--pc-font) !important;
  font-size: var(--pc-size) !important;
  font-weight: var(--pc-weight) !important;
  line-height: 1 !important;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.period-toolbar__controls .month-picker-input:hover,
.period-toolbar__controls .month-picker-input:focus {
  border-color: var(--pc-border-hover) !important;
  box-shadow: var(--pc-focus-ring) !important;
  outline: none;
}

@media (max-width: 900px) {
  .period-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .period-toolbar__controls {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    row-gap: 10px;
  }

  .period-toolbar__controls--split {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .period-toolbar__extra {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-top: 10px;
    width: 100%;
  }

  .period-toolbar__controls .wh-dept-filter {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .period-week-cluster {
    width: 100%;
    max-width: 100%;
  }

  .period-week-cluster__week {
    flex: 1 1 140px;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .period-toolbar {
    align-items: stretch;
  }

  .period-toolbar__controls {
    flex-direction: column;
    align-items: stretch;
  }

  .period-seg {
    width: 100%;
    justify-content: stretch;
  }

  .period-seg__btn {
    flex: 1;
    text-align: center;
  }

  .period-picker,
  .period-picker__panel,
  .period-picker__panel--week {
    width: 100%;
  }

  .period-week-cluster {
    width: 100%;
  }

  .period-week-cluster__year {
    max-width: 72px;
  }

  .period-week-cluster__month {
    max-width: 104px;
  }

  .period-week-cluster__week {
    min-width: 0 !important;
  }

  .period-toolbar__controls .month-picker-wrap,
  .period-toolbar__controls .month-picker-input {
    width: 100% !important;
    min-width: 0 !important;
  }
}

.dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.month-filter-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.month-filter-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.month-picker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.month-picker-wrap .month-picker-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--cyan);
  pointer-events: none;
  z-index: 2;
}

.month-picker-input,
input.month-picker-input {
  min-width: 210px !important;
  padding: 10px 14px 10px 38px !important;
  background: var(--bg-elevated) !important;
  border: 1px solid rgba(34, 211, 238, 0.35) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.month-picker-input:hover,
.month-picker-input:focus {
  border-color: rgba(34, 211, 238, 0.65) !important;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15) !important;
  outline: none;
}

/* NAS folder links */
.nas-links-box {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 100%;
  overflow: hidden;
}

/* Bảng phiên báo cáo (accordion dòng SP) */
.batch-sessions-wrap {
  border-radius: var(--radius-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  background: var(--bg-card);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.batch-sessions-wrap::-webkit-scrollbar {
  height: 6px;
}

.batch-sessions-wrap::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.batch-sessions-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 720px;
}

.batch-sessions-table--cols-5 { min-width: 600px; }
.batch-sessions-table--cols-6 { min-width: 680px; }
.batch-sessions-table--cols-7 { min-width: 820px; }

.batch-sessions-table th,
.batch-sessions-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.batch-sessions-table th:nth-child(2),
.batch-sessions-table td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
}

.batch-sessions-table thead {
  background: rgba(255, 255, 255, 0.02);
}

.batch-sessions-table th {
  font-size: 0.78rem;
  padding: 10px 12px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.batch-sessions-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.batch-sessions-table .batch-header {
  background: var(--bg-elevated);
  cursor: pointer;
}

.batch-product-row td {
  background: rgba(15, 23, 42, 0.35);
  vertical-align: top;
}

.batch-product-class {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  white-space: nowrap;
}

.batch-product-actions {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.std-import-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.std-extract-btn {
  margin-top: 10px;
}

.std-sheet-preview {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.35);
}

.std-sheet-preview.hidden {
  display: none !important;
}

.std-preview-head {
  margin-bottom: 12px;
}

.std-preview-title {
  margin: 0 0 6px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.std-preview-title > span,
.std-modal-title > span {
  white-space: normal;
  line-height: 1.4;
}

.std-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.std-pending-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.std-pending-notice i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.std-preview-head h4 {
  margin: 0 0 6px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.std-preview-category {
  margin: 0;
}

.std-preview-table-wrap {
  max-height: 320px;
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.std-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.std-preview-table th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.std-preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

.std-preview-table tbody tr:last-child td {
  border-bottom: none;
}

#std-sheet-import:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.batch-product-cell {
  padding-left: 28px !important;
}

.batch-product-nas-cell {
  text-align: left;
  white-space: nowrap;
}

.batch-product-filler {
  color: var(--text-muted);
}

.batch-product-code-link {
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
  display: inline-block;
}

.batch-product-code-link:hover {
  color: var(--cyan);
}

.nas-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cyan);
  text-decoration: none;
  white-space: nowrap;
}

.nas-quick-link-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nas-quick-link:hover {
  color: #67e8f9;
}

.nas-quick-link:hover .nas-quick-link-icon {
  opacity: 1;
}

.nas-quick-link--empty {
  font-weight: 400;
  pointer-events: none;
}

.product-nas-detail {
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
}

.product-nas-detail .nas-link-url {
  word-break: normal;
  white-space: nowrap;
  overflow-x: auto;
  display: block;
  max-width: 100%;
}

.batch-product-quality {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.batch-product-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.batch-sessions-table .session-datetime {
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Thu hẹp màn hình: bảng phiên → dạng card */
@media (max-width: 900px) {
  .batch-sessions-wrap.batch-sessions-responsive {
    overflow: visible;
    border: none;
    background: transparent;
  }

  .batch-sessions-table.batch-sessions-table--responsive {
    display: block;
    min-width: 0;
    table-layout: auto;
  }

  .batch-sessions-table.batch-sessions-table--responsive thead {
    display: none;
  }

  .batch-sessions-table.batch-sessions-table--responsive tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .batch-sessions-table.batch-sessions-table--responsive tr.batch-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  }

  .batch-sessions-table.batch-sessions-table--responsive tr.batch-header td {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    border: none;
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
  }

  .batch-sessions-table.batch-sessions-table--responsive tr.batch-header td::before {
    content: attr(data-label);
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .batch-sessions-table.batch-sessions-table--responsive tr.batch-header td:first-child {
    grid-column: 1 / -1;
    padding-bottom: 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border);
  }

  .batch-sessions-table.batch-sessions-table--responsive tr.batch-header td:first-child::before {
    display: none;
  }

  .batch-sessions-table.batch-sessions-table--responsive tr.batch-header .session-datetime {
    font-size: 0.95rem;
  }

  .batch-sessions-table.batch-sessions-table--responsive tr.batch-product-row,
  .batch-sessions-table.batch-sessions-table--responsive tr.batch-product-loading,
  .batch-sessions-table.batch-sessions-table--responsive tr.batch-product-empty {
    display: block;
    margin: -4px 0 0 10px;
    padding: 12px 14px;
    border-left: 2px solid rgba(6, 182, 212, 0.35);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: rgba(15, 23, 42, 0.35);
  }

  .batch-sessions-table.batch-sessions-table--responsive tr.batch-product-row td,
  .batch-sessions-table.batch-sessions-table--responsive tr.batch-product-loading td,
  .batch-sessions-table.batch-sessions-table--responsive tr.batch-product-empty td {
    display: block;
    border: none;
    padding: 4px 0;
    overflow: visible;
    white-space: normal;
  }

  .batch-sessions-table.batch-sessions-table--responsive .batch-product-actions {
    justify-content: flex-start;
    margin-top: 6px;
  }
}

.nas-link-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.nas-link-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.nas-link-label {
  width: 68px;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.nas-link-url {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
  text-decoration: none;
  line-height: 1.45;
}

.nas-link-url:hover {
  text-decoration: underline;
  color: var(--cyan-light, #67e8f9);
}

.month-picker-wrap .flatpickr-input {
  padding-left: 38px !important;
}

.month-picker-wrap > input.flatpickr-month[readonly]:not(.flatpickr-input) {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.nas-cell {
  margin-top: 6px;
}

.nas-link-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  max-width: 100%;
}

.nas-link-inline a {
  color: var(--cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.nas-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.nas-edit-btn:hover { color: var(--text-primary); background: var(--bg-overlay); }
.nas-edit-btn svg { width: 12px; height: 12px; }

.nas-preview-box {
  margin-top: 10px;
  min-height: 24px;
}

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

@keyframes progress-stripes {
  from { background-position: 1.5rem 0; }
  to { background-position: 0 0; }
}

/* ══════════════════════════════════════════
   Notification Dropdown
══════════════════════════════════════════ */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 24px);

  /* Màu nền đặc hoàn toàn - light mode */
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}

[data-theme="dark"] .notif-dropdown {
  /* Màu nền đặc hoàn toàn - dark mode */
  background: #1a1f32;
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.notif-dropdown.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0s;
}

.notif-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  flex-shrink: 0;
}

[data-theme="dark"] .notif-dropdown-header {
  background: #141828;
  border-bottom-color: rgba(148, 163, 184, 0.08);
}

.notif-dropdown-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.notif-dropdown-body {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  background: #ffffff;
}

[data-theme="dark"] .notif-dropdown-body {
  background: #1a1f32;
}

/* Individual notification item */
.notif-dropdown-body .notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  transition: background 0.15s;
  cursor: default;
}

[data-theme="dark"] .notif-dropdown-body .notif-item {
  border-bottom-color: rgba(255, 255, 255, 0.04);
}

.notif-dropdown-body .notif-item:last-child {
  border-bottom: none;
}

.notif-dropdown-body .notif-item:hover {
  background: #f1f5f9;
}

[data-theme="dark"] .notif-dropdown-body .notif-item:hover {
  background: #1e2438;
}

.notif-dropdown-body .notif-item.unread {
  border-left: 3px solid var(--cyan);
  background: rgba(8, 145, 178, 0.05);
}

[data-theme="dark"] .notif-dropdown-body .notif-item.unread {
  background: rgba(6, 182, 212, 0.06);
}

.notif-dropdown-body .notif-item.read {
  border-left: 3px solid transparent;
}

.notif-dropdown-body .notif-content {
  flex: 1;
  min-width: 0;
}

.notif-dropdown-body .notif-content p {
  margin: 0 0 4px 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-primary);
  word-break: break-word;
}

.notif-dropdown-body .notif-item.read .notif-content p {
  color: var(--text-secondary);
  opacity: 0.8;
}

.notif-dropdown-body .notif-time {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Clickable QC-request notification */
.notif-dropdown-body .notif-clickable {
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.notif-dropdown-body .notif-clickable:hover {
  background: rgba(6, 182, 212, 0.08) !important;
  transform: translateX(2px);
}

[data-theme="dark"] .notif-dropdown-body .notif-clickable:hover {
  background: rgba(6, 182, 212, 0.1) !important;
}

/* Standards manager — Bộ phận → Dòng SP */
.std-manager-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.std-manager-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 16px;
  align-items: start;
}

.std-tree-sidebar {
  padding: 12px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  position: sticky;
  top: 88px;
}

.std-dept-block + .std-dept-block {
  margin-top: 8px;
}

.std-dept-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.std-dept-head:hover {
  border-color: rgba(6, 182, 212, 0.35);
}

.std-dept-icon {
  width: 16px;
  height: 16px;
  color: var(--cyan);
  flex-shrink: 0;
}

.std-dept-name {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
}

.std-dept-count {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.std-dept-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.std-dept-block.is-open .std-dept-chevron {
  transform: rotate(180deg);
}

.std-pl-list {
  margin-top: 6px;
  padding-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.std-pl-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.std-pl-item:hover {
  background: rgba(6, 182, 212, 0.06);
}

.std-pl-item.active {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
}

.std-pl-item-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.std-pl-item-meta {
  flex-shrink: 0;
}

.std-pl-empty {
  padding: 8px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.std-pl-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--cyan);
  font-size: 0.8rem;
  cursor: pointer;
}

.std-detail-panel {
  min-width: 0;
}

.std-detail-header {
  margin-bottom: 16px;
}

.std-detail-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.std-pl-edit-form {
  margin-top: 10px;
}

.std-edit-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.std-sheet-view__url {
  word-break: break-all;
  margin-top: 8px;
}

.std-import-panel--advanced {
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow: hidden;
}

.std-import-panel--advanced > summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
}

.std-import-panel--advanced > summary::-webkit-details-marker {
  display: none;
}

.std-import-panel--advanced > summary h3 {
  margin: 0;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.std-import-panel--advanced[open] > summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.std-import-panel--advanced[open] {
  padding: 0 18px 18px;
}

.std-import-panel--advanced:not([open]) {
  padding: 0;
}

.std-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  margin-bottom: 4px;
}

.std-breadcrumb i {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.std-active-card {
  padding: 16px 18px;
  margin-bottom: 16px;
}

.std-active-card__head h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.std-active-card__body {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.std-import-panel {
  padding: 20px 22px;
  margin-bottom: 16px;
}

.std-panel-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.std-panel-desc {
  margin: 0 0 20px;
  line-height: 1.55;
}

.std-import-form {
  gap: 18px;
}

.field-hint {
  margin: 8px 0 0;
  line-height: 1.45;
}

.modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 12px;
}

.std-modal-subtitle {
  margin: 0;
  line-height: 1.45;
}

.std-sheet-modal-banner {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}

.std-sheet-modal-banner .std-sheet-link {
  margin-bottom: 12px;
}

.std-sheet-modal-caption {
  margin: 0;
  line-height: 1.5;
}

.std-detail-header p.text-muted {
  margin: 8px 0 0;
  line-height: 1.5;
}

.mb { margin-bottom: 12px; }

.std-criteria-list {
  max-height: 55vh;
  overflow-y: auto;
}

.std-sheet-panel {
  padding: 16px 18px;
  margin-bottom: 16px;
}

.std-sheet-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.std-sheet-form .input {
  flex: 1;
  min-width: 240px;
}

.std-sheet-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.std-sheet-link:hover {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.4);
}

.std-sheet-link i {
  width: 16px;
  height: 16px;
}

.std-sheet-link--compact {
  padding: 6px 10px;
  font-size: 0.8rem;
}

/* Thanh tóm tắt tiêu chuẩn (form tạo phiên Manager) */
.std-info-slot {
  margin-top: 4px;
}

.std-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(6, 182, 212, 0.04) 100%);
  border: 1px solid rgba(16, 185, 129, 0.18);
}

.std-summary-bar__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.std-summary-bar__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: var(--emerald-light);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.std-summary-bar__count {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 500;
}

.std-summary-bar__count::before {
  content: "·";
  margin-right: 8px;
  color: var(--text-muted);
}

.std-summary-bar__action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.std-summary-bar__action:hover {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.4);
  transform: none;
}

.std-summary-bar__action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.15);
}

.std-summary-bar__action-icon i,
.std-summary-bar__action-arrow {
  width: 14px;
  height: 14px;
}

.std-sheet-checklist-banner {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.std-criterion-block {
  width: 100%;
}

.std-criterion-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.std-criterion-code {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.std-criterion-weight {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.std-criterion-fail {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 4px;
}

.std-criterion-label {
  font-weight: 600;
  color: var(--rose-light);
}

.std-criterion-fail-inline {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.35;
}

.std-criterion-item {
  align-items: flex-start;
}

@media (max-width: 900px) {
  .std-manager-layout {
    grid-template-columns: 1fr;
  }

  .std-tree-sidebar {
    position: static;
    max-height: 320px;
  }
}

/* ═══════════════════════════════════════════════════════════
   Mobile — touch-first layout (≤768px / ≤480px)
═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: hidden;
  }

  .navbar,
  .app-topbar {
    height: auto;
    min-height: 52px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    gap: 8px;
  }

  .navbar-left,
  .navbar-right {
    gap: 8px;
  }

  .brand-sub {
    display: none;
  }

  .brand-name {
    font-size: 1rem;
  }

  .topbar-title {
    font-size: 0.98rem;
  }

  .topbar-sub {
    display: none;
  }

  .user-details,
  .user-chevron {
    display: none;
  }

  .user-info {
    padding: 4px;
    border-radius: var(--radius-full);
  }

  .btn-icon {
    width: 40px;
    height: 40px;
  }

  .notif-dropdown {
    position: fixed;
    top: calc(52px + env(safe-area-inset-top, 0px));
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform-origin: top center;
  }

  .app-main {
    padding: var(--space-4) 12px calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  }

  .page-title {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  .page-sub,
  .page-subtitle {
    font-size: 0.82rem;
    margin-bottom: var(--space-4);
  }

  .tab-nav {
    display: flex;
    gap: 6px;
    padding: 6px;
    margin-bottom: var(--space-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 1 0 auto;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.8rem;
    scroll-snap-align: start;
    touch-action: manipulation;
  }

  .tab-btn svg {
    width: 16px;
    height: 16px;
  }

  .two-col,
  .three-col {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .charts-grid,
  .charts-grid-3 {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .page-header .btn,
  .page-header .btn-group {
    width: 100%;
    justify-content: center;
  }

  .table-card {
    padding: var(--space-4) !important;
  }

  .std-summary-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  .std-summary-bar__action {
    justify-content: center;
    width: 100%;
  }

  .product-action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .product-action-bar-spacer {
    display: none;
  }

  .product-action-bar .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .product-action-bar #nb-submit {
    order: -1;
  }

  #tab-new {
    padding-bottom: 0;
  }

  #tab-new .product-action-bar--footer {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: var(--space-3) var(--space-3);
  }

  .checklist-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }

  .checklist-verdict {
    align-items: stretch;
    min-width: 0;
    width: 100%;
  }

  .verdict-state {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
  }

  .verdict-btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.82rem;
    touch-action: manipulation;
  }

  .verdict-badge {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .product-card-head--compact {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px;
  }

  .product-card-head--compact .product-card-code-input {
    flex: 0 1 108px;
    width: 108px;
    min-width: 72px;
  }

  .product-card-compact-meta-text {
    font-size: 0.72rem;
  }

  .product-card-head--compact .product-card-submit span {
    display: none;
  }

  .product-card-head--compact .product-card-submit {
    width: 40px;
    padding: 0 !important;
  }

  .product-card-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .product-card-head-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal,
  .modal-lg,
  .modal-xl {
    max-width: 100%;
    max-height: 92dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    margin: 0;
  }

  .modal-body,
  .modal-header,
  .modal-head,
  .modal-footer,
  .modal-foot {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .modal-footer,
  .modal-foot {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer .btn,
  .modal-foot .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .login-container {
    padding: var(--space-4);
    padding-top: calc(var(--space-6) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  }

  .login-demo-btns {
    flex-direction: column;
  }

  .login-demo-btns .btn-demo,
  .login-demo-btns .btn-demo-manager {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .accounts-grid {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr 1fr;
  }

  .score-live-panel {
    margin-top: 0;
  }

  .kpi-stat-card {
    padding: var(--space-4);
  }

  .dept-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar,
  .reports-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-bar .form-group,
  .reports-toolbar .form-group {
    width: 100%;
  }

  .filter-bar .btn,
  .reports-toolbar .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .dashboard-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .month-filter-group {
    align-items: stretch;
    width: 100%;
  }

  .month-picker-wrap,
  .month-picker-input {
    width: 100%;
  }

  .table-wrapper,
  .table-scroll {
    -webkit-overflow-scrolling: touch;
  }

  .table-wrapper table {
    min-width: 560px;
  }

  .chart-container {
    height: 200px;
  }
}

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

  .tab-btn {
    padding: 10px 12px;
    font-size: 0.76rem;
  }

  .login-card {
    padding: var(--space-5);
  }

  .login-title {
    font-size: 1.6rem;
  }

  .product-card-compact-meta-text .product-card-status--ok {
    display: none;
  }

  .product-card-compact-meta-text .product-card-status--muted::before {
    content: none;
  }

  .navbar-brand > div {
    display: none;
  }

  .logo-icon-sm {
    font-size: 1.6rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .std-summary-bar__count::before {
    display: none;
  }

  .std-summary-bar__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ── Form grid (standards / modals) ── */
.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

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

/* ── Bo góc thống nhất — inputs trong panel luôn rounded ── */
.glass-panel .input,
.glass-panel .form-input,
.glass-panel .form-select,
.glass-panel .select,
.glass-panel .form-textarea,
.glass-panel textarea,
.std-detail-panel .input,
.std-detail-panel .select,
.std-detail-panel .form-textarea,
.std-detail-panel textarea,
.table-card .input,
.table-card .select {
  border-radius: var(--radius) !important;
}

.std-pl-add {
  border-radius: var(--radius-sm);
}

.std-pl-empty {
  border-radius: var(--radius-sm);
}

.login-card.glass-panel {
  border-radius: var(--radius-xl);
}

.server-offline-card.glass-panel {
  border-radius: var(--radius-xl);
}

/* =========================================================================== */
/* Tab Lịch sản xuất — refined ops calendar                                     */
/* =========================================================================== */

.sched-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-variant-numeric: tabular-nums;
  width: 100%;
  max-width: none;
}

/* Full khung khi tab Lịch sản xuất đang mở */
.app-main:has(#tab-schedule.active) {
  max-width: none;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}
.app-main:has(#tab-schedule.active) .sched-header,
.app-main:has(#tab-schedule.active) .sched-calendar-wrap,
.app-main:has(#tab-schedule.active) .sched-overview,
.app-main:has(#tab-schedule.active) .sched-month-details {
  border-radius: var(--radius-lg);
}
.app-main:has(#tab-schedule.active) .sched-calendar-wrap {
  padding: var(--space-3) var(--space-4);
}

/* Header + KPI strip + tổng theo vị trí (một khung) */
.sched-header {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
}
.sched-header__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.sched-header__actions { display: flex; align-items: center; gap: var(--space-2); }
.sched-monthnav { display: flex; align-items: center; gap: 6px; }
.sched-month-input,
.sched-monthnav #sched-month { width: 156px; text-align: center; font-weight: 600; }
.sched-nav-btn {
  border-radius: var(--radius);
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.sched-nav-btn:active { transform: scale(0.96); }
.sched-dept { min-width: 168px; }

.sched-stats:empty { display: none; }

/* Dashboard tổng hợp — KPI + 3 bảng + định mức */
.sched-dash:empty { display: none; }
.sched-dash__kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.sched-dash-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.sched-dash-kpi__val {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.sched-dash-kpi__sep {
  margin: 0 2px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.82em;
}
.sched-dash-kpi__lbl {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.sched-dash-kpi--cyan {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.25);
}
.sched-dash-kpi--cyan .sched-dash-kpi__val { color: var(--cyan-light); }
.sched-dash-kpi--progress.is-behind .sched-dash-kpi__val { color: var(--amber-light); }
.sched-dash-kpi--progress.is-ahead .sched-dash-kpi__val { color: var(--emerald-light); }
.sched-dash-kpi--shoot .sched-dash-kpi__val { color: var(--indigo-light); }
.sched-dash-kpi--post .sched-dash-kpi__val { color: var(--amber-light); }
.sched-dash-kpi__progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.sched-dash-kpi__bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-overlay);
  overflow: hidden;
}
.sched-dash-kpi__bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--emerald);
  transition: width 0.4s ease;
}
.sched-dash-kpi--progress.is-behind .sched-dash-kpi__bar i { background: var(--amber); }

.sched-dash__panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(208px, 1fr));
  gap: var(--space-3);
}
.sched-dash-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: hidden;
}
.sched-dash-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-overlay);
}
.sched-dash-panel__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.sched-dash-panel--shoot .sched-dash-panel__dot { background: var(--indigo-light); box-shadow: 0 0 8px rgba(129, 140, 248, 0.5); }
.sched-dash-panel--post .sched-dash-panel__dot { background: var(--amber-light); box-shadow: 0 0 8px rgba(251, 191, 36, 0.45); }
.sched-dash-panel--lines .sched-dash-panel__dot { background: var(--emerald-light); box-shadow: 0 0 8px rgba(52, 211, 153, 0.45); }
.sched-dash-panel--quota .sched-dash-panel__dot { background: var(--cyan-light); box-shadow: 0 0 8px rgba(6, 182, 212, 0.45); }
.sched-dash-panel__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.sched-dash-panel--shoot .sched-dash-panel__title { color: var(--indigo-light); }
.sched-dash-panel--post .sched-dash-panel__title { color: var(--amber-light); }
.sched-dash-panel--lines .sched-dash-panel__title { color: var(--emerald-light); }
.sched-dash-panel--quota .sched-dash-panel__title { color: var(--cyan-light); }
.sched-dash-panel__body {
  flex: 1;
  overflow-x: auto;
  padding: 0;
}

.sched-dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: auto;
}
.sched-dash-table thead th {
  padding: 6px 10px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: right;
  background: transparent;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  width: 52px;
}
.sched-dash-table thead th:first-child { text-align: left; width: auto; }
.sched-dash-table tbody td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.sched-dash-table tbody tr:last-child td { border-bottom: none; }
.sched-dash-table tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
[data-theme="light"] .sched-dash-table tbody tr:hover td { background: rgba(0, 0, 0, 0.02); }
.sched-dash-table__name {
  font-weight: 700;
  color: var(--text-primary);
  text-align: left;
  width: 100%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sched-dash-table__num {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
  width: 52px;
}
.sched-dash-table__num--tt {
  color: var(--emerald-light);
  font-weight: 800;
}
.sched-dash-table tfoot td {
  padding: 7px 10px;
  border-top: 2px solid var(--border-hover);
  background: var(--bg-overlay);
}
.sched-dash-table__sum-lbl {
  font-weight: 800;
  font-size: 0.72rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.sched-dash-table tfoot .sched-dash-table__num {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
}
.sched-dash-table tfoot .sched-dash-table__num--tt { color: var(--emerald-light); }
.sched-dash-table__empty {
  text-align: center !important;
  color: var(--text-muted);
  padding: 16px 10px !important;
  font-size: 0.72rem;
}

.sched-dash-quota__tt {
  color: var(--rose-light, #fb7185);
  font-weight: 700;
}
.sched-dash-quota__avg {
  color: var(--emerald-light);
  font-weight: 800;
}

/* Legacy stat chips — giữ tương thích */
.sched-stats__compact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2) var(--space-3);
  align-items: start;
}
.sched-stats__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: stretch;
}
.sched-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  min-width: 0;
}
.sched-chip__lbl {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.sched-chip__val {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}
.sched-chip--cyan {
  background: rgba(6, 182, 212, 0.12);
}
.sched-chip--cyan .sched-chip__val { color: var(--cyan-light); }
.sched-chip--progress.is-behind .sched-chip__val { color: var(--amber-light); }
.sched-chip--progress.is-ahead .sched-chip__val { color: var(--emerald-light); }
.sched-chip--shoot .sched-chip__val { color: var(--indigo-light); }
.sched-chip--post .sched-chip__val { color: var(--amber-light); }

.sched-quota-table {
  border-collapse: collapse;
  font-size: 0.72rem;
  min-width: 200px;
}
.sched-quota-table th,
.sched-quota-table td {
  padding: 3px 8px;
  text-align: right;
  border: 1px solid var(--border-hover);
}
.sched-quota-table thead th {
  font-size: 0.62rem;
  font-weight: 800;
  background: var(--bg-overlay);
  color: var(--text-muted);
}
.sched-quota-th-name,
.sched-quota-name {
  text-align: left;
  font-weight: 700;
  color: var(--text-primary);
}
.sched-quota-th-tt,
.sched-quota-tt {
  background: rgba(244, 63, 94, 0.08);
  color: var(--text-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sched-quota-th-avg,
.sched-quota-avg {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-light);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sched-quota-empty {
  text-align: center !important;
  color: var(--text-muted);
  padding: 8px !important;
}

/* Legacy stat cards — giữ cho tương thích */
.sched-stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.sched-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid transparent;
  transition: border-color var(--transition-fast);
}
.sched-stat:hover { border-color: var(--border); }
.sched-stat__label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.sched-stat__value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.sched-stat__sub { font-size: 0.7rem; color: var(--text-muted); }
.sched-stat--progress .sched-stat__progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.sched-stat__ring {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.sched-stat__ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sched-stat__ring-bg {
  fill: none;
  stroke: var(--bg-overlay);
  stroke-width: 3;
}
.sched-stat__ring-fill {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}
.sched-stat.is-behind .sched-stat__ring-fill { stroke: var(--amber); }
.sched-stat.is-ahead .sched-stat__ring-fill { stroke: var(--emerald); }
.sched-stat__ring span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
}
.sched-stats__pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
}
.sched-pipe {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.sched-pipe i { width: 13px; height: 13px; opacity: 0.85; }
.sched-pipe--shoot { border-color: rgba(99, 102, 241, 0.25); color: var(--indigo-light); }
.sched-pipe--post { border-color: rgba(245, 158, 11, 0.28); color: var(--amber-light); }

/* Admin overview */
.sched-overview {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-xl);
}
.sched-overview:empty { display: none; }
.sched-overview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.sched-overview__head .section-title { margin: 0; font-size: 0.95rem; }
.sched-overview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-2);
}
.sched-ov-card {
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  cursor: pointer;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.sched-ov-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.sched-ov-card:active { transform: scale(0.99); }
.sched-ov-card.active {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.15);
}
.sched-ov-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sched-ov-card__name { font-weight: 600; font-size: 0.88rem; color: var(--text-primary); }
.sched-ov-card__pct { font-weight: 700; font-family: var(--font-display); font-size: 0.95rem; }
.sched-ov-card__pct.is-ahead { color: var(--emerald-light); }
.sched-ov-card__pct.is-mid { color: var(--amber-light); }
.sched-ov-card__pct.is-behind { color: var(--rose-light); }
.sched-ov-card__bar { height: 4px; background: var(--bg-overlay); border-radius: var(--radius-full); overflow: hidden; margin-bottom: 6px; }
.sched-ov-card__fill { height: 100%; border-radius: var(--radius-full); transition: width 0.4s ease; }
.sched-ov-card__fill.is-ahead { background: var(--emerald); }
.sched-ov-card__fill.is-mid { background: var(--amber); }
.sched-ov-card__fill.is-behind { background: var(--rose); }
.sched-ov-card__meta { font-size: 0.72rem; }

/* Roster */
.sched-roster {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
}
.sched-roster__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.sched-roster__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
}
.sched-roster__title i { width: 16px; height: 16px; color: var(--cyan-light); }
.sched-roster__count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
}
.sched-roster__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  justify-content: space-between;
}
.sched-roster__chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 180px; }
.sched-roster__empty { font-size: 0.82rem; color: var(--text-muted); }
.sched-roster-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  transition: border-color var(--transition-fast);
}
.sched-roster-chip:hover { border-color: var(--border-hover); }
.sched-roster-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-display);
  background: var(--grad-primary);
  color: #fff;
  flex-shrink: 0;
}
.sched-roster-chip__text { line-height: 1.2; }
.sched-roster-rm {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  border-radius: var(--radius-full);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.sched-roster-rm i { width: 14px; height: 14px; }
.sched-roster-rm:hover { color: var(--rose-light); background: rgba(244, 63, 94, 0.1); }
.sched-roster__add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sched-roster__select { min-width: 148px; font-size: 0.85rem; }
.sched-roster__select--sm { min-width: 112px; }

/* Calendar */
.sched-calendar-wrap {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xl);
  min-height: 440px;
}
.sched-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 6px;
  padding: 0;
}
.sched-cal-head {
  display: none;
}
.sched-cal-title {
  display: none;
}
.sched-cal-legend {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.sched-legend {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.sched-legend:hover { opacity: 0.92; }
.sched-legend--shoot {
  color: var(--indigo-light);
  background: rgba(99, 102, 241, 0.16);
}
.sched-legend--post {
  color: var(--amber-light);
  background: rgba(245, 158, 11, 0.16);
}
.sched-legend:not(.is-on) {
  opacity: 0.32;
  filter: grayscale(0.4);
}
.sched-legend.is-solo {
  opacity: 1;
  filter: none;
}
.sched-legend--shoot.is-solo { background: rgba(99, 102, 241, 0.28); }
.sched-legend--post.is-solo { background: rgba(245, 158, 11, 0.28); }

.sched-cal-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-lg);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
}
.sched-cal-hint i { width: 16px; height: 16px; color: var(--cyan-light); flex-shrink: 0; }

/* Excel grid — phẳng, không khung dày */
.sched-excel {
  overflow-x: auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}
/* Excel grid — 8 cột: T2–T7 · CN(0.25) · Tuần(1) */
.sched-excel-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(0, 0.25fr) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}
.sched-excel-head.sched-excel-grid {
  border-top: 2px solid var(--border-hover);
  border-left: 1px solid var(--border-hover);
  border-right: 1px solid var(--border-hover);
}
[data-theme="dark"] .sched-excel-head.sched-excel-grid {
  border-top-color: rgba(255, 255, 255, 0.12);
  border-left-color: rgba(255, 255, 255, 0.08);
  border-right-color: rgba(255, 255, 255, 0.08);
}
.sched-excel-head,
.sched-excel-row {
  align-items: stretch;
}
.sched-excel-head__days,
.sched-excel-row__days {
  display: contents;
}
.sched-excel-wd {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 2px;
  background: transparent;
  border-right: 1px solid var(--border-hover);
  border-bottom: 2px solid var(--border-hover);
  line-height: 1.1;
  white-space: nowrap;
}
[data-theme="dark"] .sched-excel-wd { border-right-color: rgba(255, 255, 255, 0.08); }
.sched-excel-wd.is-weekend { color: var(--rose-light); }
.sched-excel-wd.is-sunday {
  padding: 4px 0;
  font-size: 0.64rem;
  letter-spacing: 0.05em;
}
.sched-excel-head__wtot {
  font-size: 0.64rem;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-bottom: 2px solid var(--border-hover);
}
.sched-excel-head__wtot small {
  font-size: 0.54rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: none;
}
.sched-excel-wtot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  padding: 3px 4px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-hover);
  font-size: 0.68rem;
  box-shadow: none;
  min-width: 0;
  overflow: hidden;
}
.sched-excel-grid > .sched-excel-wtot {
  border-right: none;
}
.sched-excel-wtot b {
  font-size: 1.1rem;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.sched-excel-wtot span {
  color: var(--emerald-light);
  font-weight: 700;
  font-size: 0.78rem;
}
.sched-excel-wtot__lbl {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.sched-wtot-seg {
  width: 100%;
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid var(--border);
  text-align: left;
}
.sched-wtot-seg:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.sched-wtot-seg__head {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 2px;
  padding: 0 2px;
}
.sched-kh-tt-table--wtot {
  font-size: 0.88rem;
  line-height: 1.2;
}
.sched-kh-tt-table--wtot thead th {
  font-size: 0.62rem;
  padding: 2px 2px 1px;
}
.sched-kh-tt-table--wtot tbody td {
  padding: 2px 2px;
}
.sched-kh-tt-table--wtot .sched-kh-tt-name {
  font-size: 0.88rem;
  font-weight: 700;
  max-width: none;
}
.sched-kh-tt-table--wtot .sched-kh-tt-num {
  font-size: 0.92rem;
  font-weight: 800;
}
.sched-kh-tt-table--wtot tfoot td {
  font-size: 0.62rem;
  padding: 2px 2px;
}
.sched-kh-tt-num--du.is-behind { color: var(--amber-light); font-weight: 800; }
.sched-kh-tt-num--du.is-ahead { color: var(--emerald-light); font-weight: 800; }
.sched-kh-tt-num--du:not(.is-behind):not(.is-ahead) { color: var(--text-muted); font-weight: 700; }
.sched-wtot-seg--shoot .sched-wtot-seg__head { color: var(--indigo-light); }
.sched-wtot-seg--post .sched-wtot-seg__head { color: var(--amber-light); }

/* Bảng KH / TT — dùng chung trong ô ngày và cột tuần */
.sched-kh-tt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
  table-layout: fixed;
}
.sched-kh-tt-table th,
.sched-kh-tt-table td {
  padding: 2px 3px;
  text-align: center;
  vertical-align: middle;
}
.sched-kh-tt-table thead th {
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
}
.sched-kh-tt-th-name,
.sched-kh-tt-table tbody td:first-child,
.sched-kh-tt-table tfoot td:first-child {
  text-align: left;
  padding-left: 6px;
}
.sched-kh-tt-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-kh-tt-table tbody td:first-child { width: 44%; }
.sched-kh-tt-num {
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-secondary);
}
.sched-kh-tt-num--tt { color: var(--emerald-light); }
.sched-kh-tt-row {
  cursor: pointer;
  transition: background var(--transition-fast);
}
.sched-kh-tt-row:hover { background: rgba(6, 182, 212, 0.08); }
.sched-kh-tt-row.is-off { opacity: 0.45; }
.sched-kh-tt-row.is-off .sched-kh-tt-name { text-decoration: line-through; }
.sched-kh-tt-row.is-miss .sched-kh-tt-num--tt { color: var(--rose-light); }
.sched-kh-tt-table tfoot td {
  font-weight: 800;
  font-size: 0.62rem;
  border-top: 1px solid var(--border);
  padding-top: 3px;
  color: var(--text-muted);
}
.sched-kh-tt-table tfoot .sched-kh-tt-num--tt { color: var(--emerald-light); }
.sched-kh-tt-empty {
  text-align: center !important;
  color: var(--text-muted);
  padding: 4px !important;
}
.sched-kh-tt-table--wtot .sched-kh-tt-name { max-width: none; }

.sched-excel-head { margin-bottom: 0; }

.sched-excel-weeks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: var(--space-2);
}

.sched-excel-row {
  margin-bottom: 0;
  gap: 0;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .sched-excel-row {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.1);
}
.sched-excel-row:last-child { border-bottom: 1px solid var(--border-hover); }

.sched-pos-sum {
  padding: 0;
  margin: 0;
  border-radius: 0;
}
.sched-pos-sum:empty { display: none; }
.sched-header .sched-stats:not(:empty) + .sched-pos-sum:not(:empty) {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.sched-pos-sum__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
.sched-pos-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
}
.sched-pos-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-overlay);
}
.sched-pos-block--shoot .sched-pos-block__title { color: var(--indigo-light); font-weight: 700; font-size: 0.78rem; }
.sched-pos-block--post .sched-pos-block__title { color: var(--amber-light); font-weight: 700; font-size: 0.78rem; }
.sched-pos-block__tot { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); }
.sched-pos-block__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.sched-pos-table-wrap { padding: 6px; border-right: 1px solid var(--border); }
.sched-pos-table-wrap:last-child { border-right: none; }
.sched-pos-table__label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.sched-pos-table {
  width: 100%;
  font-size: 0.68rem;
  border-collapse: collapse;
}
.sched-pos-table th,
.sched-pos-table td {
  padding: 3px 4px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.sched-pos-table th:first-child,
.sched-pos-table td:first-child { text-align: left; }
.sched-pos-table th { font-weight: 700; color: var(--text-muted); font-size: 0.65rem; }

.sched-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.sched-popover-backdrop.is-open { opacity: 1; }

.sched-popover {
  position: fixed;
  z-index: 901;
  width: min(188px, calc(100vw - 16px));
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.32);
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transform-origin: top center;
  transition: opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  overflow: hidden;
}
.sched-popover--form {
  width: min(240px, calc(100vw - 16px));
}
.sched-popover.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.sched-popover.is-above { transform-origin: bottom center; }
.sched-popover.is-above:not(.is-open) { transform: translateY(-4px) scale(0.98); }

.sched-pop__arrow {
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: var(--bg-overlay);
  border-left: 1px solid var(--border-hover);
  border-top: 1px solid var(--border-hover);
  transform: rotate(45deg);
  z-index: 1;
}
.sched-popover.is-above .sched-pop__arrow {
  top: auto;
  bottom: -5px;
  background: var(--bg-card);
  transform: rotate(225deg);
}

/* Header bar — giống ô ngày trên lịch */
.sched-pop__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 3px 6px;
  background: var(--bg-overlay);
  border-bottom: 1px solid var(--border-hover);
}
[data-theme="dark"] .sched-pop__bar {
  background: rgba(255, 255, 255, 0.05);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.sched-pop__wd {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  line-height: 1;
}
.sched-pop__date {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.sched-pop__types {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
.sched-pop-type {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 8px 7px 6px;
  border: none;
  border-bottom: 1px solid var(--border-hover);
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  transition: background var(--transition-fast);
}
.sched-pop-type:last-child { border-bottom: none; }
.sched-pop-type i { width: 14px; height: 14px; flex-shrink: 0; }
.sched-pop-type:hover { background: rgba(6, 182, 212, 0.06); transform: none; }
.sched-pop-type--shoot {
  color: var(--indigo-light);
  border-left-color: var(--indigo-light);
}
.sched-pop-type--post {
  color: var(--amber-light);
  border-left-color: var(--amber-light);
}

/* Form bước 2 */
.sched-pop__toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  background: var(--bg-overlay);
  border-bottom: 1px solid var(--border-hover);
}
[data-theme="dark"] .sched-pop__toolbar {
  background: rgba(255, 255, 255, 0.05);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.sched-pop__toolbar-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.sched-pop__tag {
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.15;
}
.sched-pop__tag--shoot { color: var(--indigo-light); }
.sched-pop__tag--post { color: var(--amber-light); }
.sched-pop__toolbar-sub {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-pop__back {
  flex-shrink: 0;
  border: 1px solid var(--border-hover);
  background: var(--bg-card);
  border-radius: var(--radius-full);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.sched-pop__back:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.sched-pop__back i { width: 12px; height: 12px; }

.sched-pop__body {
  padding: 6px 8px 8px;
}
.sched-pop__grid2 {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 5px;
  margin-bottom: 6px;
}
.sched-pop-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 0;
}
.sched-pop-field .form-input {
  font-size: 0.78rem;
  padding: 4px 6px;
  min-height: 0;
}
.sched-pop-staff__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.sched-pop-link {
  border: none;
  background: none;
  color: var(--cyan-light);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.sched-pop-link:hover { text-decoration: underline; }
.sched-pop-staff__list {
  max-height: 108px;
  overflow-y: auto;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-bottom: 6px;
  background: var(--bg-elevated);
}
.sched-pop-user {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.sched-pop-user:hover { background: rgba(6, 182, 212, 0.06); }
.sched-pop-empty {
  margin: 0;
  padding: 8px 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}
.sched-pop-save { width: 100%; font-size: 0.78rem; padding: 5px 8px; }

/* Legacy — giữ cho tương thích nếu còn dùng */
.sched-pop__head {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 2px;
  padding-right: 20px;
}
.sched-pop__sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.sched-excel-row__label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
}

/* Day cells — compact chrome, content-first */
.sched-day-card {
  position: relative;
  background: var(--bg-card);
  border: none;
  border-right: 1px solid var(--border-hover);
  border-radius: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  overflow: hidden;
  box-shadow: none;
  transition: background var(--transition-fast);
}
.sched-excel-row__days {
  align-items: stretch;
}
.sched-excel-grid > .sched-day-card {
  min-height: 100%;
}
[data-theme="dark"] .sched-day-card {
  border-right-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .sched-day-card {
  box-shadow: none;
}
@media (prefers-reduced-motion: no-preference) {
  .sched-day-card:hover {
    background: rgba(6, 182, 212, 0.06);
    z-index: 1;
  }
  .sched-day-card:active { transform: none; }
}
.sched-day-card.is-today {
  background: rgba(6, 182, 212, 0.08);
  box-shadow: inset 0 0 0 2px var(--cyan-light);
  z-index: 2;
}
.sched-day-card.is-today .sched-day-card__num {
  background: var(--cyan);
  color: #fff;
  border-radius: var(--radius-sm);
  min-width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}
.sched-day-card.is-weekend {
  background: rgba(244, 63, 94, 0.06);
  border-color: rgba(244, 63, 95, 0.2);
}
.sched-day-card.is-out {
  opacity: 0.35;
  cursor: default;
  min-height: 40px;
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.sched-day-card.is-out:hover { transform: none; box-shadow: none; border-color: var(--border); }
.sched-day-card.is-off-day {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.3);
}

/* Chủ nhật — cột hẹp */
.sched-day-card.is-sunday {
  align-items: stretch;
  justify-content: flex-start;
  text-align: center;
  cursor: default;
  background: rgba(6, 182, 212, 0.06);
}
.sched-day-card.is-sunday.is-off-day {
  flex-direction: column;
  gap: 0;
  padding: 0;
}
.sched-day-card.is-sunday.is-out {
  min-height: 0;
  padding: 0;
  justify-content: flex-start;
}
.sched-day-card.is-sunday.is-today .sched-day-card__num {
  background: var(--cyan);
  color: #fff;
  border-radius: var(--radius-sm);
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.45);
}
.sched-day-card__head--sun,
.sched-day-card.is-sunday .sched-day-card__head {
  padding: 3px 2px;
  justify-content: center;
}
.sched-day-card.is-sunday .sched-day-card__num {
  font-size: 0.82rem;
}
.sched-sun-off {
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--cyan-light);
  letter-spacing: 0.1em;
  line-height: 1;
  white-space: nowrap;
}
.sched-kh-tt-num--editable {
  cursor: cell;
}
.sched-kh-tt-num--editable:hover {
  background: rgba(6, 182, 212, 0.1);
  border-radius: 2px;
}
.sched-kh-tt-num.is-editing {
  padding: 0 !important;
}
.sched-kh-tt-inline-inp {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 1px 2px;
  border: 1px solid var(--cyan);
  border-radius: 2px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: inherit;
  font-weight: 800;
  text-align: center;
  -moz-appearance: textfield;
}
.sched-kh-tt-inline-inp::-webkit-outer-spin-button,
.sched-kh-tt-inline-inp::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.sched-kh-tt-inline-inp:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.35);
}
.sched-day-card__body--sun {
  padding: 2px 1px;
  width: 100%;
  overflow: hidden;
}
.sched-day-card.is-sunday .sched-kh-tt-table--day {
  font-size: 0.58rem;
}
.sched-day-card.is-sunday .sched-kh-tt-table--day .sched-kh-tt-name {
  font-size: 0.58rem;
}
.sched-day-card.is-sunday .sched-kh-tt-table--day .sched-kh-tt-num {
  font-size: 0.62rem;
}
.sched-day-card.is-sunday .sched-kh-tt-table--day thead th {
  font-size: 0.52rem;
  padding: 2px 0;
}
.sched-day-card.is-sunday .sched-seg-tag {
  font-size: 0.52rem;
}
.sched-day-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  min-height: 28px;
  border-bottom: 2px solid var(--border-hover);
  background: var(--bg-elevated);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
[data-theme="dark"] .sched-day-card__head {
  background: rgba(255, 255, 255, 0.07);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}
.sched-day-card__head--ghost {
  background: transparent;
  border-bottom: none;
  min-height: 0;
  padding: 4px 6px;
}
.sched-day-card__head-end {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.sched-day-card__num {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.sched-day-card.is-weekend:not(.is-sunday) .sched-day-card__num { color: var(--rose-light); }
.sched-day-card.is-out .sched-day-card__num {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.sched-day-card__off {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--cyan-light);
  letter-spacing: 0.12em;
  padding: 8px 0;
}
.sched-day-card__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 2px 3px 3px;
  background: transparent;
  min-height: 0;
}
[data-theme="dark"] .sched-day-card__body {
  background: transparent;
}
.sched-day-card__foot {
  display: none;
}
.sched-day-card__foot-lbl {
  color: var(--cyan-light);
  font-weight: 800;
  font-size: 0.78rem;
}
.sched-day-card__tot {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-primary);
  font-size: 0.82rem;
}
.sched-day-card__tot sup { font-size: 0.62rem; color: var(--emerald-light); font-weight: 700; }
.sched-day-card__sep { color: var(--text-muted); margin: 0 2px; }

.sched-day-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(6, 182, 212, 0.45);
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan-light);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.sched-day-add i { width: 11px; height: 11px; }
.sched-day-add:hover {
  background: rgba(6, 182, 212, 0.22);
  transform: scale(1.05);
}
.sched-day-card.is-off-day .sched-day-add {
  position: static;
}

.sched-pick-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.sched-type-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--space-4) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.sched-type-pick i { width: 28px; height: 28px; }
.sched-type-pick:hover { transform: translateY(-2px); border-color: var(--border-hover); }
.sched-type-pick--shoot { border-color: rgba(99, 102, 241, 0.35); color: var(--indigo-light); }
.sched-type-pick--shoot:hover { box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15); }
.sched-type-pick--post { border-color: rgba(245, 158, 11, 0.35); color: var(--amber-light); }
.sched-type-pick--post:hover { box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15); }

.sched-assign-qty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: var(--space-3) 0;
  font-size: 0.88rem;
  font-weight: 500;
}
.sched-assign-staff__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  font-weight: 600;
  font-size: 0.88rem;
}
.sched-user-checks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}
.sched-user-check {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.sched-user-check:hover { background: var(--bg-overlay); }
.sched-user-check input { grid-row: 1 / 3; }
.sched-user-check__name { font-weight: 500; font-size: 0.88rem; }
.sched-user-check__pos { font-size: 0.72rem; grid-column: 2; }

.sched-day-card.is-empty .sched-day-card__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.sched-day-ph-plus {
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--cyan-light);
  opacity: 0.55;
  line-height: 1;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.sched-day-ph-hint {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}
.sched-day-card.is-empty:hover .sched-day-ph-plus {
  opacity: 0.95;
  transform: scale(1.08);
}

/* Type segments inside day */
.sched-day-seg {
  margin-bottom: 3px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border-left: 3px solid var(--border);
  background: var(--bg-card);
}
.sched-day-seg:last-child { margin-bottom: 0; }
.sched-day-seg--shoot { border-left-color: var(--indigo-light); }
.sched-day-seg--post { border-left-color: var(--amber-light); }
.sched-day-seg.has-data {
  background: rgba(6, 182, 212, 0.03);
}
.sched-seg-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.15;
}
.sched-seg-tag--shoot { color: var(--indigo-light); }
.sched-seg-tag--post { color: var(--amber-light); }

/* Ô ngày */
.sched-kh-tt-table--day {
  font-size: 0.88rem;
  line-height: 1.2;
}
.sched-kh-tt-table--day thead th {
  font-size: 0.68rem;
  padding: 3px 2px 2px;
  border-bottom: 1px solid var(--border-hover);
}
.sched-kh-tt-table--day tbody td {
  padding: 3px 2px;
}
.sched-kh-tt-table--day .sched-kh-tt-th-name,
.sched-kh-tt-table--day tbody td:first-child,
.sched-kh-tt-table--day tfoot td:first-child {
  padding-left: 4px;
}
.sched-kh-tt-table--day .sched-kh-tt-name {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.sched-kh-tt-table--day .sched-kh-tt-num {
  font-size: 0.96rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sched-kh-tt-table--day tfoot td {
  padding: 2px 2px 3px;
  font-size: 0.62rem;
  font-weight: 800;
}
.sched-kh-tt-table--day tbody td:first-child { width: 42%; }
.sched-kh-tt-table--day tbody td:nth-child(2),
.sched-kh-tt-table--day tbody td:nth-child(3),
.sched-kh-tt-table--day thead th:nth-child(2),
.sched-kh-tt-table--day thead th:nth-child(3),
.sched-kh-tt-table--day tfoot td:nth-child(2),
.sched-kh-tt-table--day tfoot td:nth-child(3) {
  width: 29%;
}
.sched-day-seg .sched-kh-tt-table {
  padding: 0;
}

.sched-day-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
  line-height: 1.35;
}
.sched-day-mini td { padding: 2px 4px; text-align: center; }
.sched-day-mini tfoot td {
  font-weight: 800;
  font-size: 0.64rem;
  border-top: 1px solid var(--border-hover);
  padding-top: 3px;
  color: var(--text-primary);
  background: var(--bg-overlay);
}
.sched-dt-set {
  text-align: left !important;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sched-dt-num {
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.sched-dt-num--tt { color: var(--emerald-light); }
.sched-dt-row { cursor: pointer; transition: background var(--transition-fast); }
.sched-dt-row:hover td { background: rgba(6, 182, 212, 0.12); }
.sched-dt-row.is-off td { opacity: 0.5; color: var(--text-muted); }
.sched-dt-row.is-miss .sched-dt-num--tt {
  background: rgba(244, 63, 94, 0.35);
  color: #fff;
  border-radius: 3px;
}

/* Month summary (collapsible) */
.sched-month-details {
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.sched-month-details:not([open]) { padding: 0; }
.sched-month-details:empty { display: none; }
.sched-month-details__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  list-style: none;
  user-select: none;
  transition: background var(--transition-fast);
}
.sched-month-details__summary::-webkit-details-marker { display: none; }
.sched-month-details__summary:hover { background: var(--bg-elevated); }
.sched-month-details__summary i { width: 16px; height: 16px; color: var(--cyan-light); }
.sched-month-details__hint {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}
.sched-mt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
}
.sched-mt-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
}
.sched-mt-block__title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}
.sched-mt-block--shoot .sched-mt-block__title { color: var(--indigo-light); }
.sched-mt-block--post .sched-mt-block__title { color: var(--amber-light); }
.sched-month-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.sched-month-table th {
  text-align: left;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.sched-month-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.sched-mt-name { font-weight: 600; }
.sched-mt-total td { font-weight: 700; background: var(--bg-overlay); }
.is-ahead { color: var(--emerald-light); }
.is-behind { color: var(--rose-light); }

/* Shared row + modal */
.sched-row__pos {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
}
.modal.modal--lg { max-width: 780px; width: 92vw; }
.sched-day-body { display: flex; flex-direction: column; gap: var(--space-4); }
.sched-day-section {
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.sched-day-section[data-type="shoot"] { border-left: 3px solid var(--indigo); }
.sched-day-section[data-type="post"] { border-left: 3px solid var(--amber); }
.sched-day-section__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.sched-day-section__title i { width: 15px; height: 15px; }
.sched-day-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.sched-day-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}
.sched-day-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sched-row__name { font-weight: 500; color: var(--text-primary); white-space: nowrap; }
.sched-row.is-off { opacity: 0.5; }
.sched-inp {
  width: 64px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  color: var(--text-primary);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}
.sched-inp:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.12); }
.sched-inp--sm { width: 52px; }
.sched-inp--note { width: 100%; min-width: 110px; }
.sched-inp:disabled { opacity: 0.45; }
.sched-off-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--text-secondary); cursor: pointer; }
.sched-row__act {
  width: 36px;
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
}
.sched-row-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.sched-row-del i { width: 15px; height: 15px; }
.sched-row-del:hover:not(:disabled) {
  color: var(--rose-light);
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.25);
}
.sched-row-del:disabled { opacity: 0.4; cursor: not-allowed; }
.sched-cell-edit-name { font-weight: 600; margin-bottom: var(--space-3); }
.sched-cell-edit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-bottom: var(--space-3); }
.sched-cell-edit-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--text-muted); }

@media (max-width: 1100px) {
  .sched-stats__compact {
    grid-template-columns: 1fr;
  }
  .sched-quota-table {
    width: 100%;
  }
  .sched-stats__grid { grid-template-columns: repeat(2, 1fr); }
  .sched-mt-grid { grid-template-columns: 1fr; }
  .sched-dash__panels { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .sched-dash__kpi { gap: 6px; }
  .sched-excel-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) minmax(0, 0.25fr) minmax(0, 1fr);
  }
  .app-main:has(#tab-schedule.active) { padding-left: var(--space-3); padding-right: var(--space-3); }
}
@media (max-width: 720px) {
  .sched-header,
  .sched-calendar-wrap,
  .sched-roster { padding: var(--space-3); }
  .sched-stats__grid { grid-template-columns: 1fr 1fr; }
  .sched-roster__inner { flex-direction: column; align-items: stretch; }
  .sched-roster__add { flex-direction: column; }
  .sched-roster__select,
  .sched-roster__select--sm { width: 100%; min-width: 0; }
  .sched-cal-toolbar { flex-direction: row; align-items: center; }
  .sched-day-card__body { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sched-day-card:hover { transform: none; }
}
