/* ========================================
   SIZU-RH — Design System CSS v1.0
   IMMUABLE : copie conforme du Design System SIZU-RH
   ======================================== */

:root {
  /* ─── Marque SIZU ─── */
  --brand-primary:   #5b4fe8;
  --brand-secondary: #7a6ff0;
  --brand-hover:     #4b3fd6;
  --brand-active:    #3f35b8;
  --brand-accent:    #9d93f5;
  --brand-lavender:  #f2f0fe;
  --brand-dark:      #0e0e12;
  --brand-success:   #5ba87c;
  --brand-red:       #DC2626;
  --brand-red-hover: #B91C1C;
  --white:           #FFFFFF;

  /* ─── Fonds / Neutres ─── */
  --bg-app:        #ffffff;
  --bg-surface:    #ffffff;
  --bg-subtle:     #f8f7ff;
  --bg-dark:       #0e0e12;
  --border-default: #e5e5ec;
  --border-subtle:  #f0eff5;
  --border-input:   #d8d8e0;
  --divider-light:  #f0eff5;
  --text-primary:   #15151b;
  --text-secondary: #4a4a55;
  --text-tertiary:  #8a8a99;
  --text-disabled:  #b4b4bf;

  /* ─── Statuts ─── */
  --status-success-text: #2f7a50;
  --status-success-bg:   #e9f7ef;
  --status-warning-text: #9c6b1b;
  --status-warning-bg:   #fdf6e3;
  --status-error-text:   #b91c1c;
  --status-error-bg:     #fee2e2;
  --status-info-text:    #5b4fe8;
  --status-info-bg:      #f2f0fe;

  /* ─── Layout ─── */
  --sidebar-width:  260px;
  --navbar-height:  64px;
  --gutter:         24px;

  /* ─── Spacing tokens ─── */
  --card-padding:   20px;
  --card-gap:       16px;
  --input-height:   40px;
  --btn-padding:    8px 16px;
  --badge-padding:  4px 12px;

  /* ─── Radius ─── */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-pill: 9999px;

  /* ─── Shadows ─── */
  --shadow-card:  0 1px 2px rgba(21,21,27,0.04), 0 1px 3px rgba(21,21,27,0.02);
  --shadow-modal: 0 24px 48px -12px rgba(14,14,18,0.18), 0 12px 24px -8px rgba(14,14,18,0.10);
  --shadow-toast: 0 8px 16px -4px rgba(14,14,18,0.12), 0 4px 8px -2px rgba(14,14,18,0.06);
  --shadow-elevate: 0 4px 12px rgba(91,79,232,0.10);

  /* ─── Focus & Transitions ─── */
  --focus-ring: rgba(91,79,232,0.22);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-page: 300ms cubic-bezier(0.32, 0.72, 0, 1);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Skip to content ─── */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10000;
  background: var(--brand-primary);
  color: var(--white);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.skip-to-content:focus { left: 8px; outline: 2px solid var(--white); outline-offset: 2px; }

/* ─── Typography ─── */
.h1 { font-size: 28px; font-weight: 800; line-height: 34px; letter-spacing: -0.04em; }
.h2 { font-size: 18px; font-weight: 700; line-height: 26px; letter-spacing: -0.02em; }
.h3 { font-size: 15px; font-weight: 600; line-height: 22px; letter-spacing: -0.01em; }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 36px; }
.kpi-value-lg { font-size: 32px; font-weight: 700; line-height: 40px; }
.body-text { font-size: 14px; font-weight: 400; line-height: 20px; }
.label-text { font-size: 12px; font-weight: 500; line-height: 16px; }
.label-uppercase { font-size: 11px; font-weight: 600; line-height: 16px; letter-spacing: 0.05em; text-transform: uppercase; }
.font-small { font-size: 12px; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-disabled { color: var(--text-disabled); }
.text-error { color: var(--status-error-text); }
.text-brand { color: var(--brand-primary); }
.text-link { color: var(--brand-primary); text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ─── Utility spacing / layout ─── */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-gutter { margin-top: var(--gutter); }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-0 { padding: 0 !important; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.m-0 { margin: 0 !important; }
.w-full { width: 100%; }
.max-w-sm { max-width: 480px; }
.max-w-xs { max-width: 420px; }
.max-w-s { max-width: 280px; }
.max-w-md { max-width: 560px; }
.max-w-200 { max-width: 200px; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gutter-gap { gap: var(--gutter); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

/* ─── Grid utilities ─── */
.grid { display: grid; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--card-gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--card-gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--card-gap); }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--card-gap); }
.grid-cols-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--card-gap); }
.grid-auto-fit { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--card-gap); align-items: end; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--card-gap); align-items: end; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--card-gap); align-items: end; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--card-gap); align-items: end; }
.form-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--card-gap); align-items: end; }
.form-grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--card-gap); align-items: end; }
.form-grid-7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--card-gap); align-items: end; }
.form-grid-inline { display: grid; grid-template-columns: 160px 1fr 120px 120px 120px; gap: var(--card-gap); align-items: end; }
.form-grid-leave { display: grid; grid-template-columns: 120px 1fr; gap: var(--card-gap); align-items: end; }
.form-grid-expense { display: grid; grid-template-columns: 1fr repeat(2, 160px) 80px; gap: var(--card-gap); align-items: end; }
.form-grid-timesheet { display: grid; grid-template-columns: repeat(4, 1fr) 80px; gap: var(--card-gap); align-items: end; }
.form-grid-department { display: grid; grid-template-columns: 1fr 120px 120px; gap: var(--card-gap); align-items: end; }
.form-grid-contract { display: grid; grid-template-columns: repeat(6, 1fr) 120px; gap: var(--card-gap); align-items: end; }
.form-grid-document { display: grid; grid-template-columns: 1fr 2fr 1fr 120px; gap: var(--card-gap); align-items: end; }
.form-grid-holiday { display: grid; grid-template-columns: 1fr 2fr 120px 120px; gap: var(--card-gap); align-items: end; }
.form-grid-job-title { display: grid; grid-template-columns: 2fr 2fr 120px; gap: var(--card-gap); align-items: end; }
.form-grid-leave-type { display: grid; grid-template-columns: 120px 1fr 100px 100px 140px; gap: var(--card-gap); align-items: end; }
.form-grid-expense-type { display: grid; grid-template-columns: 120px 1fr 120px 140px; gap: var(--card-gap); align-items: end; }
.form-grid-team { display: grid; grid-template-columns: 2fr 2fr 120px; gap: var(--card-gap); align-items: end; }
.form-grid-onboarding { display: grid; grid-template-columns: 3fr 120px; gap: var(--card-gap); align-items: end; }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-cols-auto, .form-grid-2, .form-grid-3, .form-grid-4, .form-grid-5, .form-grid-6, .form-grid-7,
  .form-grid-inline, .form-grid-leave, .form-grid-expense, .form-grid-timesheet, .form-grid-department, .form-grid-contract, .form-grid-document,
  .form-grid-holiday, .form-grid-job-title, .form-grid-leave-type, .form-grid-expense-type, .form-grid-team, .form-grid-onboarding {
    grid-template-columns: 1fr;
  }
}

