/* ===================================================
   LeaveLink — app.css
   Dark / Light theme system via CSS custom properties
   =================================================== */

/* ── Dark theme (default) ───────────────────────────── */
html.dark {
  --bg-base:           #0c0d16;
  --bg-elevated:       #13141f;
  --bg-card:           rgba(255, 255, 255, 0.04);
  --bg-subtle:         rgba(255, 255, 255, 0.05);
  --bg-subtle-hover:   rgba(255, 255, 255, 0.08);
  --bg-sidebar:        rgba(15, 16, 26, 0.92);
  --bg-topbar:         rgba(12, 13, 22, 0.85);
  --bg-input:          rgba(255, 255, 255, 0.06);
  --bg-input-readonly: rgba(255, 255, 255, 0.04);
  --bg-modal:          #13141f;
  --bg-modal-content:  rgba(255, 255, 255, 0.05);
  --bg-modal-overlay:  rgba(0, 0, 0, 0.6);
  --text-primary:      #ffffff;
  --text-secondary:    #d1d5db;
  --text-muted:        #9ca3af;
  --text-subtle:       #6b7280;
  --text-faint:        #4b5563;
  --border:            rgba(255, 255, 255, 0.08);
  --border-strong:     rgba(255, 255, 255, 0.12);
  --border-input:      rgba(255, 255, 255, 0.12);
  --shadow-sm:         0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md:         0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.3);
  --scrollbar-thumb:   rgba(99, 102, 241, 0.4);
  --scrollbar-hover:   rgba(99, 102, 241, 0.7);
  --indigo:            #6366f1;
  --indigo-mid:        #4f46e5;
  --login-bg:          radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.18) 0%, transparent 55%),
                       radial-gradient(ellipse at 80% 70%, rgba(139, 92, 246, 0.12) 0%, transparent 55%),
                       #0c0d16;
  --gradient-bg:       linear-gradient(-45deg, #0c0d16, #111228, #151630, #0d0e1c);
  --ring-bg:           rgba(255, 255, 255, 0.08);
  --table-hover:       rgba(255, 255, 255, 0.03);
  --table-border:      rgba(255, 255, 255, 0.07);
  --table-border-row:  rgba(255, 255, 255, 0.05);
  --nav-active-bg:     rgba(255, 255, 255, 0.08);
  --nav-active-border: rgba(255, 255, 255, 0.12);
  --nav-hover-bg:      rgba(255, 255, 255, 0.06);
  --nav-icon:          #4b5563;
  --nav-icon-hover:    #d1d5db;
  --nav-icon-active:   #ffffff;
  --placeholder:       rgba(255, 255, 255, 0.3);
  --select-option-bg:  #1a1b2e;
  --btn-secondary-bg:  rgba(255, 255, 255, 0.07);
  --btn-secondary-border: rgba(255, 255, 255, 0.14);
  --btn-secondary-text: #d1d5db;
  --btn-secondary-hover-bg: rgba(255, 255, 255, 0.13);
  --btn-secondary-hover-text: #ffffff;
  --theme-toggle-bg:   rgba(255, 255, 255, 0.06);
  --theme-toggle-border: rgba(255, 255, 255, 0.1);
  --theme-toggle-hover: rgba(255, 255, 255, 0.1);
}

/* ── Light theme ────────────────────────────────────── */
html:not(.dark) {
  --bg-base:           #f1f5f9;
  --bg-elevated:       #ffffff;
  --bg-card:           #ffffff;
  --bg-subtle:         rgba(15, 23, 42, 0.04);
  --bg-subtle-hover:   rgba(15, 23, 42, 0.07);
  --bg-sidebar:        rgba(255, 255, 255, 0.96);
  --bg-topbar:         rgba(255, 255, 255, 0.92);
  --bg-input:          #ffffff;
  --bg-input-readonly: #f8fafc;
  --bg-modal:          #ffffff;
  --bg-modal-content:  #f8fafc;
  --bg-modal-overlay:  rgba(15, 23, 42, 0.45);
  --text-primary:      #0f172a;
  --text-secondary:    #334155;
  --text-muted:        #64748b;
  --text-subtle:       #94a3b8;
  --text-faint:        #cbd5e1;
  --border:            rgba(15, 23, 42, 0.08);
  --border-strong:     rgba(15, 23, 42, 0.12);
  --border-input:      rgba(15, 23, 42, 0.14);
  --shadow-sm:         0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md:         0 8px 24px rgba(15, 23, 42, 0.1);
  --shadow-card-hover: 0 8px 24px rgba(15, 23, 42, 0.12);
  --scrollbar-thumb:   rgba(99, 102, 241, 0.35);
  --scrollbar-hover:   rgba(99, 102, 241, 0.55);
  --indigo:            #6366f1;
  --indigo-mid:        #4f46e5;
  --login-bg:          radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.1) 0%, transparent 55%),
                       radial-gradient(ellipse at 80% 70%, rgba(139, 92, 246, 0.08) 0%, transparent 55%),
                       #f1f5f9;
  --gradient-bg:       linear-gradient(-45deg, #f8fafc, #f1f5f9, #e2e8f0, #f8fafc);
  --ring-bg:           rgba(15, 23, 42, 0.08);
  --table-hover:       rgba(15, 23, 42, 0.03);
  --table-border:      rgba(15, 23, 42, 0.08);
  --table-border-row:  rgba(15, 23, 42, 0.05);
  --nav-active-bg:     rgba(99, 102, 241, 0.1);
  --nav-active-border: rgba(99, 102, 241, 0.2);
  --nav-hover-bg:      rgba(15, 23, 42, 0.04);
  --nav-icon:          #94a3b8;
  --nav-icon-hover:    #475569;
  --nav-icon-active:   #4f46e5;
  --placeholder:       #94a3b8;
  --select-option-bg:  #ffffff;
  --btn-secondary-bg:  #ffffff;
  --btn-secondary-border: rgba(15, 23, 42, 0.14);
  --btn-secondary-text: #475569;
  --btn-secondary-hover-bg: #f8fafc;
  --btn-secondary-hover-text: #0f172a;
  --theme-toggle-bg:   rgba(15, 23, 42, 0.04);
  --theme-toggle-border: rgba(15, 23, 42, 0.1);
  --theme-toggle-hover: rgba(15, 23, 42, 0.07);
}

/* ── Base body ──────────────────────────────────────── */
body.theme-body {
  background: var(--bg-base);
  color: var(--text-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ── Glass surfaces ─────────────────────────────────── */
.card-glass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

html:not(.dark) .card-glass {
  box-shadow: var(--shadow-md);
}

.sidebar-glass {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
}

.topbar-glass {
  background: var(--bg-topbar);
  backdrop-filter: blur(16px);
}

/* ── Navigation links ───────────────────────────────── */
.nav-link {
  color: var(--text-muted);
  border: 1px solid transparent;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text-secondary);
  background: var(--nav-hover-bg);
}

.nav-link--active {
  background: var(--nav-active-bg);
  color: var(--text-primary);
  border-color: var(--nav-active-border);
}

html:not(.dark) .nav-link--active {
  color: var(--indigo-mid);
}

aside .nav-link__icon,
.nav-link svg {
  width: 1rem !important;
  height: 1rem !important;
  min-width: 1rem;
  max-width: 1rem;
  flex-shrink: 0;
}

.nav-link__icon {
  color: var(--nav-icon);
  transition: color 0.2s ease;
}

.nav-link:hover .nav-link__icon { color: var(--nav-icon-hover); }
.nav-link--active .nav-link__icon { color: var(--nav-icon-active); }

.nav-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  padding: 0 0.75rem;
  margin-bottom: 0.375rem;
}

/* ── Theme toggle ───────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  border: 1px solid var(--theme-toggle-border);
  background: var(--theme-toggle-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  background: var(--theme-toggle-hover);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
}

.theme-toggle [data-theme-icon] { display: none; }
html.dark .theme-toggle [data-theme-icon="light"] { display: block; }
html:not(.dark) .theme-toggle [data-theme-icon="dark"] { display: block; }

/* ── Form inputs ─────────────────────────────────────── */
.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: 0.625rem;
  color: var(--text-primary);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}

.form-input::placeholder { color: var(--placeholder); }

.form-input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

select.form-input option {
  background: var(--select-option-bg);
  color: var(--text-primary);
}

textarea.form-input { resize: vertical; min-height: 80px; }

