/* ═══════════════════════════════════════════════════════════════
   IGB Application Portal — Design System v1.0
   Aesthetic: Modern premium SaaS (Linear / Stripe)
   Font: Inter (Google Fonts)
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. DESIGN TOKENS ─────────────────────────────────────── */
:root {
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;

  /* Accent (Primary — Indigo) */
  --primary:       #4f46e5;   /* indigo-600 */
  --primary-light: #818cf8;   /* indigo-400 */
  --primary-dark:  #4338ca;   /* indigo-700 */
  --primary-50:    #eef2ff;   /* indigo-50  */
  --primary-100:   #e0e7ff;   /* indigo-100 */
  --primary-ring:  rgb(79 70 229 / 0.12);

  /* Neutrals (Slate) */
  --base-50:  #f8fafc;
  --base-100: #f1f5f9;
  --base-200: #e2e8f0;
  --base-300: #cbd5e1;
  --base-400: #94a3b8;
  --base-500: #64748b;
  --base-600: #475569;
  --base-700: #334155;
  --base-800: #1e293b;
  --base-900: #0f172a;
  --base-950: #020617;

  /* Surfaces */
  --surface-100:     #ffffff;
  --surface-overlay:  rgba(255, 255, 255, 0.82);

  /* Semantic */
  --success:     #16a34a;   /* green-600  */
  --success-bg:  #f0fdf4;
  --success-border: #bbf7d0;
  --warning:     #f59e0b;   /* amber-500  */
  --warning-bg:  #fffbeb;
  --warning-border: #fde68a;
  --error:       #dc2626;   /* red-600    */
  --error-bg:    #fef2f2;
  --error-border: #fecaca;
  --info:        #0284c7;   /* sky-600    */
  --info-bg:     #f0f9ff;
  --info-border: #bae6fd;

  /* Semantic — Extended (dark text, light accent) */
  --success-dark:   #15803d;   /* green-700 — hover/dark variant */
  --success-light:  #4ade80;   /* green-400 */
  --warning-dark:   #92400e;   /* amber-800 — dark text on warning bg */
  --warning-light:  #fbbf24;   /* amber-400 */
  --error-dark:     #b91c1c;   /* red-700   */
  --error-light:    #f87171;   /* red-400   */
  --error-lighter:  #fca5a5;   /* red-300   */
  --info-dark:      #0c4a6e;   /* sky-900   */
  --info-light:     #38bdf8;   /* sky-400   */

  /* Purple (workflow/progress — not in Tailwind semantic but used in UI) */
  --purple:         #8b5cf6;   /* violet-500 */
  --purple-dark:    #7c3aed;   /* violet-600 */
  --purple-bg:      #faf5ff;   /* violet-50  */

  /* Role Colors */
  --role-hr:    #0284c7;   /* sky-600   */
  --role-igb:   #16a34a;   /* green-600 */
  --role-admin: #dc2626;   /* red-600   */

  /* Role Gradients (avatar backgrounds) */
  --gradient-hr:    linear-gradient(135deg, #4f46e5, #06b6d4);
  --gradient-igb:   linear-gradient(135deg, #16a34a, #059669);
  --gradient-admin: linear-gradient(135deg, #ef4444, #f97316);

  /* Avatar Palette (6-color rotation for applicant avatars) */
  --avatar-0: linear-gradient(135deg, #4f46e5, #06b6d4);  /* indigo → cyan   */
  --avatar-1: linear-gradient(135deg, #8b5cf6, #ec4899);  /* violet → pink   */
  --avatar-2: linear-gradient(135deg, #10b981, #14b8a6);  /* emerald → teal  */
  --avatar-3: linear-gradient(135deg, #f59e0b, #f97316);  /* amber → orange  */
  --avatar-4: linear-gradient(135deg, #6366f1, #a855f7);  /* indigo → purple */
  --avatar-5: linear-gradient(135deg, #ef4444, #f97316);  /* red → orange    */

  /* Dark mode surface tokens (for staff login, dark cards) */
  --dark-border:       rgb(255 255 255 / 0.06);
  --dark-border-hover: rgb(255 255 255 / 0.15);
  --dark-input-bg:     var(--base-900);
  --dark-input-border: rgb(255 255 255 / 0.08);
  --dark-focus-ring:   rgb(148 163 184 / 0.1);
  --dark-error-bg:     rgb(220 38 38 / 0.1);
  --dark-error-border: rgb(220 38 38 / 0.2);

  /* Elevation & Shadows */
  --shadow-base:    0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-card:    0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-popover: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-modal:   0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Border Radii */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-full: 9999px;

  /* Spacing (4px base) */
  --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;
  --space-16: 64px;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;

  /* Layout */
  --sidebar-width: 232px;
  --topbar-height: 52px;
}

/* ── DARK MODE ───────────────────────────────────────────── */
[data-theme="dark"] {
  --primary:       #818cf8;   /* indigo-400 for dark bg */
  --primary-light: #a5b4fc;   /* indigo-300 */
  --primary-dark:  #6366f1;   /* indigo-500 */
  --primary-50:    #1e1b4b;   /* indigo-950 */
  --primary-100:   #312e81;   /* indigo-900 */
  --primary-ring:  rgb(129 140 248 / 0.15);

  --base-50:  #1e293b;
  --base-100: #1e293b;
  --base-200: #334155;
  --base-300: #475569;
  --base-400: #94a3b8;
  --base-500: #cbd5e1;
  --base-600: #e2e8f0;
  --base-700: #f1f5f9;
  --base-800: #f8fafc;
  --base-900: #ffffff;
  --base-950: #ffffff;

  --surface-100:     #0f172a;
  --surface-overlay:  rgba(15, 23, 42, 0.9);

  --success:     #4ade80;   --success-bg:  rgba(34, 197, 94, 0.1);   --success-border: rgba(34, 197, 94, 0.2);
  --success-dark: #22c55e;  --success-light: #86efac;
  --warning:     #fbbf24;   --warning-bg:  rgba(245, 158, 11, 0.1);  --warning-border: rgba(245, 158, 11, 0.2);
  --warning-dark: #fbbf24;  --warning-light: #fde68a;
  --error:       #f87171;   --error-bg:    rgba(239, 68, 68, 0.1);   --error-border: rgba(239, 68, 68, 0.2);
  --error-dark:  #fca5a5;   --error-light: #f87171;   --error-lighter: #fca5a5;
  --info:        #38bdf8;   --info-bg:     rgba(14, 165, 233, 0.1);  --info-border: rgba(14, 165, 233, 0.2);
  --info-dark:   #7dd3fc;   --info-light:  #38bdf8;

  --purple: #a78bfa; --purple-dark: #8b5cf6; --purple-bg: rgba(139, 92, 246, 0.1);

  --shadow-base:    0 1px 3px 0 rgb(0 0 0 / 0.3);
  --shadow-card:    0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
  --shadow-popover: 0 10px 15px -3px rgb(0 0 0 / 0.3);
  --shadow-modal:   0 20px 25px -5px rgb(0 0 0 / 0.3);
}
[data-theme="dark"] body { background: #0f172a; color: #f8fafc; }
[data-theme="dark"] .ds-sidebar { background: #0b1120; border-right-color: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .ds-sidebar-brand { border-bottom-color: #1e293b; }
[data-theme="dark"] .ds-sidebar-brand h1 { color: #f8fafc; }
[data-theme="dark"] .ds-nav-section { color: #64748b; }
[data-theme="dark"] .ds-nav-item { color: #94a3b8; }
[data-theme="dark"] .ds-nav-item:hover { background: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .ds-nav-item.active { background: #1e293b; color: #f8fafc; }
[data-theme="dark"] .ds-nav-badge { background: rgba(239, 68, 68, 0.2); color: #f87171; }
[data-theme="dark"] .ds-sidebar-footer { border-top-color: #1e293b; }
[data-theme="dark"] .ds-sidebar-footer .user-name { color: #f8fafc; }
[data-theme="dark"] .ds-sidebar-footer .user-role { color: #64748b; }
[data-theme="dark"] .topbar, [data-theme="dark"] .ds-topbar { background: #0f172a; border-bottom-color: #1e293b; color: #f8fafc; }
[data-theme="dark"] .card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #1e293b; border-color: #475569; color: #f8fafc;
}
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus {
  border-color: #818cf8; box-shadow: 0 0 0 3px rgb(129 140 248 / 0.15);
}
/* Dark mode theme toggle styling */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.theme-toggle-label { font-size: 10px; color: var(--base-400); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.theme-toggle-track {
  width: 36px; height: 20px; border-radius: 10px; position: relative;
  background: var(--base-200); transition: background 0.2s;
}
.theme-toggle-dot {
  width: 14px; height: 14px; border-radius: 50%; position: absolute;
  top: 3px; left: 3px; background: var(--surface-100);
  transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
[data-theme="dark"] .theme-toggle-track { background: #475569; }
[data-theme="dark"] .theme-toggle-dot { transform: translateX(16px); background: #e2e8f0; }

/* ── GLOBAL SCROLLBAR (dark mode) ─────────────────────────── */
/* Firefox */
[data-theme="dark"] * {
  scrollbar-color: #475569 #0f172a;
}
/* Webkit (Chrome, Edge, Safari) */
[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: #0f172a; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; border-radius: 5px; border: 2px solid #0f172a; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }
[data-theme="dark"] ::-webkit-scrollbar-corner { background: #0f172a; }

/* ── 2. RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  color: var(--base-800);
  background: var(--base-50);
}


/* ── 3. TYPOGRAPHY ────────────────────────────────────────── */
.text-h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.2;
  color: var(--base-900);
}

.text-h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--base-800);
}

.text-h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
  color: var(--base-800);
}

.text-base {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}

.text-label {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--base-700);
}

.text-caption {
  font-size: 12px;
  font-weight: 400;
  color: var(--base-500);
}

.text-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ── 4. BUTTONS ───────────────────────────────────────────── */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.ds-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ds-btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.ds-btn-primary:hover {
  background: var(--primary-dark);
}

.ds-btn-secondary {
  background: var(--surface-100);
  color: var(--base-700);
  border: 1px solid var(--base-200);
}
.ds-btn-secondary:hover {
  background: var(--base-100);
  border-color: var(--base-300);
}

.ds-btn-ghost {
  background: transparent;
  color: var(--base-500);
}
.ds-btn-ghost:hover {
  background: var(--base-100);
  color: var(--base-800);
}

.ds-btn-danger {
  background: var(--surface-100);
  color: var(--error);
  border: 1px solid var(--error-border);
}
.ds-btn-danger:hover {
  background: var(--error-bg);
}

.ds-btn-success {
  background: var(--success);
  color: white;
}
.ds-btn-success:hover {
  background: var(--success-dark);
}

.ds-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.ds-btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.ds-btn-full { width: 100%; }

.ds-btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
}

/* Disabled state — all button variants */
.ds-btn:disabled,
.ds-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading state */
.ds-btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.ds-btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: ds-spin 0.6s linear infinite;
}


/* ── 5. FORM INPUTS ───────────────────────────────────────── */
.ds-input {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--base-800);
  background: var(--surface-100);
  border: 1px solid var(--base-200);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.ds-input::placeholder {
  color: var(--base-400);
}

.ds-input:hover {
  border-color: var(--base-300);
}

.ds-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.ds-input-error {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px rgb(220 38 38 / 0.1) !important;
}

.ds-input-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ds-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--base-700);
  margin-bottom: var(--space-1);
}

.ds-field {
  margin-bottom: var(--space-5);
}

.ds-field-hint {
  font-size: 12px;
  color: var(--base-500);
  margin-top: var(--space-1);
}

.ds-field-error {
  font-size: 12px;
  color: var(--error);
  margin-top: var(--space-1);
}

/* Disabled & readonly states */
.ds-input:disabled,
.ds-input[disabled] {
  background: var(--base-100);
  color: var(--base-400);
  cursor: not-allowed;
  opacity: 0.7;
}

.ds-input-readonly,
.ds-input[readonly] {
  background: var(--base-50);
  color: var(--base-600);
  cursor: default;
}

/* Success state */
.ds-input-success {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 3px rgb(22 163 74 / 0.1) !important;
}

/* Floating label support */
.ds-float-field {
  position: relative;
}
.ds-float-field input:focus + label,
.ds-float-field input:not(:placeholder-shown) + label {
  transform: translateY(-1.5rem) scale(0.85);
  color: var(--primary);
  font-weight: 600;
}


/* ── 6. CARDS ─────────────────────────────────────────────── */
.ds-card {
  background: var(--surface-100);
  border: 1px solid var(--base-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.ds-card-flat {
  box-shadow: var(--shadow-base);
}

.ds-card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--base-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ds-card-body {
  padding: var(--space-6);
}

.ds-card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--base-100);
  background: var(--base-50);
}

/* Stat card with top accent border */
.ds-stat-card {
  border-top: 2px solid var(--base-200);
}
.ds-stat-card-amber  { border-top-color: var(--warning); }
.ds-stat-card-red    { border-top-color: var(--error); }
.ds-stat-card-green  { border-top-color: var(--success); }
.ds-stat-card-blue   { border-top-color: var(--info); }
.ds-stat-card-indigo { border-top-color: var(--primary); }


/* ── 7. BADGES ────────────────────────────────────────────── */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.ds-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ds-badge-blue    { background: var(--info-bg);    color: var(--info); }
.ds-badge-blue    .ds-badge-dot { background: var(--info); }
.ds-badge-amber   { background: var(--warning-bg); color: var(--warning-dark); }
.ds-badge-amber   .ds-badge-dot { background: var(--warning); }
.ds-badge-red     { background: var(--error-bg);   color: var(--error); }
.ds-badge-red     .ds-badge-dot { background: var(--error); }
.ds-badge-green   { background: var(--success-bg); color: var(--success); }
.ds-badge-green   .ds-badge-dot { background: var(--success); }
.ds-badge-gray    { background: var(--base-100);   color: var(--base-500); }
.ds-badge-gray    .ds-badge-dot { background: var(--base-400); }
.ds-badge-indigo  { background: var(--primary-50); color: var(--primary); }
.ds-badge-indigo  .ds-badge-dot { background: var(--primary); }


/* ── 8. SIDEBAR (HR Layout) — follows theme toggle ───────── */
/* Light: light gray bg (#f1f5f9). Dark: dark navy (#0b1120). */
.ds-sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: #f1f5f9;
  color: var(--base-800);
  border-right: 1px solid var(--base-200);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.ds-sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--base-200);
}
.ds-sidebar-brand h1 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--base-800);
}
.ds-sidebar-brand p {
  font-size: 11px;
  color: var(--base-500);
  margin-top: 2px;
}

.ds-sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.ds-nav-section {
  padding: 12px 14px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--base-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.ds-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--base-600);
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  border-left: 2px solid transparent;
}
.ds-nav-item:hover {
  background: var(--primary-50);
  color: var(--primary);
  border-left-color: var(--primary);
}
.ds-nav-item.active {
  background: var(--primary-50);
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}
.ds-nav-item svg {
  width: 17px;
  height: 17px;
  opacity: 0.6;
  flex-shrink: 0;
}
.ds-nav-item:hover svg,
.ds-nav-item.active svg {
  opacity: 1;
}

.ds-nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--error-bg);
  color: var(--error);
  min-width: 20px;
  text-align: center;
}

.ds-sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--base-200);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ds-sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.ds-sidebar-footer .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--base-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-sidebar-footer .user-role {
  font-size: 10px;
  color: var(--base-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ── 9. TOPBAR (Glass) ────────────────────────────────────── */
.ds-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--base-200);
  padding: 0 var(--space-8);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ds-topbar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--base-800);
  letter-spacing: -0.01em;
}

.ds-breadcrumb {
  font-size: 12px;
  color: var(--base-400);
}
.ds-breadcrumb a {
  color: var(--base-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.ds-breadcrumb a:hover { color: var(--primary); }
.ds-breadcrumb .sep { margin: 0 6px; }


/* ── 10. MAIN LAYOUT ──────────────────────────────────────── */
.ds-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--base-50);
}

.ds-content {
  padding: var(--space-6) var(--space-8);
  max-width: 1200px;
}


/* ── 11. TABLES ───────────────────────────────────────────── */
.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ds-table thead th {
  padding: var(--space-3) var(--space-4);
  font-size: 12px;
  font-weight: 600;
  color: var(--base-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--base-200);
  background: var(--base-50);
}

.ds-table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--base-100);
  color: var(--base-800);
}

.ds-table tbody tr {
  transition: background var(--transition-fast);
}

.ds-table tbody tr:hover {
  background: var(--base-50);
}


/* ── 12. FLASH MESSAGES ───────────────────────────────────── */
.ds-flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ds-flash-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

.ds-flash-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.ds-flash-warning {
  background: var(--warning-bg);
  color: var(--warning-dark);
  border: 1px solid var(--warning-border);
}

.ds-flash-info {
  background: var(--info-bg);
  color: var(--info-dark);
  border: 1px solid var(--info-border);
}


/* ── 13. MODAL / DRAWER ───────────────────────────────────── */
.ds-overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--transition-base);
}
.ds-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ds-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: var(--surface-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  z-index: 101;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  max-height: 90vh;
  overflow-y: auto;
}
.ds-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.ds-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 90vw;
  background: var(--surface-100);
  box-shadow: var(--shadow-modal);
  z-index: 101;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}
.ds-drawer.active {
  transform: translateX(0);
}


/* ── 14. AUTHORITY BADGE (Staff Login) ────────────────────── */
.ds-authority-badge {
  color: var(--error);
  background: rgb(220 38 38 / 0.1);
  border-radius: var(--radius-full);
  padding: 4px 14px;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  display: inline-block;
}


/* ── 15. ACCESS CODE (Applicant Login) ────────────────────── */
.ds-access-code {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
}

.ds-access-code .prefix {
  color: var(--base-400);
  font-size: 16px;
  font-weight: 500;
  user-select: none;
}

.ds-access-code input {
  width: 44px;
  height: 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--base-800);
  background: var(--base-100);
  border: 1px solid var(--base-200);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition-fast);
  text-transform: uppercase;
}

.ds-access-code input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  background: var(--surface-100);
}