.hidden { display: none !important; }

/* Planning grid container */
.planning-grid-container { min-width: 720px; min-height: 300px; }

/* ─── Icons ─── */
.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; flex-shrink: 0; }
.icon-xs { width: 12px; height: 12px; flex-shrink: 0; }

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

/* Sidebar : pas de trait de séparation avec le header */
.sidebar {
  width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0;
  background: var(--bg-surface);
  display: flex; flex-direction: column; padding: 16px 0; z-index: 100;
  overflow-y: auto; overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.sidebar-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); background: var(--white);
  cursor: pointer; color: var(--text-primary);
  transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}
.sidebar-toggle:active { transform: scale(0.96); }
.sidebar-toggle .icon { width: 20px; height: 20px; }

.navbar-left { display: flex; align-items: center; gap: 12px; }
.navbar-left .sidebar-toggle { display: none; }
@media (max-width: 768px) {
  .navbar-left .sidebar-toggle { display: flex; }
  .sidebar .sidebar-toggle { display: flex; position: absolute; top: 16px; right: 16px; z-index: 10; }
}

/* Logo SIZU : ✦ + sizu + RH */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px; margin-bottom: 24px;
  text-decoration: none;
}
.sidebar-brand-star {
  color: var(--brand-primary);
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
}
.sidebar-brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--text-primary);
}
.sidebar-brand-suffix {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--brand-lavender);
  color: var(--brand-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.sidebar-section-title {
  padding: 8px 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-secondary);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; font-size: 14px; font-weight: 500; color: var(--text-tertiary);
  text-decoration: none; transition: var(--transition-fast);
  min-height: 44px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-right: 16px;
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.nav-item.active { background: var(--bg-subtle); color: var(--brand-primary); font-weight: 600; }
.nav-item:active:not(.active) { transform: scale(0.98); }
.nav-item .icon { width: 20px; height: 20px; flex-shrink: 0; }

.main-area { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }

/* Navbar : pas de bordure inférieure */
.navbar {
  height: var(--navbar-height); background: var(--bg-surface);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter); position: sticky; top: 0; z-index: 50;
}
.navbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.navbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.navbar-company {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.navbar-actions { display: flex; align-items: center; gap: 8px; }
.navbar-logo { width: 28px; height: 28px; object-fit: contain; border-radius: var(--radius-sm); }

.page-content {
  flex: 1; padding: var(--gutter); overflow-y: auto;
  animation: pageIn var(--transition-page) both;
}

/* ─── App Footer / Sign-off SIZU ─── */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--gutter);
  background: var(--bg-surface);
}
.app-footer-brand { display: flex; align-items: center; gap: 8px; }
.app-footer-star { color: var(--brand-primary); font-size: 20px; line-height: 1; font-weight: 700; }
.app-footer-name { font-size: 18px; font-weight: 800; letter-spacing: -0.05em; color: var(--text-primary); }
.app-footer-meta { text-align: right; }
.app-footer-baseline { font-size: 13px; font-weight: 700; color: var(--brand-primary); }
.app-footer-tagline { font-size: 12px; color: var(--text-tertiary); font-style: italic; }

