/* ============================================
   Kululonke Design System — "The Watch"
   ============================================
   Natural, premium, functional. Not flashy.
   Inspired by Linear, Vercel, Notion.
   ============================================
   UI Design System v2 — Aligned to SKILL.md
   ============================================ */

/* --- Fonts (Open Source Only — §3) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

/* ── Light Mode (Default — §2) ── */
:root {
  /* Surface */
  --bg-primary:       #FFFFFF;
  --bg-secondary:     #F5F6F8;
  --bg-tertiary:      #EBEDF0;
  --bg-hover:         #F0F1F3;
  --bg-active:        #E4E6EA;
  --bg-overlay:       rgba(0, 0, 0, 0.6);

  --surface:          #FFFFFF;
  --surface-raised:   #FFFFFF;
  --surface-sunken:   #F5F6F8;

  /* Legacy aliases for existing component references */
  --bg-root:          var(--bg-primary);
  --bg-app:           var(--bg-primary);
  --bg-surface:       var(--surface);
  --bg-surface-hover: var(--bg-hover);
  --bg-surface-active:var(--bg-active);
  --bg-elevated:      var(--surface-raised);
  --bg-card:          var(--surface);
  --bg-input:         var(--bg-secondary);

  /* Borders */
  --border-default:   #D8DAE0;
  --border-subtle:    #E8EAED;
  --border-strong:    #B0B3BA;
  --border-focus:     #2563EB;

  /* Text */
  --text-primary:     #1A1D23;
  --text-secondary:   #4A4F5C;
  --text-tertiary:    #8A8F9C;
  --text-muted:       #8A8F9C;
  --text-inverse:     #FFFFFF;

  /* Accent — Blue (primary action — §2) */
  --accent:           #2563EB;
  --accent-hover:     #1D4ED8;
  --accent-subtle:    #EFF6FF;
  --accent-muted:     rgba(37, 99, 235, 0.1);
  --accent-text:      #2563EB;

  /* Status colors — paired with text companions (§2) */
  --success:          #16A34A;
  --success-subtle:   #F0FDF4;
  --warning:          #D97706;
  --warning-subtle:   #FFFBEB;
  --critical:         #DC2626;
  --critical-subtle:  #FEF2F2;
  --info:             #0891B2;
  --info-subtle:      #ECFEFF;

  /* Status legacy aliases */
  --status-new:       #2563EB;
  --status-new-bg:    rgba(37, 99, 235, 0.08);
  --status-progress:  #D97706;
  --status-progress-bg: rgba(217, 119, 6, 0.08);
  --status-resolved:  #16A34A;
  --status-resolved-bg: rgba(22, 163, 74, 0.08);
  --status-closed:    #8A8F9C;
  --status-closed-bg: rgba(138, 143, 156, 0.08);
  --status-critical:  #DC2626;
  --status-critical-bg: rgba(220, 38, 38, 0.08);

  /* Severity */
  --sev-low:          #8A8F9C;
  --sev-medium:       #2563EB;
  --sev-high:         #D97706;
  --sev-critical:     #DC2626;

  /* Shadows */
  --shadow-sm:        0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:        0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg:        0 12px 32px rgba(0, 0, 0, 0.25);

  /* Layout */
  --sidebar-width: 220px;
  --header-height: 52px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Typography Scale — §3 */
  --font-sans:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --text-xs:     0.75rem;
  --text-sm:     0.875rem;
  --text-base:   1rem;
  --text-lg:     1.125rem;
  --text-xl:     1.25rem;
  --text-2xl:    1.5rem;

  /* Spacing — §7 (4px grid) */
  --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;

  /* Transitions — §4 (max 200ms, ease-out) */
  --ease: ease-out;
  --duration: 150ms;
}

