/* ==========================================================================
   BNI Timesheet & Overtime Studio - Dashboard UI System
   Inspired by SnowUI / Admin Dashboard Kit (Figma Node 54869:11584)
   Crafted with Antislop Design Principles
   ========================================================================== */

:root {
  /* Typography Scale */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-main);
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Theme Surfaces & Backgrounds */
  --bg-app: #0b0e14;
  --bg-sidebar: #10141d;
  --bg-header: rgba(16, 20, 29, 0.82);
  --bg-surface: #151a26;
  --bg-surface-elevated: #1c2232;
  --bg-surface-hover: #232b3f;
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.07);

  /* Subtle Borders (Figma Spec) */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-focus: #0ea5e9;

  /* Text Hierarchy */
  --text-primary: #f8fafc;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.42);
  --text-inverse: #0b0e14;

  /* Figma Brand Accents */
  --accent-cyan: #33d1ff;
  --accent-blue: #0ea5e9;
  --accent-blue-soft: #a0bce8;
  --accent-mint: #6be6d3;
  --accent-purple: #b899eb;
  --accent-lime: #71dd8c;
  --accent-orange: #f97316;

  /* Status Colors */
  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-danger: #ef4444;
  --status-danger-bg: rgba(239, 68, 68, 0.12);
  --status-info: #0ea5e9;
  --status-info-bg: rgba(14, 165, 233, 0.12);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows & Depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.25);

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

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dashboard-body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 10% 5%, rgba(14, 165, 233, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(184, 153, 235, 0.04) 0%, transparent 45%);
  background-attachment: fixed;
}

/* ==========================================================================
   App Shell Layout (Sidebar + Main Canvas)
   ========================================================================== */

.app-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* --------------------------------------------------------------------------
   Left Sidebar Navigation
   -------------------------------------------------------------------------- */
.app-sidebar {
  width: 250px;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-normal);
}

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

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

.brand-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 60%, #f97316 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.sidebar-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}

.nav-tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  color: #ffffff;
  background: rgba(14, 165, 233, 0.12);
  font-weight: 600;
}

.nav-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent-cyan);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

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

.nav-tab.active .nav-icon {
  color: var(--accent-cyan);
}

.tab-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-count {
  background: var(--accent-orange);
  color: white;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.user-capsule {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-blue-soft);
  flex-shrink: 0;
}

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

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

.user-role {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--status-success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  flex-shrink: 0;
}

/* Backdrop for Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 95;
}

/* --------------------------------------------------------------------------
   Main Canvas & Top Header Bar
   -------------------------------------------------------------------------- */
.main-canvas {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: 64px;
  padding: 0 32px;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-icon-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-icon-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.crumb-root {
  color: var(--text-muted);
  font-weight: 500;
}

.crumb-divider {
  color: var(--border-medium);
  font-size: 0.8rem;
}

.crumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Quick Search Box (Figma Style) */
.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 5px 12px;
  width: 220px;
  transition: all var(--transition-fast);
}

.header-search:focus-within {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  width: 260px;
}

.search-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.search-input {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-main);
  font-size: 0.82rem;
  color: var(--text-primary);
  width: 100%;
}

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

.search-kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.period-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.25);
  color: var(--accent-cyan);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ==========================================================================
   Main Workspace Container & Spacious Layout
   ========================================================================== */

.main-container {
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 28px 32px 60px;
}

/* --------------------------------------------------------------------------
   Metric Stat Cards (Figma 4-Column Stat Block)
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

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

.stat-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  white-space: nowrap;
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: 'tnum';
  margin-bottom: 4px;
  line-height: 1.2;
}

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

.stat-card.stat-success {
  border-top: 2px solid var(--status-success);
}

.stat-card.stat-warning {
  border-top: 2px solid var(--status-warning);
}

.stat-card.stat-danger {
  border-top: 2px solid var(--status-danger);
}

/* --------------------------------------------------------------------------
   General Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  margin-bottom: 22px;
}

.card-title-group h2,
.card-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.card-title-group h3,
.card-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-title-group p,
.card-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

.header-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.card-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Tab Content Transitions
   -------------------------------------------------------------------------- */