/* ── 16. LOADING SPINNER ──────────────────────────────────── */
.ds-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgb(255 255 255 / 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: ds-spin 0.6s linear infinite;
}

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

.ds-spinner-dark {
  border-color: rgb(0 0 0 / 0.1);
  border-top-color: var(--primary);
}


/* ── 17. SEGMENTED CONTROL ────────────────────────────────── */
.ds-segmented {
  display: inline-flex;
  background: var(--base-100);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.ds-segmented button {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--base-500);
  transition: all var(--transition-fast);
}

.ds-segmented button.active,
.ds-segmented button:hover {
  background: var(--surface-100);
  color: var(--base-800);
  box-shadow: var(--shadow-popover);
}


/* ── 18. PROGRESS STEPS (Wizard) ──────────────────────────── */
.ds-step-indicator {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.ds-step-done {
  background: var(--success);
  color: white;
}

.ds-step-current {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px var(--primary-ring);
}

.ds-step-upcoming {
  background: transparent;
  color: var(--base-400);
  border: 2px solid var(--base-300);
}


/* ── 19. DOCUMENT GRID ────────────────────────────────────── */
.ds-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-6);
}

.ds-doc-slot {
  border: 2px dashed var(--base-200);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 140px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.ds-doc-slot:hover {
  border-color: var(--primary-light);
  background: var(--primary-50);
}

.ds-doc-slot.uploaded {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-bg);
}