/* ── Dark Mode — §2 ── */
[data-theme="dark"] {
  --bg-primary:       #0F1117;
  --bg-secondary:     #161921;
  --bg-tertiary:      #1C1F28;
  --bg-hover:         #1E2230;
  --bg-active:        #252A36;
  --bg-overlay:       rgba(0, 0, 0, 0.75);

  --surface:          #1A1D26;
  --surface-raised:   #21242F;
  --surface-sunken:   #13151C;

  --bg-root:          var(--bg-primary);
  --bg-app:           var(--bg-primary);
  --bg-surface:       var(--surface);
  --bg-surface-hover: var(--bg-hover);
  --bg-surface-active:var(--bg-active);
  --bg-elevated:      var(--surface-raised);
  --bg-card:          var(--surface);
  --bg-input:         var(--bg-secondary);

  --border-default:   #2A2E3A;
  --border-subtle:    #22252F;
  --border-strong:    #3A3F4C;
  --border-focus:     #3B82F6;

  --text-primary:     #E8EAED;
  --text-secondary:   #A0A4B0;
  --text-tertiary:    #6B7080;
  --text-muted:       #6B7080;
  --text-inverse:     #1A1D23;

  --accent:           #3B82F6;
  --accent-hover:     #60A5FA;
  --accent-subtle:    rgba(59, 130, 246, 0.1);
  --accent-muted:     rgba(59, 130, 246, 0.15);
  --accent-text:      #60A5FA;

  --success:          #22C55E;
  --success-subtle:   rgba(34, 197, 94, 0.1);
  --warning:          #F59E0B;
  --warning-subtle:   rgba(245, 158, 11, 0.1);
  --critical:         #EF4444;
  --critical-subtle:  rgba(239, 68, 68, 0.1);
  --info:             #06B6D4;
  --info-subtle:      rgba(6, 182, 212, 0.1);

  --status-new:       #3B82F6;
  --status-new-bg:    rgba(59, 130, 246, 0.12);
  --status-progress:  #F59E0B;
  --status-progress-bg: rgba(245, 158, 11, 0.12);
  --status-resolved:  #22C55E;
  --status-resolved-bg: rgba(34, 197, 94, 0.12);
  --status-closed:    #6B7080;
  --status-closed-bg: rgba(107, 112, 128, 0.12);
  --status-critical:  #EF4444;
  --status-critical-bg: rgba(239, 68, 68, 0.12);

  --sev-low:          #6B7080;
  --sev-medium:       #3B82F6;
  --sev-high:         #F59E0B;
  --sev-critical:     #EF4444;

  --shadow-sm:        0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:        0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg:        0 10px 25px rgba(0, 0, 0, 0.5);
}

/* ── Oasis Mode — §2 (Desert/Paper) ── */
[data-theme="oasis"] {
  --bg-primary:       #F0E5D1;
  --bg-secondary:     #E8DCC4;
  --bg-tertiary:      #DFCEB4;
  --bg-hover:         #E3D4BC;
  --bg-active:        #D8C4A0;
  --bg-overlay:       rgba(30, 20, 15, 0.75);

  --surface:          #F0E5D1;
  --surface-raised:   #F8EFE0;
  --surface-sunken:   #E8DCC4;

  --shadow-sm:        0 1px 2px rgba(59, 47, 47, 0.1);
  --shadow-md:        0 4px 6px rgba(59, 47, 47, 0.15);
  --shadow-lg:        0 12px 32px rgba(59, 47, 47, 0.35);

  --bg-root:          var(--bg-primary);
  --bg-app:           var(--bg-primary);
  --bg-surface:       var(--surface);
  --bg-surface-hover: var(--bg-hover);
  --bg-surface-active:var(--bg-active);
  --bg-elevated:      var(--surface-raised);
  --bg-card:          var(--surface-raised);
  --bg-input:         var(--surface-sunken);

  --border-default:   #D4C4A9;
  --border-subtle:    #E0D2BA;
  --border-strong:    #A89679;
  --border-focus:     #A15C38;

  --text-primary:     #3B2F2F;
  --text-secondary:   #594A42;
  --text-tertiary:    #78685D;
  --text-muted:       #8A7D73;
  --text-inverse:     #FFFFFF;

  --accent:           #A15C38;
  --accent-hover:     #8C4D2E;
  --accent-subtle:    #ECCEB1;
  --accent-muted:     rgba(161, 92, 56, 0.15);
  --accent-text:      #A15C38;

  --success:          #2A6B46;
  --success-subtle:   rgba(42, 107, 70, 0.12);
  --warning:          #B7791F;
  --warning-subtle:   rgba(183, 121, 31, 0.12);
  --critical:         #A82929;
  --critical-subtle:  rgba(168, 41, 41, 0.12);
  --info:             #2B6CB0;
  --info-subtle:      rgba(43, 108, 176, 0.12);

  --status-new:       #A15C38;
  --status-new-bg:    rgba(161, 92, 56, 0.15);
  --status-progress:  #B7791F;
  --status-progress-bg: rgba(183, 121, 31, 0.15);
  --status-resolved:  #2A6B46;
  --status-resolved-bg: rgba(42, 107, 70, 0.15);
  --status-closed:    #78685D;
  --status-closed-bg: rgba(120, 104, 93, 0.15);
  --status-critical:  #A82929;
  --status-critical-bg: rgba(168, 41, 41, 0.15);

  --sev-low:          #78685D;
  --sev-medium:       #A15C38;
  --sev-high:         #B7791F;
  --sev-critical:     #A82929;

  --shadow-sm:        0 1px 2px rgba(100, 90, 80, 0.2);
  --shadow-md:        0 4px 6px rgba(100, 90, 80, 0.3);
  --shadow-lg:        0 10px 25px rgba(100, 90, 80, 0.4);
}