.tab-content {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-content.active {
  display: block;
}

/* --------------------------------------------------------------------------
   Buttons System
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 13px 26px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

.btn-danger-sm {
  background: var(--status-danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-danger-sm:hover {
  background: rgba(239, 68, 68, 0.22);
}

/* --------------------------------------------------------------------------
   Forms & Inputs
   -------------------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 9px 13px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Dropzone (Upload Section)
   -------------------------------------------------------------------------- */
.hero-card {
  padding: 36px 28px;
  background: linear-gradient(180deg, rgba(20, 26, 38, 0.7) 0%, var(--bg-surface) 100%);
}

.dropzone {
  border: 2px dashed rgba(14, 165, 233, 0.3);
  background: rgba(14, 165, 233, 0.02);
  border-radius: var(--radius-xl);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-normal);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(14, 165, 233, 0.06);
  transform: translateY(-2px);
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-icon {
  color: var(--accent-cyan);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.dropzone-content p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.dropzone-content code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.dropzone-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.progress-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(14, 165, 233, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.actions-bar {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

/* --------------------------------------------------------------------------
   Tables (Figma Clean Table System)
   -------------------------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.data-table, .preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.data-table th, .preview-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.data-table td, .preview-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover, .preview-table tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.data-table tfoot td {
  background: var(--bg-surface-elevated);
  border-top: 2px solid var(--border-subtle);
}

.data-table input[type="text"],
.data-table select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  outline: none;
}

.data-table input[type="text"]:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
}

.row-weekend {
  background: rgba(255, 255, 255, 0.012);
  color: var(--text-muted) !important;
}

.row-weekend td {
  color: var(--text-muted);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }

/* Status Badges */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.badge-success { background: var(--status-success-bg); color: #34d399; }
.badge-warning { background: var(--status-warning-bg); color: #fbbf24; }
.badge-danger { background: var(--status-danger-bg); color: #f87171; }
.badge-info { background: var(--status-info-bg); color: var(--accent-cyan); }

/* --------------------------------------------------------------------------
   Git Log Box
   -------------------------------------------------------------------------- */
.git-log-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 22px;
}

.git-log-box textarea {
  width: 100%;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  resize: vertical;
  outline: none;
}

.git-log-box textarea:focus {
  border-color: var(--border-focus);
}

.git-log-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Sub Navigation (Preview Tabs)
   -------------------------------------------------------------------------- */
.sub-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  flex-wrap: wrap;
}

.sub-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sub-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.sub-tab.active {
  background: var(--bg-surface-elevated);
  border-color: rgba(14, 165, 233, 0.3);
  color: var(--accent-cyan);
  font-weight: 600;
}

.sub-content {
  display: none;
}

.sub-content.active {
  display: block;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   Alerts & Inconsistency Banner
   -------------------------------------------------------------------------- */
.alert-box {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 22px;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.alert-icon {
  font-size: 22px;
}

.alert-body h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.alert-body ul {
  padding-left: 20px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.btn-outline-warning {
  background: transparent;
  border: 1px solid #fbbf24;
  color: #fbbf24;
}

.btn-outline-warning:hover {
  background: #fbbf24;
  color: #000;
}

/* --------------------------------------------------------------------------
   Download & Export Section (Wide, High-Resolution Architecture)
   -------------------------------------------------------------------------- */
.export-hero {
  text-align: center;
  padding: 44px 24px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(37, 99, 235, 0.04) 100%);
  border: 1px solid rgba(14, 165, 233, 0.2);
  margin-bottom: 28px;
}

.export-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.export-hero h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.export-hero p {
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 22px;
  font-size: 0.9rem;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

.download-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.download-card:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 165, 233, 0.35);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.12);
}

.doc-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.doc-badge.xlsx {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.doc-badge.docx {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.doc-info {
  flex: 1 1 auto;
  min-width: 0;
}

.doc-info h4 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.doc-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.download-card .btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 18px;
  font-weight: 600;
}

/* Single Overtime Card Meta */
.ot-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.ot-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.ot-date-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.ot-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-width: 0;
}

.ot-time-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  color: #e2e8f0;
  white-space: nowrap;
  flex-shrink: 0;
}

.ot-desc-tag {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.25s ease;
  min-width: 260px;
}

.toast-success { background: #064e3b; color: #a7f3d0; border: 1px solid #10b981; }
.toast-error { background: #7f1d1d; color: #fecaca; border: 1px solid #ef4444; }
.toast-info { background: #0c4a6e; color: #bae6fd; border: 1px solid #0ea5e9; }

/* --------------------------------------------------------------------------
   Utilities & Animations
   -------------------------------------------------------------------------- */
.hidden { display: none !important; }
.mt-24 { margin-top: 24px; }

.actions-cell {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

.empty-state-text {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   PDF Merger Component Styling
   -------------------------------------------------------------------------- */
.merge-action-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.merge-filename-group {
  flex: 1;
  min-width: 280px;
}

.merge-filename-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.merge-input-wrapper input {
  width: 100%;
  max-width: 440px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.merge-input-wrapper input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.merge-execute-group button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-move-order {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-move-order:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-move-order:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.file-pdf-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

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

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

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

/* Accessible Focus Visible Indicator */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-tab:focus-visible,
.sub-tab:focus-visible,
.header-icon-btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Table Empty State Row */
.empty-state-row {
  padding: 48px 24px !important;
  text-align: center;
}

.table-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.table-empty-state h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.table-empty-state p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Glassmorphism & High-Contrast Fallbacks */
@supports not (backdrop-filter: blur(12px)) {
  .app-header {
    background: #10141d;
  }
  .sidebar-backdrop {
    background: rgba(0, 0, 0, 0.85);
  }
}

@media (prefers-contrast: more) {
  .app-header {
    background: #0b0e14;
    border-bottom: 2px solid #ffffff;
  }
  .card, .stat-card, .app-sidebar {
    border-color: rgba(255, 255, 255, 0.35);
  }
  .stat-label, .card-title-group p, .doc-info p {
    color: #ffffff;
  }
}

/* ==========================================================================
   Responsive Reflow (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 1024px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .sidebar-close-btn {
    display: block;
  }

  .main-container {
    padding: 20px 20px 50px;
  }

  .app-header {
    padding: 0 20px;
  }
}

@media (max-width: 768px) {
  .app-header {
    gap: 8px;
  }

  .header-search {
    display: none;
  }

  .download-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .flex-between {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-buttons {
    width: 100%;
  }

  /* Minimum 44px touch targets on mobile (R-03) */
  .btn,
  .btn-sm,
  .header-icon-btn,
  .sidebar-close-btn,
  .sub-tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .actions-cell .btn,
  .actions-cell .btn-danger-sm {
    min-height: 38px;
    padding: 8px 12px;
  }
}

/* ==========================================================================
   Spreadsheet Studio (Luckysheet Interactive Excel Engine)
   ========================================================================== */
.spreadsheet-studio-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.spreadsheet-studio-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.spreadsheet-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.doc-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-inline {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.doc-selector {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
}

.doc-selector:focus {
  border-color: var(--accent-blue);
}

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

.btn-group-rowcol {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-group-rowcol .btn {
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  border-right: 1px solid var(--border-subtle);
  padding: 6px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-group-rowcol .btn:last-child {
  border-right: none;
}

.btn-group-rowcol .btn:hover {
  background: var(--bg-surface-hover);
  color: var(--accent-cyan);
}

.spreadsheet-tip-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.spreadsheet-tip-banner .tip-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.spreadsheet-tip-banner code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-size: 12px;
}

.luckysheet-wrapper {
  position: relative;
  width: 100%;
  height: 680px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  contain: layout;
  overscroll-behavior: contain;
}

#luckysheet {
  margin: 0;
  padding: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  contain: layout;
  overscroll-behavior: contain;
}

/* Ensure Luckysheet text & icons are high contrast */
#luckysheet .luckysheet-toolbar-menu-button,
#luckysheet .luckysheet-toolbar-button {
  color: #333333;
}

.luckysheet-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(16, 20, 29, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 1000;
  color: var(--text-primary);
  font-weight: 500;
}

.luckysheet-loading .spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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