/* ─── KPI Grid & Cards ─── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gutter); margin-bottom: var(--gutter); }
.kpi-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: var(--card-padding); box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-elevate); border-color: var(--border-default); }
.kpi-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.kpi-card-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.kpi-card-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.kpi-card-icon.icon-success { background: var(--status-success-bg); color: var(--status-success-text); }
.kpi-card-icon.icon-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.kpi-card-icon.icon-error { background: var(--status-error-bg); color: var(--status-error-text); }
.kpi-card-icon.icon-info { background: var(--status-info-bg); color: var(--status-info-text); }
.kpi-card-icon.icon-neutral { background: var(--bg-subtle); color: var(--text-tertiary); }
.kpi-card-trend { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; }
.kpi-card-trend.up { color: var(--status-success-text); }
.kpi-card-trend.down { color: var(--status-error-text); }
.kpi-card-trend.flat { color: var(--text-secondary); }

/* ─── Cards ─── */
.card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-elevate); border-color: var(--border-default); }
.card-lg { border-radius: var(--radius-lg); }
.card-flat { box-shadow: none; border: 1px solid var(--border-subtle); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 20px 0; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.card-title-sm { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.card-actions { display: flex; gap: 8px; }
.card-body { padding: var(--card-padding); }
.card-body:first-child { padding-top: var(--card-padding); }
.card-link { text-decoration: none; }
.card-link:hover { border-color: var(--border-default); box-shadow: var(--shadow-card); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: var(--btn-padding); border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 20px;
  cursor: pointer; transition: var(--transition-fast);
  text-decoration: none;
  min-height: 44px; min-width: 44px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand-primary); color: var(--white); border-color: var(--brand-primary); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:active:not(:disabled) { background: var(--brand-active); transform: scale(0.97); transition-duration: 80ms; }
.btn-secondary { background: var(--bg-surface); color: var(--text-tertiary); border-color: var(--border-subtle); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-subtle); }
.btn-ghost { background: transparent; color: var(--text-tertiary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-subtle); }
.btn-danger { background: var(--brand-red); color: var(--white); border-color: var(--brand-red); }
.btn-danger:hover:not(:disabled) { background: var(--brand-red-hover); }
.btn-success { background: var(--status-success-text); color: var(--white); border-color: var(--status-success-text); }
.btn-success:hover:not(:disabled) { filter: brightness(0.95); }
.btn-sm { padding: 4px 12px; font-size: 13px; min-height: 36px; min-width: 36px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* ─── Inputs ─── */
.input, .select, .textarea {
  height: var(--input-height); padding: 8px 12px; border: 1px solid var(--border-input);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text-primary);
  background: var(--bg-surface); width: 100%; transition: var(--transition-fast);
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 2px;
}
.focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: 2px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.input:disabled, .select:disabled, .textarea:disabled { background: var(--bg-subtle); color: var(--text-disabled); }
.input.has-error, .select.has-error, .textarea.has-error { border-color: var(--brand-red); }
.textarea { height: auto; min-height: 80px; resize: vertical; }
.form-group { margin-bottom: 16px; }
.form-group.has-error .input, .form-group.has-error .select, .form-group.has-error .textarea { border-color: var(--brand-red); }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.form-help { display: block; font-size: 12px; color: var(--text-disabled); margin-top: 4px; }
.form-error { display: block; font-size: 12px; color: var(--status-error-text); margin-top: 4px; }

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: var(--badge-padding); border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; line-height: 16px;
}
.badge i { width: 14px; height: 14px; }
.badge-success { background: var(--status-success-bg); color: var(--status-success-text); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-error { background: var(--status-error-bg); color: var(--status-error-text); }
.badge-info { background: var(--status-info-bg); color: var(--status-info-text); }
.badge-neutral { background: var(--bg-subtle); color: var(--text-tertiary); }

/* ─── Tables ─── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; table-layout: auto; }
.table th {
  text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle); background: transparent;
  white-space: nowrap; vertical-align: middle;
}
.table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table th.num, .table td.num,
.table th.text-right, .table td.text-right { text-align: right; font-variant-numeric: tabular-nums; }
.table th.center, .table td.center,
.table th.text-center, .table td.text-center { text-align: center; }
.table tbody tr:hover { background: var(--bg-subtle); }
.table .total-row { font-weight: 700; }

/* ─── Kanban (pending list) ─── */
.kanban-board { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--gutter); }
.kanban-column { background: var(--bg-subtle); border-radius: var(--radius-md); padding: 16px; }
.kanban-column-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(14,14,18,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition-base);
}
.modal-overlay:not(.hidden) { opacity: 1; pointer-events: auto; }
.modal-overlay:not(.hidden) .modal { animation: modalIn 300ms cubic-bezier(0.32, 0.72, 0, 1) both; }
.modal {
  background: var(--bg-surface); border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-modal); max-height: 90vh; overflow-y: auto;
  transform: scale(0.96) translateY(10px); opacity: 0;
}
.modal-lg { max-width: 760px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 0; }
.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close { border: none; background: none; cursor: pointer; color: var(--text-secondary); padding: 4px; border-radius: var(--radius-sm); transition: color var(--transition-fast), transform var(--transition-fast); }
.modal-close:hover { color: var(--text-primary); transform: rotate(90deg); }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; }