/* ── Motion Safety — §4 (NON-NEGOTIABLE) ── */
* {
  transition-duration: var(--duration);
  transition-timing-function: var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Base Typography — §3 ── */
html {
  font-size: 16px; /* §3: Minimum body text 16px */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-root);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* --- Typography Utilities --- */
.text-xs {
  font-size: var(--text-xs);
  line-height: 1rem;
}

.text-sm {
  font-size: var(--text-sm);
  line-height: 1.25rem;
}

.text-base {
  font-size: var(--text-base);
  line-height: 1.5rem;
}

.text-lg {
  font-size: var(--text-lg);
  line-height: 1.75rem;
}

.text-xl {
  font-size: var(--text-xl);
  line-height: 1.75rem;
}

.text-2xl {
  font-size: var(--text-2xl);
  line-height: 2rem;
  font-weight: 600;
}

.text-muted {
  color: var(--text-secondary);
}

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

.text-accent {
  color: var(--accent-text);
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

/* --- Layout --- */
.app-shell {
  display: flex;
  height: 100vh;
  background: var(--bg-app);
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.sidebar-brand {
  padding: var(--space-4) var(--space-4) var(--space-3);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--text-inverse);
}

.sidebar-brand-name {
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
}

.sidebar-brand-sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-section {
  padding: var(--space-2) var(--space-2) var(--space-1);
}

.sidebar-section-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-3) var(--space-2) var(--space-1);
  font-weight: 600;
  margin-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.sidebar-section-label:first-child {
  border-top: none;
  margin-top: 0;
}

.sidebar-section-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 12px;
  background: var(--accent);
  border-radius: 1px;
  opacity: 0.5;
}

.sidebar-section-label .section-chevron {
  font-size: 0.5rem;
  transition: transform var(--duration) var(--ease);
  opacity: 0.4;
}

.sidebar-section-label:hover {
  color: var(--text-secondary);
}

.sidebar-section-label:hover .section-chevron {
  opacity: 0.8;
}

.sidebar-section-label.collapsed .section-chevron {
  transform: rotate(-90deg);
}

.nav-section-items {
  overflow: hidden;
  transition: max-height 200ms ease-out;
  max-height: 500px;
}

.nav-section-items.collapsed {
  max-height: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-1) var(--space-2);
}

/* Theme toggle button */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  min-width: 44px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration) var(--ease);
}

.theme-toggle:hover {
  background: var(--bg-hover);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 400;
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
  user-select: none;
  border: 1px solid transparent;
  min-height: 36px;
}

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

.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-item.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 500;
  border-color: var(--border-subtle);
}