.form-input-readonly {
  background: var(--bg-input-readonly);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  color: var(--text-muted);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  width: 100%;
  cursor: default;
  font-style: italic;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-mid) 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover  { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-border);
  color: var(--btn-secondary-text);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-secondary:hover {
  background: var(--btn-secondary-hover-bg);
  color: var(--btn-secondary-hover-text);
}

/* ── KPI / chart containers ──────────────────────────── */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  min-height: 220px;
}

/* ── Backgrounds ─────────────────────────────────────── */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-bg {
  background: var(--gradient-bg);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
}

.login-bg { background: var(--login-bg); }

/* ── Login split layout ──────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .login-shell { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
}

.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.5rem;
}

@media (min-width: 1024px) {
  .login-panel { padding: 3rem 4rem; }
}

.login-panel--brand {
  background:
    radial-gradient(ellipse at 15% 20%, rgba(99, 102, 241, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(139, 92, 246, 0.14) 0%, transparent 50%),
    linear-gradient(160deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 27, 75, 0.88) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

@media (min-width: 1024px) {
  .login-panel--brand {
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }
}

.login-panel--form {
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(12px);
}

.login-brand__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 16px 40px rgba(99, 102, 241, 0.35);
  font-weight: 800;
  font-size: 1.25rem;
  color: #fff;
}

.login-feature {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.login-feature:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.06);
}

.login-feature__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.08);
}

.login-feature__icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.login-form-card {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap .form-input {
  padding-left: 2.75rem;
}

.login-input-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.login-input-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.login-toggle-pwd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 0.5rem;
  transition: color 0.2s ease, background 0.2s ease;
}

.login-toggle-pwd:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.login-toggle-pwd svg {
  width: 1.15rem;
  height: 1.15rem;
}

.login-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.login-stat-pill svg {
  width: 0.95rem;
  height: 0.95rem;
  color: #a5b4fc;
}

html:not(.dark) .login-panel--brand {
  background:
    radial-gradient(ellipse at 15% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    linear-gradient(160deg, #eef2ff 0%, #f8fafc 55%, #f1f5f9 100%);
  border-color: var(--border);
}

html:not(.dark) .login-panel--form {
  background: var(--bg-base);
}

html:not(.dark) .login-feature {
  background: rgba(99, 102, 241, 0.04);
  border-color: var(--border);
}

html:not(.dark) .login-feature:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.2);
}

html:not(.dark) .login-stat-pill {
  background: rgba(99, 102, 241, 0.05);
  border-color: var(--border);
  color: var(--text-muted);
}

/* ── Tables ──────────────────────────────────────────── */
.data-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--table-border);
}

.data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--table-border-row);
}

.data-table tr:hover td { background: var(--table-hover); }

/* ── Progress ring ───────────────────────────────────── */
.ring-bg   { stroke: var(--ring-bg); }
.ring-fill { stroke: var(--indigo); stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }

/* ── Animations ──────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.4s ease both; }

@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 0.8; }
  50%  { transform: scale(1.05); opacity: 0.5; }
  100% { transform: scale(1); opacity: 0.8; }
}
.pulse-ring { animation: pulse-ring 2s ease-in-out infinite; }

/* ── DSS / risk colors (theme-independent semantics) ── */
.score-high     { color: #4ade80; }
.score-mid      { color: #facc15; }
.score-low      { color: #f87171; }
.ring-high      { stroke: #4ade80; }
.ring-mid       { stroke: #facc15; }
.ring-low       { stroke: #f87171; }

html:not(.dark) .score-high { color: #16a34a; }
html:not(.dark) .score-mid  { color: #ca8a04; }
html:not(.dark) .score-low  { color: #dc2626; }

/* ── Modal ───────────────────────────────────────────── */
.theme-modal-overlay {
  background: var(--bg-modal-overlay);
}

.theme-modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.theme-modal-content {
  background: var(--bg-modal-content);
  color: var(--text-secondary);
}

/* ── Flash / misc ────────────────────────────────────── */
.flash-alert { animation: fadeInUp 0.4s ease both; }

.notif-dot {
  width: 8px;
  height: 8px;
  background: #f87171;
  border-radius: 50%;
  display: inline-block;
}

/* ── Theme border utilities ──────────────────────────── */
.theme-border-b { border-bottom: 1px solid var(--border); }
.theme-border-t { border-top: 1px solid var(--border); }
.theme-border   { border: 1px solid var(--border); }

/* ── Light theme: Tailwind utility remapping ─────────── */
html:not(.dark) .text-white       { color: var(--text-primary) !important; }
html:not(.dark) .text-gray-200    { color: var(--text-secondary) !important; }
html:not(.dark) .text-gray-300    { color: var(--text-secondary) !important; }
html:not(.dark) .text-gray-400    { color: var(--text-muted) !important; }
html:not(.dark) .text-gray-500    { color: var(--text-muted) !important; }
html:not(.dark) .text-gray-600    { color: var(--text-subtle) !important; }

html:not(.dark) .hover\:text-white:hover    { color: var(--text-primary) !important; }
html:not(.dark) .hover\:text-gray-200:hover { color: var(--text-secondary) !important; }
html:not(.dark) .hover\:text-gray-300:hover { color: var(--text-secondary) !important; }

html:not(.dark) .bg-\[\#0c0d16\],
html:not(.dark) .bg-\[\#13141f\] { background-color: var(--bg-elevated) !important; }

html:not(.dark) .bg-white\/5  { background-color: var(--bg-subtle) !important; }
html:not(.dark) .bg-white\/6  { background-color: var(--bg-subtle) !important; }
html:not(.dark) .bg-white\/7  { background-color: var(--bg-subtle-hover) !important; }
html:not(.dark) .bg-white\/8  { background-color: var(--bg-subtle-hover) !important; }
html:not(.dark) .bg-white\/10 { background-color: var(--bg-subtle-hover) !important; }

html:not(.dark) .hover\:bg-white\/6:hover  { background-color: var(--bg-subtle-hover) !important; }
html:not(.dark) .hover\:bg-white\/10:hover { background-color: var(--bg-subtle-hover) !important; }
html:not(.dark) .hover\:bg-white\/20:hover { background-color: var(--bg-subtle-hover) !important; }

html:not(.dark) .border-white\/10 { border-color: var(--border) !important; }
html:not(.dark) .border-white\/12 { border-color: var(--border-strong) !important; }
html:not(.dark) .border-white\/14 { border-color: var(--border-strong) !important; }

/* Status badges — darker text on light backgrounds */
html:not(.dark) .text-green-300  { color: #15803d !important; }
html:not(.dark) .text-yellow-300 { color: #a16207 !important; }
html:not(.dark) .text-red-300    { color: #b91c1c !important; }
html:not(.dark) .text-blue-300   { color: #1d4ed8 !important; }

html:not(.dark) .bg-green-500\/15,
html:not(.dark) .bg-green-500\/20  { background-color: rgba(34, 197, 94, 0.12) !important; }
html:not(.dark) .bg-yellow-500\/20 { background-color: rgba(234, 179, 8, 0.12) !important; }
html:not(.dark) .bg-red-500\/15,
html:not(.dark) .bg-red-500\/20    { background-color: rgba(239, 68, 68, 0.1) !important; }
html:not(.dark) .bg-blue-500\/20   { background-color: rgba(59, 130, 246, 0.1) !important; }
html:not(.dark) .bg-gray-500\/20   { background-color: rgba(100, 116, 139, 0.1) !important; }

html:not(.dark) .border-green-500\/25,
html:not(.dark) .border-green-500\/30  { border-color: rgba(34, 197, 94, 0.25) !important; }
html:not(.dark) .border-yellow-500\/30 { border-color: rgba(234, 179, 8, 0.25) !important; }
html:not(.dark) .border-red-500\/25,
html:not(.dark) .border-red-500\/30    { border-color: rgba(239, 68, 68, 0.25) !important; }
html:not(.dark) .border-blue-500\/30   { border-color: rgba(59, 130, 246, 0.25) !important; }
html:not(.dark) .border-gray-500\/30   { border-color: rgba(100, 116, 139, 0.2) !important; }

html:not(.dark) .border-indigo-500\/20 { border-color: rgba(99, 102, 241, 0.2) !important; }
html:not(.dark) .bg-indigo-600\/20     { background-color: rgba(99, 102, 241, 0.08) !important; }
html:not(.dark) .from-indigo-600\/20   { --tw-gradient-from: rgba(99, 102, 241, 0.08) !important; }
html:not(.dark) .to-purple-600\/10    { --tw-gradient-to: rgba(147, 51, 234, 0.06) !important; }

html:not(.dark) .hover\:bg-red-500\/10:hover { background-color: rgba(239, 68, 68, 0.08) !important; }
html:not(.dark) .hover\:text-red-400:hover    { color: #dc2626 !important; }

html:not(.dark) .text-indigo-300  { color: #4338ca !important; }
html:not(.dark) .text-indigo-400  { color: #4f46e5 !important; }
html:not(.dark) .text-purple-300  { color: #7c3aed !important; }
html:not(.dark) .text-purple-400  { color: #7c3aed !important; }
html:not(.dark) .hover\:text-indigo-300:hover { color: #4338ca !important; }

html:not(.dark) .bg-indigo-500\/10 { background-color: rgba(99, 102, 241, 0.08) !important; }
html:not(.dark) .border-indigo-500\/30 { border-color: rgba(99, 102, 241, 0.22) !important; }

html:not(.dark) .divide-white\/10 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--border) !important;
}

html:not(.dark) code { color: var(--text-muted); }

/* Light theme — analytics accent text (was too faint) */
html:not(.dark) .text-indigo-200  { color: #3730a3 !important; }
html:not(.dark) .text-indigo-100  { color: #312e81 !important; }
html:not(.dark) .text-amber-200   { color: #92400e !important; }
html:not(.dark) .text-amber-300    { color: #b45309 !important; }
html:not(.dark) .text-emerald-200  { color: #047857 !important; }
html:not(.dark) .text-emerald-100  { color: #065f46 !important; }
html:not(.dark) .text-sky-200      { color: #0369a1 !important; }
html:not(.dark) .text-violet-100   { color: #5b21b6 !important; }
html:not(.dark) .text-red-200      { color: #b91c1c !important; }
html:not(.dark) .text-cyan-300     { color: #0e7490 !important; }
html:not(.dark) .text-rose-300     { color: #be123c !important; }
html:not(.dark) .text-green-400    { color: #16a34a !important; }
html:not(.dark) .text-yellow-400   { color: #ca8a04 !important; }
html:not(.dark) .text-red-400      { color: #dc2626 !important; }

html:not(.dark) .text-indigo-300\/80,
html:not(.dark) .text-amber-300\/80,
html:not(.dark) .text-cyan-300\/80,
html:not(.dark) .text-rose-300\/80 {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

html:not(.dark) .bg-white\/\[0\.03\],
html:not(.dark) .bg-white\/\[0\.02\] {
  background-color: #f8fafc !important;
  border-color: var(--border) !important;
}

html:not(.dark) .bg-indigo-500\/15 { background-color: rgba(99, 102, 241, 0.1) !important; }
html:not(.dark) .bg-amber-500\/10  { background-color: rgba(245, 158, 11, 0.12) !important; }
html:not(.dark) .bg-emerald-500\/10 { background-color: rgba(16, 185, 129, 0.1) !important; }
html:not(.dark) .bg-sky-500\/10    { background-color: rgba(14, 165, 233, 0.1) !important; }
html:not(.dark) .bg-violet-500\/10  { background-color: rgba(139, 92, 246, 0.1) !important; }
html:not(.dark) .bg-green-500\/15   { background-color: rgba(34, 197, 94, 0.1) !important; }
html:not(.dark) .bg-red-500\/15     { background-color: rgba(239, 68, 68, 0.1) !important; }

html:not(.dark) .border-indigo-400\/40 { border-color: rgba(79, 70, 229, 0.35) !important; }
html:not(.dark) .border-amber-400\/30  { border-color: rgba(217, 119, 6, 0.35) !important; }
html:not(.dark) .border-emerald-400\/20 { border-color: rgba(5, 150, 105, 0.3) !important; }
html:not(.dark) .border-sky-400\/20     { border-color: rgba(2, 132, 199, 0.3) !important; }
html:not(.dark) .border-violet-400\/20  { border-color: rgba(124, 58, 237, 0.3) !important; }
html:not(.dark) .border-red-400\/30    { border-color: rgba(220, 38, 38, 0.3) !important; }
html:not(.dark) .border-emerald-400\/30 { border-color: rgba(5, 150, 105, 0.3) !important; }

html:not(.dark) .hover\:bg-indigo-500\/25:hover { background-color: rgba(99, 102, 241, 0.16) !important; }
html:not(.dark) .hover\:bg-amber-500\/20:hover  { background-color: rgba(245, 158, 11, 0.16) !important; }
html:not(.dark) .hover\:bg-indigo-500\/20:hover { background-color: rgba(99, 102, 241, 0.14) !important; }

html:not(.dark) .theme-modal {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14) !important;
}

html:not(.dark) .theme-modal-overlay {
  background: rgba(15, 23, 42, 0.45) !important;
}

/* ── Theme typography helpers ───────────────────────── */
.theme-heading { color: var(--text-primary); font-weight: 600; }
.theme-body    { color: var(--text-secondary); }
.theme-muted   { color: var(--text-muted); }
.theme-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Analytics panels & buttons ─────────────────────── */
.ui-panel {
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 1.25rem;
}

.ui-panel--compact {
  padding: 0.875rem 1rem;
}

.insight-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #c7d2fe;
}

html:not(.dark) .insight-chip {
  color: #3730a3;
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(79, 70, 229, 0.28);
}

.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
  cursor: pointer;
}

.ai-btn:hover:not(:disabled) { transform: translateY(-1px); }
.ai-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.ai-btn--primary {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.14);
  color: #c7d2fe;
}

.ai-btn--ghost {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.ai-btn--warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.14);
  color: #fde68a;
}

html:not(.dark) .ai-btn--primary { color: #312e81; background: rgba(99, 102, 241, 0.12); }
html:not(.dark) .ai-btn--primary:hover:not(:disabled) { background: rgba(99, 102, 241, 0.18); color: #1e1b4b; }
html:not(.dark) .ai-btn--ghost   { color: #334155; background: #ffffff; }
html:not(.dark) .ai-btn--ghost:hover:not(:disabled) { background: #f8fafc; color: #0f172a; }
html:not(.dark) .ai-btn--warn    { color: #92400e; background: rgba(245, 158, 11, 0.12); }
html:not(.dark) .ai-btn--warn:hover:not(:disabled) { background: rgba(245, 158, 11, 0.18); color: #78350f; }

.ai-status-box {
  border-radius: 0.875rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 0.875rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.ai-modal__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ai-modal__title   { color: var(--text-primary); }
.ai-modal__subtitle,
.ai-modal__meta    { color: var(--text-muted); }
.ai-modal__content { color: var(--text-secondary); }

.ai-badge {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.ai-badge--neutral  { border-color: var(--border-strong); background: var(--bg-subtle); color: var(--text-secondary); }
.ai-badge--info     { border-color: rgba(99, 102, 241, 0.3); background: rgba(99, 102, 241, 0.12); color: #c7d2fe; }
.ai-badge--high,
.ai-badge--fail     { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.12); color: #fca5a5; }
.ai-badge--moderate,
.ai-badge--warn     { border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.12); color: #fde68a; }
.ai-badge--low,
.ai-badge--pass     { border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.12); color: #86efac; }

html:not(.dark) .ai-badge--info     { color: #3730a3; }
html:not(.dark) .ai-badge--high,
html:not(.dark) .ai-badge--fail     { color: #b91c1c; }
html:not(.dark) .ai-badge--moderate,
html:not(.dark) .ai-badge--warn     { color: #92400e; }
html:not(.dark) .ai-badge--low,
html:not(.dark) .ai-badge--pass     { color: #15803d; }

.ai-status-card {
  border-radius: 0.875rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 1rem;
}

.ai-status-card--pass { border-color: rgba(34, 197, 94, 0.28); background: rgba(34, 197, 94, 0.08); }
.ai-status-card--warn { border-color: rgba(245, 158, 11, 0.28); background: rgba(245, 158, 11, 0.08); }
.ai-status-card--fail { border-color: rgba(239, 68, 68, 0.28); background: rgba(239, 68, 68, 0.08); }

html:not(.dark) .ai-status-card--pass { background: rgba(34, 197, 94, 0.06); }
html:not(.dark) .ai-status-card--warn { background: rgba(245, 158, 11, 0.06); }
html:not(.dark) .ai-status-card--fail { background: rgba(239, 68, 68, 0.06); }

.method-card {
  border-radius: 0.875rem;
  padding: 1rem;
  border: 1px solid var(--border);
}

.method-card--indigo  { border-color: rgba(99, 102, 241, 0.28); background: rgba(99, 102, 241, 0.1); }
.method-card--violet  { border-color: rgba(139, 92, 246, 0.28); background: rgba(139, 92, 246, 0.1); }
.method-card--emerald { border-color: rgba(16, 185, 129, 0.28); background: rgba(16, 185, 129, 0.1); }

.method-card__title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.method-card__body  { margin-top: 0.5rem; font-size: 0.75rem; line-height: 1.45; color: var(--text-secondary); }
.method-card__stat  { margin-top: 0.75rem; font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }

.peak-chip--high { border: 1px solid rgba(16, 185, 129, 0.28); background: rgba(16, 185, 129, 0.1); color: #6ee7b7; padding: 0.75rem; border-radius: 0.75rem; font-size: 0.75rem; }
.peak-chip--low  { border: 1px solid rgba(14, 165, 233, 0.28); background: rgba(14, 165, 233, 0.1); color: #7dd3fc; padding: 0.75rem; border-radius: 0.75rem; font-size: 0.75rem; }

html:not(.dark) .peak-chip--high { color: #047857; }
html:not(.dark) .peak-chip--low  { color: #0369a1; }

.progress-track {
  height: 0.375rem;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--bg-subtle-hover);
}

.score-tone--pass { color: #86efac; font-weight: 600; }
.score-tone--warn { color: #fde68a; font-weight: 600; }
.score-tone--fail { color: #fca5a5; font-weight: 600; }

html:not(.dark) .score-tone--pass { color: #15803d; }
html:not(.dark) .score-tone--warn { color: #a16207; }
html:not(.dark) .score-tone--fail { color: #b91c1c; }

.advisory-banner {
  border-radius: 0.875rem;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.08);
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #fde68a;
}

html:not(.dark) .advisory-banner { color: #92400e; }

.method-card--amber { border-color: rgba(245, 158, 11, 0.28); background: rgba(245, 158, 11, 0.1); }
.method-card--sky    { border-color: rgba(14, 165, 233, 0.28); background: rgba(14, 165, 233, 0.1); }

/* ── Page shell & layout ─────────────────────────────── */
.page-shell {
  width: 100%;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .page-shell { padding: 1.5rem 1.5rem 2rem; }
}

@media (min-width: 1280px) {
  .page-shell { padding: 1.5rem 2rem 2.5rem; }
}

.page-shell--narrow {
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.page-header__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.page-header__subtitle {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 42rem;
}

.page-header__actions,
.page-header__badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* ── User avatar & cell ──────────────────────────────── */
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #818cf8 0%, #a855f7 100%);
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--border-strong);
}

.user-avatar--xs { width: 1.75rem; height: 1.75rem; font-size: 0.625rem; }
.user-avatar--sm { width: 2rem; height: 2rem; font-size: 0.6875rem; }
.user-avatar--md { width: 2.5rem; height: 2.5rem; font-size: 0.75rem; }
.user-avatar--lg { width: 3rem; height: 3rem; font-size: 0.875rem; }

.user-avatar--danger {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.user-avatar--neutral {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.user-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.user-cell__body { min-width: 0; }

.user-cell__name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-cell__subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Stat widgets ────────────────────────────────────── */
.stat-widget {
  width: 100%;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-widget:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.stat-widget__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-widget__value {
  margin-top: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-widget__hint {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.stat-widget--indigo .stat-widget__label { color: #818cf8; }
.stat-widget--cyan .stat-widget__label { color: #22d3ee; }
.stat-widget--rose .stat-widget__label { color: #fb7185; }
.stat-widget--amber .stat-widget__label { color: #fbbf24; }
.stat-widget--green .stat-widget__label { color: #4ade80; }

html:not(.dark) .stat-widget--indigo .stat-widget__label { color: #4f46e5; }
html:not(.dark) .stat-widget--cyan .stat-widget__label { color: #0891b2; }
html:not(.dark) .stat-widget--rose .stat-widget__label { color: #e11d48; }
html:not(.dark) .stat-widget--amber .stat-widget__label { color: #d97706; }
html:not(.dark) .stat-widget--green .stat-widget__label { color: #16a34a; }

/* ── Empty state ─────────────────────────────────────── */
.empty-state {
  width: 100%;
  border-radius: 1rem;
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.empty-state__icon {
  font-size: 2.75rem;
  line-height: 1;
  margin-bottom: 1rem;
}

.empty-state__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state__message {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

/* ── Alerts ──────────────────────────────────────────── */
.ui-alert {
  width: 100%;
  border-radius: 0.875rem;
  padding: 1rem 1.125rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.ui-alert--success { background: rgba(34, 197, 94, 0.12); border: 1px solid rgba(34, 197, 94, 0.25); color: #86efac; }
.ui-alert--error   { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.25); color: #fca5a5; }
.ui-alert--warning { background: rgba(234, 179, 8, 0.12); border: 1px solid rgba(234, 179, 8, 0.25); color: #fde047; }
.ui-alert--info    { background: rgba(99, 102, 241, 0.12); border: 1px solid rgba(99, 102, 241, 0.25); color: #c7d2fe; }

html:not(.dark) .ui-alert--success { color: #15803d; }
html:not(.dark) .ui-alert--error   { color: #b91c1c; }
html:not(.dark) .ui-alert--warning { color: #a16207; }
html:not(.dark) .ui-alert--info    { color: #4338ca; }

/* ── Filter card ─────────────────────────────────────── */
.filter-card {
  width: 100%;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
}

.filter-card__label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ── Table card ──────────────────────────────────────── */
.table-card {
  width: 100%;
  border-radius: 1rem;
  overflow: hidden;
}

.table-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.table-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.table-card__subtitle {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.table-card__body .data-table { width: 100%; }

.table-card__footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover td {
  background: var(--table-hover);
}

/* ── Stage badges ────────────────────────────────────── */
.stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.stage-badge--success { background: rgba(34, 197, 94, 0.15); color: #86efac; border-color: rgba(34, 197, 94, 0.25); }
.stage-badge--danger  { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.25); }
.stage-badge--warning { background: rgba(234, 179, 8, 0.15); color: #fde047; border-color: rgba(234, 179, 8, 0.25); }
.stage-badge--info    { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border-color: rgba(59, 130, 246, 0.25); }
.stage-badge--purple  { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.25); }
.stage-badge--default { background: var(--bg-subtle); color: var(--text-muted); border-color: var(--border); }

html:not(.dark) .stage-badge--success { color: #15803d; }
html:not(.dark) .stage-badge--danger  { color: #b91c1c; }
html:not(.dark) .stage-badge--warning { color: #a16207; }
html:not(.dark) .stage-badge--info    { color: #1d4ed8; }
html:not(.dark) .stage-badge--purple  { color: #7e22ce; }

/* ── Approval cards ──────────────────────────────────── */
.approval-card {
  width: 100%;
  border-radius: 1rem;
  padding: 1.25rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.approval-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.approval-card__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.approval-metric {
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.approval-metric__label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.approval-metric__value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Form sections ───────────────────────────────────── */
.form-section {
  width: 100%;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.form-section__title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.profile-banner {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
}

html:not(.dark) .profile-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(255, 255, 255, 0.95) 100%);
}

/* ── Profile page ────────────────────────────────────── */
.profile-avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.profile-avatar-card__preview-wrap {
  position: relative;
  width: 6rem;
  height: 6rem;
}

.profile-avatar-card__preview-wrap .user-avatar--lg {
  width: 6rem;
  height: 6rem;
  font-size: 1.25rem;
}

.profile-avatar-card__preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  object-fit: cover;
  border: 2px solid rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.profile-avatar-card__filename {
  font-size: 0.75rem;
  text-align: center;
  word-break: break-all;
}

.profile-avatar-card__filename--error {
  color: #f87171;
}

.leave-form-screen-only {
  display: block;
}

@media print {
  .leave-form-screen-only {
    display: none !important;
  }
}

/* ── Pagination bar ──────────────────────────────────── */
.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.pagination-bar__info {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pagination-bar__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pagination-bar__links a,
.pagination-bar__links span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.pagination-bar__links a {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.pagination-bar__links a:hover {
  background: var(--bg-subtle-hover);
  color: var(--text-primary);
}

.pagination-bar__links span.is-active {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  font-weight: 600;
}

html:not(.dark) .pagination-bar__links span.is-active {
  color: #4338ca;
}

/* ── Signature capture modal ───────────────────────── */
.signature-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.signature-modal.hidden {
  display: none;
}

.signature-modal__panel {
  width: 100%;
  max-width: 28rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
}

.signature-modal__header {
  margin-bottom: 1.25rem;
}

.signature-modal__title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.signature-modal__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.signature-modal__subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

.signature-modal__section {
  margin-bottom: 1rem;
}

.signature-modal__section--upload {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.signature-modal__section-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.signature-modal__pad-wrap {
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 2px solid #94a3b8;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.08);
}

.signature-modal__canvas {
  display: block;
  width: 100%;
  height: 10rem;
  border-radius: 0.5rem;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  cursor: crosshair;
  touch-action: none;
}

.signature-modal__pad-hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
  text-align: center;
}

.signature-modal__file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--btn-secondary-bg);
  border: 1px solid var(--btn-secondary-border);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.signature-modal__file-label:hover {
  background: var(--btn-secondary-hover-bg);
  color: var(--btn-secondary-hover-text);
  border-color: var(--border-strong);
}

.signature-modal__file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.signature-modal__upload-status {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.signature-modal__upload-status.is-loaded {
  color: #16a34a;
  font-weight: 500;
}

.signature-modal__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.signature-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.signature-modal__btn--action {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  border-radius: 0.75rem;
}

.signature-modal__btn--full {
  flex: 1 1 100%;
  width: 100%;
}

.signature-modal__btn--save {
  color: #fff;
}

.signature-modal__btn--link {
  margin-top: 0.5rem;
}

.signature-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.signature-modal__status {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.signature-modal__status.is-signed {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #16a34a;
  font-weight: 600;
}

.signature-modal__icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--indigo);
}

.signature-modal__icon--sm {
  width: 1rem;
  height: 1rem;
  color: currentColor;
}

html:not(.dark) .signature-modal__pad-wrap {
  background: #ffffff;
  border-color: #64748b;
}

html:not(.dark) .signature-modal__canvas {
  border-color: #94a3b8;
}

/* ── Timeline modal ──────────────────────────────────── */
.timeline-modal-panel {
  width: 100%;
  max-width: 36rem;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 1.25rem;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transform-origin: center center;
  overflow: hidden;
}

.timeline-modal-panel__body {
  overflow-y: auto;
  flex: 1;
}

.timeline-modal-panel__footer {
  background: var(--bg-subtle);
}

#timelineModal.is-open {
  animation: timelineOverlayIn 0.3s ease forwards;
}

#timelineModal.is-closing {
  animation: timelineOverlayOut 0.22s ease forwards;
}

@keyframes timelineOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes timelineOverlayOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

#timelineModal.is-open .timeline-modal-panel {
  animation: timelineModalIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#timelineModal.is-closing .timeline-modal-panel {
  animation: timelineModalOut 0.22s ease forwards;
}

@keyframes timelineModalIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes timelineModalOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.96) translateY(8px); }
}

.timeline-modal__title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-modal__title-row .ui-icon {
  color: var(--indigo);
}

/* Leave progress step timeline */
.lp-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.lp-banner--ended {
  border: 1px solid rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

.lp-banner--info {
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: rgba(99, 102, 241, 0.1);
  color: #c7d2fe;
}

html:not(.dark) .lp-banner--ended { color: #b91c1c; }
html:not(.dark) .lp-banner--info { color: #3730a3; }

.lp-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lp-step {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  gap: 0.85rem;
  opacity: 0;
  animation: lpStepIn 0.42s ease forwards;
}

@keyframes lpStepIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lp-step__rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lp-step__icon {
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 9999px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  color: var(--text-muted);
  flex-shrink: 0;
}

.lp-step__svg {
  width: 1.1rem;
  height: 1.1rem;
}

.lp-step__line {
  width: 2px;
  flex: 1;
  min-height: 1rem;
  margin-top: 0.35rem;
  background: var(--border);
}

.lp-step__card {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.95rem 1rem;
  background: var(--bg-subtle);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lp-step__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.lp-step__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.lp-step__role {
  margin-top: 0.15rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.lp-step__desc {
  margin-top: 0.55rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.lp-step__date {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.lp-step__date--muted {
  font-style: italic;
}

.lp-step__date-icon {
  display: inline-flex;
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.75;
}

.lp-step__date-icon .lp-step__svg {
  width: 0.9rem;
  height: 0.9rem;
}

.lp-step__reason {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
}

.lp-step__reason-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fca5a5;
}

.lp-step__reason-text {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

html:not(.dark) .lp-step__reason-label { color: #b91c1c; }

.lp-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.lp-badge--completed {
  color: var(--text-muted);
  background: var(--bg-elevated, var(--bg-subtle));
  border-color: var(--border);
}

.lp-badge--current {
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.45);
}

.lp-badge--pending {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.12);
  border-color: var(--border);
}

.lp-badge--disapproved {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.35);
}

.lp-badge--cancelled {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--border);
  text-decoration: line-through;
  text-decoration-color: rgba(148, 163, 184, 0.55);
}

html:not(.dark) .lp-badge--current { color: #3730a3; }
html:not(.dark) .lp-badge--disapproved { color: #b91c1c; }

.lp-step--completed .lp-step__icon {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
}

.lp-step--completed .lp-step__card {
  opacity: 0.92;
}

.lp-step--current .lp-step__icon {
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.18);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.lp-step--current .lp-step__card {
  border-color: rgba(99, 102, 241, 0.45);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(99, 102, 241, 0.06));
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}

html:not(.dark) .lp-step--current .lp-step__icon { color: #4338ca; }
html:not(.dark) .lp-step--completed .lp-step__icon { color: #15803d; }

.lp-step--pending .lp-step__icon,
.lp-step--cancelled .lp-step__icon {
  opacity: 0.65;
}

.lp-step--pending .lp-step__card,
.lp-step--cancelled .lp-step__card {
  opacity: 0.72;
}

.lp-step--disapproved .lp-step__icon {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.14);
}

.lp-step--disapproved .lp-step__card {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

html:not(.dark) .lp-step--disapproved .lp-step__icon { color: #b91c1c; }

.lp-step--completed .lp-step__line {
  background: rgba(34, 197, 94, 0.35);
}

.lp-step--disapproved .lp-step__line,
.lp-step--cancelled .lp-step__line {
  background: rgba(148, 163, 184, 0.35);
}

/* ── UI icons & section headings ───────────────────── */
.ui-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}
.ui-icon--xs { width: 0.875rem; height: 0.875rem; }
.ui-icon--sm { width: 1rem; height: 1rem; }
.ui-icon--md { width: 1.25rem; height: 1.25rem; }
.ui-icon--lg { width: 1.5rem; height: 1.5rem; }
.ui-icon--xl { width: 2rem; height: 2rem; }

.section-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.section-heading__icon { color: var(--indigo); flex-shrink: 0; }

.kpi-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-icon--indigo { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.kpi-icon--yellow { background: rgba(234, 179, 8, 0.15); color: #facc15; }
.kpi-icon--green  { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.kpi-icon--red    { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.kpi-icon--blue   { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.kpi-icon--teal   { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.kpi-icon--purple { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

html:not(.dark) .kpi-icon--indigo { color: #4f46e5; }
html:not(.dark) .kpi-icon--yellow { color: #ca8a04; }
html:not(.dark) .kpi-icon--green  { color: #16a34a; }
html:not(.dark) .kpi-icon--red    { color: #dc2626; }
html:not(.dark) .kpi-icon--blue   { color: #2563eb; }
html:not(.dark) .kpi-icon--teal   { color: #0d9488; }
html:not(.dark) .kpi-icon--purple { color: #9333ea; }

.quick-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.quick-action--indigo { background: rgba(99,102,241,0.12); border-color: rgba(99,102,241,0.3); color: #a5b4fc; }
.quick-action--purple { background: rgba(168,85,247,0.12); border-color: rgba(168,85,247,0.3); color: #d8b4fe; }
.quick-action--yellow { background: rgba(234,179,8,0.12); border-color: rgba(234,179,8,0.3); color: #fde047; }
.quick-action--blue   { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); color: #93c5fd; }
.quick-action--red    { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.quick-action--green  { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); color: #86efac; }
.quick-action--teal   { background: rgba(20,184,166,0.12); border-color: rgba(20,184,166,0.3); color: #5eead4; }
html:not(.dark) .quick-action--indigo { color: #4338ca; }
html:not(.dark) .quick-action--purple { color: #7e22ce; }
html:not(.dark) .quick-action--yellow { color: #a16207; }
html:not(.dark) .quick-action--blue   { color: #1d4ed8; }
html:not(.dark) .quick-action--red    { color: #b91c1c; }
html:not(.dark) .quick-action--green  { color: #15803d; }
html:not(.dark) .quick-action--teal   { color: #0f766e; }

.empty-state__icon .ui-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--indigo);
}

.page-title-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* DSS score ring — theme-aware */
.dss-score-ring__track { stroke: rgba(255,255,255,0.08); }
.dss-score-ring__value { fill: var(--text-primary); }
.dss-score-ring__label { fill: var(--text-muted); }
html:not(.dark) .dss-score-ring__track { stroke: rgba(15,23,42,0.1); }

.dss-mini-ring__track { stroke: rgba(255,255,255,0.08); }
.dss-mini-ring__value { fill: var(--text-primary); }
html:not(.dark) .dss-mini-ring__track { stroke: rgba(15,23,42,0.1); }

.insight-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid;
}
.insight-pill--success { background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.25); color: #86efac; }
.insight-pill--warning { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.25); color: #fca5a5; }
.insight-pill--neutral { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: var(--text-muted); }
html:not(.dark) .insight-pill--success { color: #15803d; }
html:not(.dark) .insight-pill--warning { color: #b91c1c; }

.approval-chain-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
}

/* ── Forecast analytics page ─────────────────────────── */
.forecast-chart-card {
  position: relative;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.forecast-chart-card:hover {
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.08);
}

html:not(.dark) .forecast-chart-card:hover {
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.12);
}

.forecast-chart-card--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(1px);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.2s ease;
  z-index: 2;
}

html:not(.dark) .forecast-chart-card--loading::after {
  background: rgba(255, 255, 255, 0.55);
}

.forecast-chart-card__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  min-height: 2rem;
}

.forecast-breadcrumb {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.forecast-chart-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.forecast-chart-back:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--text-primary);
  transform: translateX(-2px);
}

.forecast-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.forecast-view-toggle button {
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.forecast-view-toggle button.is-active {
  background: rgba(99, 102, 241, 0.18);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.15);
}

.forecast-chart-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  transition: opacity 0.2s ease;
}

.forecast-chart-wrapper {
  height: 14rem;
  position: relative;
  transition: opacity 0.3s ease;
}

.forecast-chart-card--loading .forecast-chart-wrapper {
  opacity: 0.65;
}

/* Lightweight, GPU-composited "latest data point" pulse — CSS-only, no
   canvas redraws, so it never fights Chart.js's own render/interaction loop. */
.forecast-pulse-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--pulse-color, #6366f1);
  pointer-events: none;
  z-index: 2;
  will-change: transform;
}

.forecast-pulse-dot::before,
.forecast-pulse-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--pulse-color, #6366f1);
  animation: forecastPulseRing 2.6s cubic-bezier(0.16, 0.6, 0.4, 1) infinite;
  will-change: transform, opacity;
}

.forecast-pulse-dot::after {
  animation-delay: 1.3s;
}

@keyframes forecastPulseRing {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(3.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .forecast-pulse-dot::before,
  .forecast-pulse-dot::after {
    animation: none;
    opacity: 0;
  }
}

.forecast-ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Forecast insight modal */
.forecast-insight-modal {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.forecast-insight-modal.is-open {
  opacity: 1;
}

.forecast-insight-modal__panel {
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.forecast-insight-modal.is-open .forecast-insight-modal__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.forecast-insight-modal.is-closing .forecast-insight-modal__panel {
  transform: translateY(8px) scale(0.99);
  opacity: 0;
}

.forecast-insight-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.forecast-insight-modal__title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.forecast-insight-modal__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.forecast-insight-modal__title {
  margin-top: 0.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.forecast-insight-modal__subtitle {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.forecast-insight-modal__close {
  flex-shrink: 0;
  transition: transform 0.15s ease, background 0.2s ease;
}

.forecast-insight-modal__close:hover {
  transform: scale(1.03);
}

.forecast-insight-modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.forecast-insight-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-elevated, var(--bg-subtle));
}

.forecast-insight-meta-pill--warn {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
  background: rgba(245, 158, 11, 0.1);
}

html:not(.dark) .forecast-insight-meta-pill--warn {
  color: #92400e;
}

.forecast-insight-modal__content {
  max-height: min(60vh, 32rem);
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.forecast-insight-section {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--bg-subtle);
  padding: 1rem 1.125rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.forecast-insight-section:hover {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.06);
}

.forecast-insight-section__head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.forecast-insight-section__index {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}

html:not(.dark) .forecast-insight-section__index {
  color: #3730a3;
  background: rgba(99, 102, 241, 0.12);
}

.forecast-insight-section__eyebrow {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.forecast-insight-section__title {
  margin-top: 0.15rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.forecast-insight-section__body {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.forecast-insight-text {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 0;
}

.forecast-insight-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.forecast-insight-list-item {
  position: relative;
  padding-left: 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.forecast-insight-list-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: #6366f1;
  opacity: 0.85;
}

.forecast-insight-empty {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
}

.status-display-icon .ui-icon {
  width: 2.5rem;
  height: 2.5rem;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* ── Consolidated anomaly AI explanation ─────────────────── */
.ai-trigger__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: 0.75rem;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.32);
}

.ai-trigger__icon .ui-icon {
  width: 1.35rem;
  height: 1.35rem;
}

html:not(.dark) .ai-trigger__icon {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.1);
}

.ai-modal__footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.anomaly-ai-spinner {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  animation: anomaly-ai-spin 0.7s linear infinite;
}

@keyframes anomaly-ai-spin {
  to { transform: rotate(360deg); }
}

.anomaly-ai-card {
  padding: 0;
  overflow: hidden;
}

.anomaly-ai-card__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.125rem;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease;
}

.anomaly-ai-card__head:hover {
  background: rgba(99, 102, 241, 0.05);
}

.anomaly-ai-card__titles {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.anomaly-ai-card__chevron {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.22s ease;
}

.anomaly-ai-card.is-collapsed .anomaly-ai-card__chevron {
  transform: rotate(-90deg);
}

.anomaly-ai-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 0 1.125rem 1.125rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.anomaly-ai-card.is-collapsed .anomaly-ai-card__body {
  display: none;
}

.anomaly-ai-block__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #818cf8;
  margin-bottom: 0.3rem;
}

html:not(.dark) .anomaly-ai-block__label {
  color: #4f46e5;
}

.anomaly-ai-overall {
  border: 1px solid rgba(99, 102, 241, 0.32);
  border-radius: 1rem;
  padding: 1.125rem 1.25rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.08));
}

.anomaly-ai-overall__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.anomaly-ai-overall .forecast-insight-text {
  color: var(--text-primary);
}

/* ── Leave comparison modal (approval process) ───────────── */
.leave-compare-modal {
  opacity: 0;
  transition: opacity 0.22s ease;
}

.leave-compare-modal.is-open { opacity: 1; }
.leave-compare-modal.is-closing { opacity: 0; }

.leave-compare-modal__panel {
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
  max-height: min(92vh, 52rem);
  display: flex;
  flex-direction: column;
}

.leave-compare-modal.is-open .leave-compare-modal__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.leave-compare-modal.is-closing .leave-compare-modal__panel {
  transform: translateY(8px) scale(0.99);
  opacity: 0;
}

.leave-compare-modal__content {
  overflow-y: auto;
  flex: 1;
}

.leave-compare-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .leave-compare-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.leave-compare-stat {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-subtle);
}

.leave-compare-stat__label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.leave-compare-stat__value {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.leave-compare-warning {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
  font-size: 0.8125rem;
  line-height: 1.55;
}

html:not(.dark) .leave-compare-warning { color: #92400e; }

.leave-compare-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.75rem;
}

.leave-compare-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.1rem, 1fr));
  gap: 0.45rem;
}

.leave-compare-calendar__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 4.4rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 0.35rem;
}

.leave-compare-calendar__day.is-busy {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}

.leave-compare-calendar__day.is-empty { opacity: 0.55; }

.leave-compare-calendar__weekday {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.leave-compare-calendar__date {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.leave-compare-calendar__count {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.leave-compare-row--current { background: rgba(99, 102, 241, 0.08); }
.leave-compare-row--exact { background: rgba(239, 68, 68, 0.08); }
.leave-compare-row--overlap { background: rgba(245, 158, 11, 0.06); }

.leave-compare-view-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: #a5b4fc;
}

html:not(.dark) .leave-compare-view-btn { color: #4338ca; }

.leave-compare-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.leave-compare-chain-item {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-subtle);
}

.leave-compare-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

/* ── Staffing review (approval process) ─ */
.staffing-review-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .staffing-review-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.staffing-review-summary__item {
  padding: 0.8rem 0.9rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.staffing-review-summary__label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.staffing-review-summary__value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.staffing-review-message {
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.55;
}

.staffing-review-message--warning {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.1);
  color: #fde68a;
}

.staffing-review-message--ok {
  border: 1px solid rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.08);
  color: #bbf7d0;
}

html:not(.dark) .staffing-review-message--warning { color: #92400e; }
html:not(.dark) .staffing-review-message--ok { color: #166534; }

.staffing-review-message__title { margin-bottom: 0.2rem; }

.staffing-review-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.staffing-review-card--current {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.07);
}

.staffing-review-card--exact {
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.18);
}

.staffing-review-card__main {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.staffing-review-card__avatar { flex-shrink: 0; }

.staffing-review-card__identity { min-width: 0; flex: 1; }

.staffing-review-card__name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.2rem;
}

.staffing-review-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.staffing-review-card__tag {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: #a5b4fc;
}

.staffing-review-card__status {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.staffing-review-card__status--approved {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.25);
}

.staffing-review-card__status--pending {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.25);
}

.staffing-review-card__status--review {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}

.staffing-review-card__meta,
.staffing-review-card__position {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.staffing-review-card__position { margin-top: 0.15rem; }

.staffing-review-card__details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .staffing-review-card__details { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.staffing-review-card__label {
  display: block;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

#staffingReviewPanel.is-refreshing {
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

/* ── Approval process page layout ─ */
.approval-process {
  scroll-behavior: smooth;
}

.approval-process__dss-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.approval-process__hero-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .approval-process__hero-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
  }
}

.approval-process__hero-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.approval-process__hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.approval-process__metric {
  flex: 1 1 7rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.approval-process__metric-label {
  display: block;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.approval-process__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.approval-process__nav-link {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.approval-process__nav-link:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
}

.approval-process__layout {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 1280px) {
  .approval-process__layout {
    grid-template-columns: minmax(0, 1fr) 21.5rem;
  }

  .approval-process__main { order: 1; }
  .approval-process__sidebar--actions {
    order: 2;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
}

@media (max-width: 1279px) {
  .approval-process__sidebar--actions { order: -1; }
}

.approval-process-collapsible__summary::-webkit-details-marker { display: none; }

.approval-insight-factor__summary::-webkit-details-marker { display: none; }

.approval-insight-factor__summary::after {
  content: '▾';
  float: right;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.approval-insight-factor[open] .approval-insight-factor__summary::after {
  transform: rotate(180deg);
}

#staffingReviewPanel .staffing-review-list {
  max-height: min(28rem, 50vh);
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* ── DSS Insights: rescan overlay, insight cards, toast ─ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dss-rescan-overlay__panel {
  animation: dss-panel-in 0.28s ease-out;
}

@keyframes dss-panel-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dss-insight-progress {
  height: 0.35rem;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.15);
  overflow: hidden;
}

.dss-insight-progress__bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.05s linear;
}

.dss-insight-summary-card {
  border-radius: 1rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.dss-insight-summary-card--low {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.06);
}

.dss-insight-summary-card--moderate {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.06);
}

.dss-insight-summary-card--high {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.06);
}

.dss-insight-finding,
.dss-insight-action {
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.dss-insight-finding--pass,
.dss-insight-action--pass {
  border-color: rgba(74, 222, 128, 0.25);
}

.dss-insight-finding--warn,
.dss-insight-action--warn {
  border-color: rgba(250, 204, 21, 0.28);
}

.dss-insight-finding--fail,
.dss-insight-action--fail {
  border-color: rgba(248, 113, 113, 0.28);
}

.dss-insight-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.dss-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 80;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.85rem 1.1rem;
  border-radius: 0.85rem;
  font-size: 0.875rem;
  line-height: 1.45;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
}

.dss-toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.dss-toast--success {
  color: #ecfdf5;
  background: linear-gradient(135deg, #047857, #059669);
  border: 1px solid rgba(110, 231, 183, 0.35);
}

.dss-toast--error {
  color: #fff1f2;
  background: linear-gradient(135deg, #be123c, #e11d48);
  border: 1px solid rgba(251, 113, 133, 0.35);
}

html:not(.dark) .dss-toast--success {
  color: #064e3b;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
}

html:not(.dark) .dss-toast--error {
  color: #881337;
  background: linear-gradient(135deg, #ffe4e6, #fecdd3);
}

/* ── DSS consultant report (12-section modal) ─────────── */
.dss-report-hero {
  border-radius: 1rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.dss-report-hero--low { border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.06); }
.dss-report-hero--moderate { border-color: rgba(250, 204, 21, 0.35); background: rgba(250, 204, 21, 0.06); }
.dss-report-hero--high { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.06); }

.dss-breakdown-card { margin-bottom: 0.25rem; }

.dss-breakdown-rows {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dss-breakdown-row {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) 1fr auto;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.dss-breakdown-row__label { color: var(--text-secondary); white-space: nowrap; }

.dss-breakdown-row__dots {
  border-bottom: 1px dotted rgba(148, 163, 184, 0.55);
  min-width: 1rem;
  transform: translateY(-0.2rem);
}

.dss-breakdown-row__value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.dss-breakdown-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-weight: 700;
  color: var(--text-primary);
}

.dss-breakdown-total__value { font-variant-numeric: tabular-nums; }

.dss-report-section {
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  overflow: hidden;
  background: var(--bg-subtle);
}

.dss-report-section__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.95rem 1.1rem;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.dss-report-section__head:hover { background: rgba(99, 102, 241, 0.05); }

.dss-report-section__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.14);
  flex-shrink: 0;
}

.dss-report-section__title {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dss-report-section__chevron {
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.dss-report-section.is-open .dss-report-section__chevron { transform: rotate(180deg); }

.dss-report-section__body {
  display: none;
  padding: 0 1.1rem 1rem;
}

.dss-report-section.is-open .dss-report-section__body { display: block; }

.dss-factor-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dss-factor-list li {
  border-radius: 0.75rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.dss-factor-list--positive li { border-color: rgba(74, 222, 128, 0.25); }
.dss-factor-list--attention li { border-color: rgba(250, 204, 21, 0.28); }

.dss-factor-list__label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.dss-factor-list__detail {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.dss-final-rec {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-secondary);
  padding: 0.85rem 1rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.06);
}

.dss-explanation-status {
  max-width: 22rem;
  font-size: 0.75rem;
  line-height: 1.45;
  text-align: right;
  color: var(--text-muted);
}

.dss-explanation-status--ok { color: #86efac; }
.dss-explanation-status--warn { color: #fcd34d; }

html:not(.dark) .dss-explanation-status--ok { color: #047857; }
html:not(.dark) .dss-explanation-status--warn { color: #b45309; }

.dss-stale-notice {
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

html:not(.dark) .dss-stale-notice {
  color: #92400e;
  background: rgba(245, 158, 11, 0.1);
}

/* ── Notifications ───────────────────────────────────── */
.notif-bell-wrap {
  position: relative;
}

.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--theme-toggle-bg);
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.notif-bell-btn:hover {
  color: var(--text-primary);
  background: var(--theme-toggle-hover);
  border-color: rgba(99, 102, 241, 0.35);
}

.notif-bell-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-elevated);
}

.notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(22rem, calc(100vw - 2rem));
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-modal);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  z-index: 50;
  overflow: hidden;
}

html:not(.dark) .notif-dropdown {
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}

html:not(.dark) .notif-dropdown__item:hover {
  background: rgba(99, 102, 241, 0.06);
}

html:not(.dark) .notif-dropdown__item--unread {
  background: rgba(99, 102, 241, 0.08);
}

html:not(.dark) .notif-dropdown__link {
  color: #4f46e5;
}

html:not(.dark) .notif-dropdown__link:hover {
  color: #4338ca;
}

html:not(.dark) .nav-badge {
  background: rgba(99, 102, 241, 0.15);
  color: #4338ca;
}

html:not(.dark) .nav-badge--new {
  background: #ef4444;
  color: #fff;
}

.notif-dropdown__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.notif-dropdown__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-dropdown__count {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.notif-dropdown__list {
  max-height: 18rem;
  overflow-y: auto;
}

.notif-dropdown__empty {
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.notif-dropdown__item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
}

.notif-dropdown__item:hover {
  background: rgba(99, 102, 241, 0.08);
}

.notif-dropdown__item--unread {
  background: rgba(99, 102, 241, 0.06);
}

.notif-dropdown__item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.notif-dropdown__item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-dropdown__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #818cf8;
  flex-shrink: 0;
}

.notif-dropdown__item-msg {
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-dropdown__item-time {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.notif-dropdown__foot {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid var(--border);
}

.notif-dropdown__link {
  font-size: 0.78rem;
  font-weight: 600;
  color: #818cf8;
  text-decoration: none;
}

.notif-dropdown__link:hover {
  color: #a5b4fc;
}

.notif-dropdown__action {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.notif-dropdown__action:hover {
  color: var(--text-primary);
}

.notif-dropdown__action--danger:hover {
  color: #f87171;
}

.nav-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

.nav-badge--new {
  background: #ef4444;
  color: #fff;
  animation: notif-pulse 2s ease-in-out infinite;
}

@keyframes notif-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

.notif-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.notif-filter-pill:hover {
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.35);
}

.notif-filter-pill--active {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border-color: rgba(99, 102, 241, 0.45);
}

html:not(.dark) .notif-filter-pill--active {
  color: #4338ca;
}

.notif-filter-pill__count {
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}

.notif-item {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.15rem;
  transition: background 0.15s;
  cursor: pointer;
}

.notif-item:hover {
  background: rgba(99, 102, 241, 0.05);
}

.notif-item--unread {
  background: rgba(99, 102, 241, 0.07);
  border-left: 3px solid #818cf8;
}

.notif-item__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #818cf8;
  flex-shrink: 0;
}

.notif-item__title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-item__message {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.notif-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.notif-cat {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
}

.notif-cat--pending_review { background: rgba(250, 204, 21, 0.15); color: #fde68a; }
.notif-cat--approval { background: rgba(74, 222, 128, 0.15); color: #86efac; }
.notif-cat--disapproval { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.notif-cat--system { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

html:not(.dark) .notif-cat--pending_review { color: #b45309; }
html:not(.dark) .notif-cat--approval { color: #047857; }
html:not(.dark) .notif-cat--disapproval { color: #b91c1c; }
html:not(.dark) .notif-cat--system { color: #475569; }

/* ── User management table icons & profile modal ─────── */
.table-icon-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.table-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
  cursor: pointer;
  text-decoration: none;
}

.table-icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-subtle-hover);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.table-icon-btn--success:hover {
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.1);
}

.table-icon-btn--warn:hover {
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.1);
}

.table-icon-btn--danger:hover {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

html:not(.dark) .table-icon-btn--success:hover { color: #047857; }
html:not(.dark) .table-icon-btn--warn:hover { color: #b45309; }
html:not(.dark) .table-icon-btn--danger:hover { color: #b91c1c; }

.user-name-link {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-radius: 0.65rem;
  transition: background 0.15s;
}

.user-name-link:hover {
  background: rgba(99, 102, 241, 0.06);
}

.user-name-link:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.55);
  outline-offset: 2px;
}

.app-modal {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.app-modal.flex,
.app-modal.is-open {
  display: flex !important;
  opacity: 1;
  visibility: visible;
}

#explanationModal.is-open {
  z-index: 9999;
}

.app-modal__panel {
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.app-modal.flex .app-modal__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

body.modal-open {
  overflow: hidden;
}

.user-info-modal__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .user-info-modal__hero {
    flex-direction: row;
    text-align: left;
  }
}

.user-info-modal__avatar {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 1.25rem;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info-modal__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info-modal__avatar-initials {
  font-size: 1.5rem;
  font-weight: 700;
  color: #c7d2fe;
}

html:not(.dark) .user-info-modal__avatar-initials {
  color: #4f46e5;
}

.user-info-modal__name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-info-modal__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.user-info-modal__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
  justify-content: center;
}

@media (min-width: 640px) {
  .user-info-modal__pills { justify-content: flex-start; }
}

.user-info-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.user-info-pill--success { background: rgba(74, 222, 128, 0.15); color: #86efac; }
.user-info-pill--warning { background: rgba(250, 204, 21, 0.15); color: #fde68a; }
.user-info-pill--danger { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.user-info-pill--neutral { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

html:not(.dark) .user-info-pill--success { color: #047857; }
html:not(.dark) .user-info-pill--warning { color: #b45309; }
html:not(.dark) .user-info-pill--danger { color: #b91c1c; }
html:not(.dark) .user-info-pill--neutral { color: #475569; }

.user-info-section {
  margin-bottom: 1.25rem;
}

.user-info-section__title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.user-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 1.25rem;
}

@media (min-width: 640px) {
  .user-info-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.user-info-field__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.user-info-field__value {
  font-size: 0.9rem;
  color: var(--text-primary);
  word-break: break-word;
}

/* ── My Leaves page ──────────────────────────────────── */
.my-leaves-stats .stat-widget {
  min-height: 5.5rem;
}

.my-leaves-filters .filter-card {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.my-leaves-table th:last-child,
.my-leaves-table td:last-child {
  text-align: right;
}

.my-leaves-type {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.my-leaves-type__name {
  font-weight: 600;
  color: var(--text-primary);
}

.my-leaves-type__rec .px-2 {
  padding-left: 0.375rem;
  padding-right: 0.375rem;
}

.my-leaves-period__range {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.my-leaves-days {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.my-leaves-dss {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
}

.my-leaves-dss__score {
  font-size: 0.9375rem;
  font-weight: 700;
}

.my-leaves-dss__max {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.my-leaves-filed {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.my-leaves-filed__date {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.my-leaves-filed__time {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ── DSS explanation modal ───────────────────────────── */
.dss-modal__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  border: 1px solid rgba(99, 102, 241, 0.28);
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
}

html:not(.dark) .dss-modal__icon-wrap {
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.08);
}

.dss-modal__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dss-modal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.dss-modal__spinner {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-top-color: #818cf8;
  animation: dssSpin 0.75s linear infinite;
}

@keyframes dssSpin {
  to { transform: rotate(360deg); }
}

.dss-modal__score-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
}

.dss-modal__score-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dss-modal__score-rec {
  margin-top: 0.25rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.dss-modal__score-hint {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dss-modal__factors-head {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.dss-modal__factor {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dss-modal__factor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.dss-modal__factor-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.dss-modal__factor-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.dss-modal__factor-weight {
  color: var(--text-muted);
}

.dss-modal__factor-bar {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.5s ease;
}

.dss-modal__factor-bar--pass { background: linear-gradient(90deg, #22c55e, #4ade80); }
.dss-modal__factor-bar--warn { background: linear-gradient(90deg, #eab308, #facc15); }
.dss-modal__factor-bar--fail { background: linear-gradient(90deg, #ef4444, #f87171); }

.dss-modal__insights {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1.25rem;
}

@media (min-width: 640px) {
  .dss-modal__insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dss-modal__insight {
  padding: 0.875rem 1rem;
}

.dss-modal__insight-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dss-modal__insight-summary {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.dss-modal__detail {
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--text-secondary);
  white-space: pre-line;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 0.875rem;
  padding: 1rem 1.125rem;
}

.ai-modal__meta.flex {
  display: flex;
}

/* ── Responsive sidebar (mobile drawer) ──────────────── */
.sidebar-toggle-btn,
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover,
.sidebar-close-btn:hover {
  background: var(--bg-subtle-hover);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--indigo);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(8, 9, 16, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.is-visible {
  display: block;
  opacity: 1;
}

html:not(.dark) .sidebar-backdrop {
  background: rgba(15, 23, 42, 0.4);
}

.app-sidebar {
  transition: transform 0.28s ease;
  will-change: transform;
}

@media (max-width: 768px) {
  .sidebar-toggle-btn {
    display: inline-flex;
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .app-sidebar {
    transform: translateX(-100%);
    z-index: 50;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }

  .app-sidebar.is-open {
    transform: translateX(0);
  }

  /* Legacy class support */
  aside.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0 !important;
  }

  body.sidebar-open {
    overflow: hidden;
  }
}

@media (min-width: 769px) {
  .sidebar-backdrop,
  .sidebar-backdrop.is-visible {
    display: none !important;
  }

  .sidebar-toggle-btn,
  .sidebar-close-btn {
    display: none !important;
  }

  .app-sidebar {
    transform: none !important;
  }
}