/* ─── Alerts ─── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 16px; }
.alert-danger { background: var(--status-error-bg); color: var(--status-error-text); }
.alert-info { background: var(--status-info-bg); color: var(--status-info-text); }
.alert-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.alert-success { background: var(--status-success-bg); color: var(--status-success-text); }

/* ─── Spinner ─── */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border-default); border-top-color: var(--brand-primary); border-radius: 50%; animation: spin 0.6s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ─── Toasts ─── */
.toast-container { position: fixed; bottom: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-toast); min-width: 280px;
  animation: toastIn 300ms cubic-bezier(0.32, 0.72, 0, 1) both;
}
.toast-content { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 14px; }
.toast-content i { width: 18px; height: 18px; flex-shrink: 0; }
.toast-close { background: none; border: none; cursor: pointer; color: inherit; opacity: 0.6; padding: 2px; transition: opacity var(--transition-fast); }
.toast-close:hover { opacity: 1; }
.toast-success { background: var(--status-success-bg); color: var(--status-success-text); }
.toast-error { background: var(--status-error-bg); color: var(--status-error-text); }
.toast-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.toast-info { background: var(--status-info-bg); color: var(--status-info-text); }
.toast.hiding { animation: toastOut 200ms ease-in both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%) scale(0.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0) scale(1); } to { opacity: 0; transform: translateX(100%) scale(0.96); } }

/* ─── Empty state ─── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; }
.empty-state-icon { width: 48px; height: 48px; color: var(--text-disabled); margin-bottom: 16px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.empty-state-text { font-size: 14px; color: var(--text-secondary); }
.empty-state-cell { padding: 0 !important; }

/* ─── Animations (Apple HIG 2026) ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-fade-in-up { animation: fadeInUp var(--transition-spring) both; }

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

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

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

/* ─── Responsive mobile ─── */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0;
    transform: translateX(-100%); transition: transform var(--transition-base);
    border-right: none; border-bottom: none;
    padding: 16px 0; z-index: 250;
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(14,14,18,0.35);
    z-index: 240; opacity: 0; pointer-events: none; transition: opacity var(--transition-fast);
  }
  .sidebar-overlay.sidebar-open { opacity: 1; pointer-events: auto; }
  .main-area { margin-left: 0; }
  .page-content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 600px; }
  .card-header { flex-direction: column; gap: 12px; }
  .card-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .navbar { padding: 0 16px; }
  .navbar-title { font-size: 16px; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; width: 100%; }
  .app-footer { flex-direction: column; gap: 8px; text-align: center; }
  .app-footer-meta { text-align: center; }
}

/* Touch-friendly */
@media (max-width: 768px) {
  .nav-item { min-height: 48px; }
}

/* ─── Login brand ─── */
.login-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.login-brand-star {
  color: var(--brand-primary);
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
}
.login-brand-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--text-primary);
}
.login-brand-suffix {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand-lavender);
  color: var(--brand-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.logo-centered { display: none; }

/* ─── Print ─── */
@media print {
  .sidebar, .navbar, .card-actions, .toast-container, .app-footer { display: none !important; }
  .main-area { margin-left: 0 !important; }
}