.nav-item .nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent-muted);
  color: var(--accent-text);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar user footer */
.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px var(--space-1);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}

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

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--accent-text);
  flex-shrink: 0;
}

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

.user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* --- Page Header --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-app);
}

.page-title {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* --- Buttons — §5 --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  white-space: nowrap;
  line-height: 1.25rem;
  min-height: 36px;
  min-width: 44px; /* §5: touch target */
}

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

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-default);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

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

.btn-danger {
  background: var(--critical-subtle);
  color: var(--critical);
  border-color: rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.15);
}

.btn-sm {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  min-height: 32px;
  min-width: 44px;
}

.btn-icon {
  padding: 6px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

/* --- Inputs — §5 --- */
.input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-base); /* §3: 16px — prevents iOS zoom */
  outline: none;
  transition: border-color var(--duration) var(--ease);
  min-height: 40px;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

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

.input-search {
  padding-left: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8F9C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

select.input {
  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='%238A8F9C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6' /%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  cursor: pointer;
}

textarea.input {
  resize: vertical;
  min-height: 80px;
}

/* --- Page Body --- */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.page-body::-webkit-scrollbar {
  width: 6px;
}

.page-body::-webkit-scrollbar-track {
  background: transparent;
}

.page-body::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

/* --- Cards — §5 --- */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: var(--space-4) var(--space-5);
}

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: 3px;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.badge-new {
  background: var(--status-new-bg);
  color: var(--status-new);
}

.badge-progress {
  background: var(--status-progress-bg);
  color: var(--status-progress);
}

.badge-resolved {
  background: var(--status-resolved-bg);
  color: var(--status-resolved);
}

.badge-closed {
  background: var(--status-closed-bg);
  color: var(--status-closed);
}

.badge-critical {
  background: var(--status-critical-bg);
  color: var(--status-critical);
}

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

/* --- Severity indicators --- */
.sev-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sev-1 {
  background: var(--sev-low);
}

.sev-2 {
  background: var(--sev-medium);
}

.sev-3 {
  background: var(--sev-high);
}

.sev-4 {
  background: var(--sev-critical);
}

/* --- Table — §5 --- */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
}

td {
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
  min-height: 44px; /* §5: touch target */
}

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

tr:hover td {
  background: var(--bg-hover);
}

tr.clickable {
  cursor: pointer;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat-change {
  font-size: var(--text-xs);
  margin-top: var(--space-1);
}

.stat-change.up {
  color: var(--success);
}

.stat-change.down {
  color: var(--critical);
}

.stat-change.neutral {
  color: var(--text-tertiary);
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.filter-bar .input {
  max-width: 240px;
}

.filter-bar select.input {
  max-width: 160px;
}

/* --- Modal — §5 (fade only, no slide/scale) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  width: 90vw;
  max-width: 800px; /* Increased from 600px for better whitespace */
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  /* §4: fade only — no slide, no scale */
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.modal-overlay.open .modal {
  opacity: 1;
}

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

.modal-title {
  font-size: var(--text-base);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: var(--space-1);
  font-size: var(--text-lg);
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

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

/* --- Form --- */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

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

/* --- Login Screen --- */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-primary);
}

.login-card {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  width: 360px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-inverse);
  margin: 0 auto var(--space-5);
}

.login-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-8);
}

.login-profiles {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.login-profile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
  text-align: left;
}

.login-profile:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.login-profile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.login-profile .user-avatar {
  width: 36px;
  height: 36px;
  font-size: var(--text-sm);
}

.login-profile-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.login-profile-role {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-tertiary);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: var(--space-3);
  opacity: 0.4;
}

.empty-state-text {
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

/* --- Toast — §4 (fade only, no slide) --- */
.toast-container {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  /* §4: fade in only — no translateY */
  opacity: 0;
  animation: toast-fade 200ms var(--ease) forwards;
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--critical);
}