/* ── 20. ACCORDION ────────────────────────────────────────── */
.ds-accordion-item {
  border: 1px solid var(--base-200);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  overflow: hidden;
  transition: box-shadow var(--transition-fast);
}

.ds-accordion-item:hover {
  box-shadow: var(--shadow-base);
}

.ds-accordion-trigger {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-100);
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--base-800);
}

.ds-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.ds-accordion-content.open {
  max-height: 1000px;
}

.ds-accordion-body {
  padding: 0 var(--space-6) var(--space-6);
}


/* ── 21. UTILITY CLASSES ──────────────────────────────────── */
.ds-text-primary  { color: var(--primary); }
.ds-text-success  { color: var(--success); }
.ds-text-warning  { color: var(--warning); }
.ds-text-error    { color: var(--error); }
.ds-text-muted    { color: var(--base-500); }

.ds-bg-page       { background: var(--base-50); }
.ds-bg-dark       { background: var(--base-900); }
.ds-bg-surface    { background: var(--surface-100); }

.ds-border-subtle { border: 1px solid var(--base-200); }
.ds-divide-subtle > * + * { border-top: 1px solid var(--base-100); }

/* Avatar palette classes (6-color rotation) */
.ds-avatar-0 { background: var(--avatar-0); }
.ds-avatar-1 { background: var(--avatar-1); }
.ds-avatar-2 { background: var(--avatar-2); }
.ds-avatar-3 { background: var(--avatar-3); }
.ds-avatar-4 { background: var(--avatar-4); }
.ds-avatar-5 { background: var(--avatar-5); }