.toast.info {
  border-left: 3px solid var(--info);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

@keyframes toast-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- Detail panel (instant show/hide — §4: no sliding panels) --- */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100vh;
  background: var(--surface-raised);
  border-left: 1px solid var(--border-default);
  z-index: 50;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  /* §4: instant show/hide — no slide transition */
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}

.detail-panel.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

.detail-body::-webkit-scrollbar {
  width: 4px;
}

.detail-body::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 2px;
}

.detail-field {
  margin-bottom: var(--space-4);
}

.detail-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.detail-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

/* --- Permission denied overlay --- */
.perm-denied {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex-direction: column;
  gap: var(--space-2);
  color: var(--text-tertiary);
}

.perm-denied-icon {
  font-size: 2.5rem;
  opacity: 0.3;
  margin-bottom: var(--space-2);
}

/* --- Tab bar --- */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 var(--space-6);
  flex-shrink: 0;
}

.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
  margin-bottom: -1px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

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

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* --- Tooltip --- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}

.tooltip:hover::after {
  opacity: 1;
}

/* --- Access restricted banner --- */
.restricted-banner {
  background: var(--warning-subtle);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--warning);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Utilities */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

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

.text-center {
  text-align: center;
}

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

/* ═══ Allied Wings Heat Map ═══ */

.heatmap-floor-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.heatmap-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
  white-space: nowrap;
  min-height: 44px;
}

.heatmap-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.heatmap-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.heatmap-tab.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

.heatmap-tab-count {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.heatmap-tab.active .heatmap-tab-count {
  color: var(--accent-text);
}

.heatmap-room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}

.heatmap-room {
  border: 1px solid;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

/* §4: No translateY on hover — subtle background change only */
.heatmap-room:hover {
  box-shadow: var(--shadow-md);
}

.heatmap-room:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.heatmap-room-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: var(--text-base);
}

.heatmap-room-type {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.heatmap-room-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.heatmap-room-status {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.heatmap-room-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ═══ HR Warning Widget ═══ */

.warning-card {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  border-left: 3px solid transparent;
}

.warning-card:hover {
  background: var(--bg-hover);
}

.warning-card.status-pending {
  border-left-color: var(--warning);
}

.warning-card.status-disputed {
  border-left-color: var(--critical);
}

.warning-card.status-refused {
  border-left-color: var(--sev-high);
}

.warning-card.status-accepted {
  border-left-color: var(--status-new);
}

.warning-card.status-resolved {
  border-left-color: var(--success);
}

.warning-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.warning-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.warning-card-name:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.warning-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.warning-card-meta span {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.warning-card-reason {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  line-height: 1.4;
}

.warning-card-dispute {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--critical-subtle);
  border: 1px solid rgba(220, 38, 38, 0.15);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--critical);
}

.warning-card-actions {
  display: flex;
  gap: 6px;
  margin-top: var(--space-3);
}

/* Employee Summary Card */
.employee-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.employee-stat {
  padding: var(--space-3) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.employee-stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.employee-stat-value {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.employee-stat-value.accent {
  color: var(--accent-text);
}

.employee-stat-value.good {
  color: var(--success);
}

.employee-stat-value.warn {
  color: var(--critical);
}

/* Workflow timeline */
.workflow-timeline {
  margin-top: var(--space-4);
  padding-left: var(--space-4);
  border-left: 2px solid var(--border-subtle);
}

.workflow-event {
  position: relative;
  padding-bottom: 14px;
  padding-left: var(--space-3);
}

.workflow-event::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface-raised);
}

.workflow-event-action {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.workflow-event-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 1px;
}

.workflow-event-notes {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* HR Dashboard Section Headers */
.hr-section {
  margin-bottom: var(--space-6);
}

.hr-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.hr-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.hr-section-count {
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--accent-muted);
  color: var(--accent-text);
  padding: 1px 7px;
  border-radius: 10px;
}

/* Badge variants for warning statuses */
.badge-pending {
  background: var(--status-progress-bg);
  color: var(--status-progress);
}

.badge-disputed {
  background: var(--status-critical-bg);
  color: var(--status-critical);
}

.badge-refused {
  background: rgba(217, 119, 6, 0.12);
  color: var(--sev-high);
}

.badge-accepted {
  background: var(--status-new-bg);
  color: var(--status-new);
}

/* --- Theme toggle button --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--text-base);
  transition: background var(--duration) var(--ease);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================
   PASSWORD SETUP — Personalisation section
   ============================================ */
.setup-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-5) 0;
}