/* ── 22. RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  /* CRITICAL: Sidebar must not intercept touches when closed.
     visibility:hidden + pointer-events:none prevent ghost taps. */
  .ds-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow), visibility 0s linear 0.3s;
    visibility: hidden;
    pointer-events: none;
    width: 280px;
    z-index: 110; /* Above overlay (100) when open */
  }
  .ds-sidebar.mobile-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform var(--transition-slow), visibility 0s linear 0s;
  }

  /* Sidebar brand — simplified on mobile */
  .ds-sidebar-brand h1 {
    font-size: 14px;
    letter-spacing: 0.04em;
  }
  .ds-sidebar-brand p {
    display: none; /* "American Place Casino" hidden on mobile — not needed */
  }

  .ds-main {
    margin-left: 0;
  }

  /* Topbar — compact, proper z-index below sidebar */
  .ds-topbar {
    padding: 0 var(--space-3);
    height: 48px;
    z-index: 40;
  }

  .ds-content {
    padding: var(--space-3);
  }

  .ds-drawer {
    width: 100%;
    top: auto;
    bottom: 0;
    height: 80vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
  }
  .ds-drawer.active {
    transform: translateY(0);
  }
}

/* ── 23. DATE/MONTH PICKER GLOBAL STYLES ────────────────── */
/* Click anywhere on date/month inputs to open calendar; icon visible in dark mode */
input[type="date"],
input[type="month"] {
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.8;
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ── 24. UTILITY CLASSES ─────────────────────────────────── */
/* Replaces Tailwind utilities used across non-Tailwind templates */
.hidden { display: none !important; }