.setup-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-4) 0;
}

.setup-change-later {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
  margin-top: var(--space-4);
  font-style: italic;
}

/* ── Theme Picker (setup modal — compact) ── */
.theme-picker {
  display: flex;
  gap: var(--space-2);
}

.theme-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-2);
  background: var(--bg-secondary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}

.theme-option:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
}

.theme-option.selected {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--accent-text);
}

.theme-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-option-icon {
  font-size: 1.5rem;
}

.theme-option-label {
  font-weight: 500;
}

/* ── Accessibility Checkboxes (setup modal) ── */
.a11y-checkboxes {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.a11y-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: background var(--duration) var(--ease);
}

.a11y-check:hover {
  background: var(--bg-hover);
}

.a11y-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ============================================
   SIDEBAR — Settings cog & User menu popover
   ============================================ */
.sidebar-user {
  position: relative;
}

.sidebar-settings-cog {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 16px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
  flex-shrink: 0;
}

.sidebar-settings-cog:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar-settings-cog:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── User menu popover ── */
.user-menu-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: var(--space-1);
  z-index: 100;
  display: none;
}

.user-menu-popover.open {
  display: block;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.user-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.user-menu-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-1) 0;
}

/* ============================================
   SETTINGS PAGE — UI Settings tab
   ============================================ */
.settings-ui-container {
  max-width: 720px;
}

/* ── Theme Cards (settings page — large) ── */
.theme-picker-lg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.theme-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  color: var(--text-secondary);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  padding: 0;
}

.theme-card:hover {
  border-color: var(--border-default);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.theme-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.theme-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Mini preview inside theme cards */
.theme-card-preview {
  height: 72px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.dark-preview {
  background: #1a1a2e;
}

.light-preview {
  background: #f5f6fa;
}

.system-preview {
  background: linear-gradient(135deg, #1a1a2e 50%, #f5f6fa 50%);
}

.preview-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(128, 128, 128, 0.3);
  width: 60%;
}

.preview-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: auto;
}

.preview-line {
  height: 4px;
  border-radius: 2px;
  background: rgba(128, 128, 128, 0.25);
}

.preview-line.short {
  width: 50%;
}

.theme-card-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
}

.theme-card-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.theme-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.theme-card-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* ── Accessibility toggle rows (settings page) ── */
.settings-a11y-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.settings-toggle-row:last-child {
  border-bottom: none;
}

.settings-toggle-row:hover {
  background: transparent;
}

.settings-toggle-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.settings-toggle-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 1px;
}

.settings-toggle {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ── Tab bar for settings ── */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-4);
}

.tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

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

.tab.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ============================================
   ACCESSIBILITY DATA-ATTRIBUTE OVERRIDES
   ============================================ */

/* High contrast mode */
[data-high-contrast="true"] {
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-tertiary: #cccccc;
  --border-default: rgba(255, 255, 255, 0.4);
  --border-subtle: rgba(255, 255, 255, 0.2);
}

[data-theme="light"][data-high-contrast="true"] {
  --text-primary: #000000;
  --text-secondary: #1a1a1a;
  --text-tertiary: #333333;
  --border-default: rgba(0, 0, 0, 0.4);
  --border-subtle: rgba(0, 0, 0, 0.2);
}

[data-theme="oasis"][data-high-contrast="true"] {
  --text-primary: #000000;
  --text-secondary: #1a1a1a;
  --text-tertiary: #333333;
  --border-default: rgba(0, 0, 0, 0.8);
  --border-subtle: rgba(0, 0, 0, 0.5);
}

/* Large text mode */
[data-large-text="true"] {
  font-size: 17px;
}

/* Reduce motion override */
[data-reduce-motion="true"],
[data-reduce-motion="true"] * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}