/* ============================================================
   SIDAF — Redesign (Claude Design handoff)
   ------------------------------------------------------------
   Tokens are theme-switchable via [data-theme] + [data-dark].
   The four themes mirror the prototype: corporate / friendly /
   bold / premium. Density / sidebar / button / table styles are
   controlled by additional data-attributes on <html>.

   This file ALSO re-aliases the legacy class names the existing
   Twig templates rely on (.btn, .card, .warn, .pill, .form-row)
   to the new tokens, so pages light up without per-template
   surgery.
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body, "Inter", system-ui, -apple-system, sans-serif);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: .9em; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- THEME 1 — CORPORATE SOBRE (default, light) ----------
   Tokens reflect the design choices baked in on 2026-05-22 from the
   Claude Design handoff Tweaks panel:
     accent: teal (#0e7490), font: Manrope, radius: square (4/2/6),
     density: regular, sidebar: wide, table: striped. */
:root,
[data-theme="corporate"] {
  --font-body: "Manrope", "Inter", system-ui, sans-serif;
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  --accent: #0e7490;
  --accent-hover: #0b5e75;
  --accent-text: #ffffff;
  --accent-soft: #ecfeff;
  --accent-soft-text: #0e7490;
  --success: #16a34a; --success-soft: #dcfce7;
  --warning: #d97706; --warning-soft: #fef3c7;
  --danger:  #dc2626; --danger-soft:  #fee2e2;
  --info:    #0284c7; --info-soft:    #e0f2fe;
  --radius-base: 6px; --radius-sm: 4px; --radius-lg: 8px; --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.18);
  --sidebar-bg: #ffffff;
  --sidebar-text: #475569;
  --sidebar-text-active: #0f172a;
  --sidebar-border: #e2e8f0;
  --sidebar-active-bg: #eef2ff;
}
[data-theme="corporate"][data-dark="true"] {
  --bg: #0b1220; --surface: #111a2e; --surface-2: #0f172a; --surface-hover: #1c2942;
  --border: #1f2a44; --border-strong: #2c3a5a;
  --text: #f1f5f9; --text-muted: #94a3b8; --text-subtle: #64748b;
  --accent: #22d3ee; --accent-hover: #67e8f9; --accent-text: #0b1220;
  --accent-soft: rgba(34,211,238,0.14); --accent-soft-text: #67e8f9;
  --sidebar-bg: #0b1220; --sidebar-text: #94a3b8; --sidebar-text-active: #f1f5f9;
  --sidebar-border: #1f2a44; --sidebar-active-bg: rgba(34,211,238,0.14);
  --success-soft: rgba(22,163,74,0.18); --warning-soft: rgba(217,119,6,0.18);
  --danger-soft: rgba(220,38,38,0.18); --info-soft: rgba(2,132,199,0.18);
}

/* ---------- THEME 2 — FRIENDLY HUMAIN ---------- */
[data-theme="friendly"] {
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-display: "DM Sans", system-ui, sans-serif;
  --bg: #faf7f2; --surface: #ffffff; --surface-2: #f5efe6; --surface-hover: #f0e8db;
  --border: #ece3d3; --border-strong: #d9cbb1;
  --text: #2d2a26; --text-muted: #6b6358; --text-subtle: #a89e8e;
  --accent: #c97c5d; --accent-hover: #b66a4a; --accent-text: #ffffff;
  --accent-soft: #fbe9df; --accent-soft-text: #8a4a30;
  --success: #5d8a6b; --success-soft: #e3eee5;
  --warning: #c9913d; --warning-soft: #faecd0;
  --danger:  #c25d5d; --danger-soft:  #f4dada;
  --info:    #6b8aaf; --info-soft:    #e3ecf5;
  --radius-base: 14px; --radius-sm: 10px; --radius-lg: 20px;
  --sidebar-bg: #f5efe6; --sidebar-text: #6b6358; --sidebar-text-active: #2d2a26;
  --sidebar-border: transparent; --sidebar-active-bg: #ffffff;
}
[data-theme="friendly"][data-dark="true"] {
  --bg: #221e1a; --surface: #2d2823; --surface-2: #1c1815; --surface-hover: #38322c;
  --border: #3d362e; --border-strong: #524a3f;
  --text: #f6efe2; --text-muted: #c4b9a4; --text-subtle: #897d68;
  --accent: #e89572; --accent-hover: #f0a583; --accent-text: #2d2a26;
  --accent-soft: rgba(232,149,114,0.18); --accent-soft-text: #f5b89c;
  --sidebar-bg: #1c1815; --sidebar-text: #c4b9a4; --sidebar-text-active: #f6efe2;
  --sidebar-active-bg: #2d2823;
}

/* ---------- THEME 3 — BOLD CONTEMPORAIN ---------- */
[data-theme="bold"] {
  --font-body: "Geist", "Inter", system-ui, sans-serif;
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --bg: #fafaf9; --surface: #ffffff; --surface-2: #f4f4f3; --surface-hover: #ebebe9;
  --border: #e5e5e4; --border-strong: #cfcfcc;
  --text: #0a0a0a; --text-muted: #525252; --text-subtle: #a3a3a3;
  --accent: #166534; --accent-hover: #14532d; --accent-text: #ffffff;
  --accent-soft: #dcfce7; --accent-soft-text: #14532d;
  --success: #166534; --success-soft: #dcfce7;
  --warning: #b45309; --warning-soft: #fef3c7;
  --danger:  #991b1b; --danger-soft:  #fee2e2;
  --info:    #1e40af; --info-soft:    #dbeafe;
  --radius-base: 6px; --radius-sm: 4px; --radius-lg: 10px;
  --sidebar-bg: #0a0a0a; --sidebar-text: #a3a3a3; --sidebar-text-active: #ffffff;
  --sidebar-border: #1c1c1c; --sidebar-active-bg: rgba(255,255,255,0.06);
}
[data-theme="bold"][data-dark="true"] {
  --bg: #0a0a0a; --surface: #141414; --surface-2: #0a0a0a; --surface-hover: #1f1f1f;
  --border: #262626; --border-strong: #404040;
  --text: #fafafa; --text-muted: #a3a3a3; --text-subtle: #6b6b6b;
  --accent: #4ade80; --accent-hover: #86efac; --accent-text: #052e16;
  --accent-soft: rgba(74,222,128,0.14); --accent-soft-text: #86efac;
  --sidebar-bg: #050505; --sidebar-active-bg: rgba(255,255,255,0.08);
}

/* ---------- THEME 4 — PREMIUM DARK (default dark) ---------- */
[data-theme="premium"] {
  --font-body: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --bg: #0a0b0d; --surface: #131418; --surface-2: #0f1013; --surface-hover: #1c1e24;
  --border: #23262e; --border-strong: #353944;
  --text: #f5f5f7; --text-muted: #9ba1ac; --text-subtle: #5d626d;
  --accent: #a3e635; --accent-hover: #bef264; --accent-text: #1a2e05;
  --accent-soft: rgba(163,230,53,0.12); --accent-soft-text: #bef264;
  --success: #4ade80; --success-soft: rgba(74,222,128,0.14);
  --warning: #fbbf24; --warning-soft: rgba(251,191,36,0.14);
  --danger:  #f87171; --danger-soft:  rgba(248,113,113,0.14);
  --info:    #60a5fa; --info-soft:    rgba(96,165,250,0.14);
  --radius-base: 10px; --radius-sm: 6px; --radius-lg: 16px;
  --sidebar-bg: #0a0b0d; --sidebar-text: #9ba1ac; --sidebar-text-active: #f5f5f7;
  --sidebar-border: #1c1e24; --sidebar-active-bg: rgba(163,230,53,0.08);
}
[data-theme="premium"][data-dark="false"] {
  --bg: #f5f5f4; --surface: #ffffff; --surface-2: #fafaf9; --surface-hover: #f0f0ef;
  --border: #e7e5e4; --border-strong: #d6d3d1;
  --text: #0a0b0d; --text-muted: #57534e; --text-subtle: #a8a29e;
  --accent: #4d7c0f; --accent-hover: #3f6212; --accent-text: #ffffff;
  --accent-soft: #ecfccb; --accent-soft-text: #3f6212;
  --sidebar-bg: #ffffff; --sidebar-text: #57534e; --sidebar-text-active: #0a0b0d;
  --sidebar-border: #e7e5e4; --sidebar-active-bg: #ecfccb;
}

/* ---------- DENSITY ---------- */
:root { --d: 1; }
[data-density="compact"] { --d: 0.78; }
[data-density="regular"] { --d: 1; }
[data-density="comfy"]   { --d: 1.22; }

/* ============================================================
   APP LAYOUT — sidebar + main
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w, 248px) 1fr;
  min-height: 100vh;
}
[data-sidebar="narrow"] { --sidebar-w: 72px; }
[data-sidebar="wide"]   { --sidebar-w: 248px; }

.sb {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto; overflow-x: hidden;
  /* Discreet scrollbar — only visible if the sidebar overflows
     despite collapsed sections (e.g. very short viewport). */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sb::-webkit-scrollbar { width: 4px; }
.sb::-webkit-scrollbar-track { background: transparent; }
.sb::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.sb:hover::-webkit-scrollbar-thumb { background: var(--border); }
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 18px;
  color: var(--sidebar-text-active);
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
  text-decoration: none;
}
.sb-brand:hover { text-decoration: none; }
.sb-brand-mark {
  width: 32px; height: 32px;
  border-radius: var(--radius-base);
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sb-brand small { opacity: 0.55; font-weight: 500; margin-left: 4px; }
[data-sidebar="narrow"] .sb-brand-text { display: none; }
[data-sidebar="narrow"] .sb-brand { justify-content: center; padding: 20px 8px 18px; }

.sb-section {
  padding: 6px 12px;
  color: var(--text-subtle);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 12px 8px 4px;
}
[data-sidebar="narrow"] .sb-section { display: none; }

/* Collapsible sidebar groups: each <details class="sb-group"> wraps a
   header (.sb-section as <summary>) + the nested .sb-nav. Default
   markers are hidden so we control the chevron via .sb-chev. */
.sb-group { padding: 0; margin: 0; }
.sb-group > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius-base);
  transition: color .12s, background .12s;
}
.sb-group > summary::-webkit-details-marker { display: none; }
.sb-group > summary::marker { content: ''; }
.sb-group > summary:hover { color: var(--sidebar-text-active); background: var(--sidebar-active-bg); }
.sb-chev {
  width: 11px; height: 11px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform .15s ease;
}
.sb-group[open] > summary .sb-chev { transform: rotate(90deg); }
[data-sidebar="narrow"] .sb-group > summary { display: none; }
[data-sidebar="narrow"] .sb-group:not([open]) > .sb-nav { display: none; }
.sb-group > .sb-nav { padding-bottom: 4px; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.sb-item {
  display: flex; align-items: center; gap: 12px;
  padding: calc(9px * var(--d)) 12px;
  border-radius: var(--radius-base);
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: background .12s, color .12s;
  border: none; background: transparent; text-align: left; width: 100%;
}
.sb-item:hover { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); text-decoration: none; }
.sb-item.is-active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); font-weight: 600; }
.sb-item .ic { width: 18px; height: 18px; flex-shrink: 0; }
[data-sidebar="narrow"] .sb-item-text,
[data-sidebar="narrow"] .sb-item-badge { display: none; }
[data-sidebar="narrow"] .sb-item { justify-content: center; padding: calc(11px * var(--d)) 0; }

.sb-item-badge {
  margin-left: auto;
  background: var(--accent); color: var(--accent-text);
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--radius-pill);
  min-width: 18px; text-align: center;
}

.sb-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex; align-items: center; gap: 10px;
  color: var(--sidebar-text);
}
[data-sidebar="narrow"] .sb-foot { justify-content: center; }
[data-sidebar="narrow"] .sb-foot-meta,
[data-sidebar="narrow"] .sb-foot-logout-text { display: none; }
.sb-avatar {
  width: 34px; height: 34px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-soft-text);
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.sb-foot-meta { font-size: 12px; line-height: 1.25; min-width: 0; flex: 1; }
.sb-foot-meta b { color: var(--sidebar-text-active); font-weight: 600; display: block; }
.sb-foot-meta span { color: var(--sidebar-text); font-size: 11px; }
.sb-foot a {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--sidebar-text); font-size: 12px;
}
.sb-foot a:hover { color: var(--sidebar-text-active); text-decoration: none; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  min-height: 64px;
}
.tb-title { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.tb-title b { color: var(--text); font-weight: 600; font-size: 14px; }
.tb-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tb-iconbtn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--radius-base);
  border: 1px solid transparent;
  background: transparent; color: var(--text-muted);
  cursor: pointer; position: relative;
}
.tb-iconbtn:hover { background: var(--surface-2); color: var(--text); }
.tb-iconbtn .ic { width: 18px; height: 18px; }

.content { padding: calc(28px * var(--d)) 32px calc(40px * var(--d)); flex: 1; }
.content-wrap { max-width: 1280px; margin: 0 auto; }

/* page head */
h1 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 .5rem; color: var(--text);
}
h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-top: 1.5rem; }
h3 { font-family: var(--font-display); font-size: 15px; font-weight: 600; }
p.lead { color: var(--text-muted); margin: 0 0 1.5rem; }

/* ============================================================
   BUTTONS — legacy class names re-aliased to design tokens
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-base);
  padding: calc(7px * var(--d)) 14px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s, transform .04s;
  white-space: nowrap; line-height: 1.3;
  background: var(--accent); color: var(--accent-text);
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn-ghost {
  background: var(--surface); color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }

/* Tweaks-controlled variants */
[data-btn="outline"] .btn { background: transparent; color: var(--accent); border-color: var(--accent); }
[data-btn="outline"] .btn:hover { background: var(--accent-soft); }
[data-btn="pill"]   .btn { border-radius: var(--radius-pill); }
[data-btn="square"] .btn { border-radius: 2px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: calc(20px * var(--d));
}

/* form-card pattern from legacy templates */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: calc(20px * var(--d)); }

/* Generic grid utility used across legacy templates. Default is a two-column
   layout; individual pages may override grid-template-columns inline (e.g.
   "Mes congés" uses repeat(auto-fill, minmax(220px, 1fr)) for solde cards). */
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

/* ============================================================
   FORM FIELDS — legacy .form-row + inputs
   ============================================================ */
.form-row { margin-bottom: 1rem; }
.form-row label {
  display: block; font-weight: 500;
  margin-bottom: .35rem; font-size: .82rem;
  color: var(--text-muted);
}
.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  padding: calc(8px * var(--d)) 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-base);
  color: var(--text);
  font-family: inherit; font-size: 13.5px;
  box-sizing: border-box;
  outline: 0; transition: border-color .12s, box-shadow .12s;
}
.form-row input:hover,
.form-row textarea:hover,
.form-row select:hover { border-color: var(--border-strong); }
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-row textarea { min-height: 5.5rem; resize: vertical; line-height: 1.45; }
.form-row input[type="checkbox"],
.form-row input[type="radio"] { width: auto; padding: 0; }
.form-row input[type="file"] { padding: 6px 8px; background: var(--surface-2); }
.form-row .help-text { color: var(--text-subtle); font-size: .78rem; margin-top: .25rem; }
.form-row .form-error,
.form-row ul.list-unstyled,
.form-row .invalid-feedback {
  color: var(--danger); font-size: .82rem; margin: .25rem 0 0; padding-left: 1.1rem;
}

/* ============================================================
   TABLE — global <table> styled like .tbl
   ============================================================ */
table {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden; font-size: 13.5px;
}
table th {
  text-align: left;
  font-weight: 500; color: var(--text-muted);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em;
  padding: calc(10px * var(--d)) calc(16px * var(--d));
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table td {
  padding: calc(11px * var(--d)) calc(16px * var(--d));
  border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
table tr:last-child td { border-bottom: 0; }
table tbody tr { transition: background .1s; }
table tbody tr:hover { background: var(--surface-2); }
table td.amount, td.amount { font-weight: 600; color: var(--success); font-variant-numeric: tabular-nums; }

/* Tweaks-controlled table variants */
[data-tbl="striped"] table tbody tr:nth-child(even) { background: var(--surface-2); }
[data-tbl="striped"] table tbody tr:hover { background: var(--surface-hover); }
[data-tbl="bordered"] table th,
[data-tbl="bordered"] table td { border-right: 1px solid var(--border); }
[data-tbl="bordered"] table th:last-child,
[data-tbl="bordered"] table td:last-child { border-right: 0; }
[data-tbl="cards"] table { border: 0; background: transparent; }
[data-tbl="cards"] table th { background: transparent; border-bottom: 0; }
[data-tbl="cards"] table td { background: var(--surface); border-top: 1px solid var(--border); }
[data-tbl="cards"] table tr:hover td { background: var(--surface-hover); }

/* ============================================================
   BADGES / PILLS — legacy .pill / .pill-ok / .pill-todo
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 500;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill-ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.pill-todo { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge { display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 500;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); white-space: nowrap;
}
.badge.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.danger  { background: var(--danger-soft);  color: var(--danger);  border-color: transparent; }
.badge.info    { background: var(--info-soft);    color: var(--info);    border-color: transparent; }

/* ============================================================
   FLASH / WARN
   ============================================================ */
.flash, .warn {
  padding: .85rem 1.1rem; border-radius: var(--radius-base);
  margin: 0 0 1rem; font-size: .92rem;
  background: var(--warning-soft); color: var(--warning);
  border: 1px solid transparent;
}
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-success { background: var(--success-soft); color: var(--success); }

/* CSS vars used by templates */
:root {
  --fg: var(--text);
  --muted: var(--text-muted);
  --soft: var(--surface-2);
  --card: var(--surface);
  --warn-bg: var(--warning-soft);
  --warn-fg: var(--warning);
  --warn-bd: transparent;
  --ok-bg: var(--success-soft);
  --ok-fg: var(--success);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; flex-wrap: wrap; font-size: .88rem; }
.pagination-bar .muted, .pagination-count { color: var(--text-muted); font-size: .82rem; }
.pagination-pages ul, .pagination-pages .pagination { list-style: none; display: inline-flex; gap: .25rem; padding: 0; margin: 0; }
.pagination-pages li, .pagination-pages a, .pagination-pages span { display: inline-flex; align-items: center; }
.pagination-pages a, .pagination-pages span {
  padding: .35rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-base);
  background: var(--surface); color: var(--text); text-decoration: none;
  min-width: 2rem; justify-content: center; font-variant-numeric: tabular-nums;
}
.pagination-pages a:hover { background: var(--surface-hover); border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination-pages .current, .pagination-pages li.current span, .pagination-pages li.active span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pagination-pages .disabled, .pagination-pages li.disabled span { color: var(--text-subtle); cursor: not-allowed; background: var(--surface-2); }
.pagination-size { display: inline-flex; gap: .3rem; align-items: center; }
.pagination-size-link { padding: .25rem .55rem; border-radius: 5px; color: var(--text-muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.pagination-size-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.pagination-size-link.active { background: var(--accent); color: var(--accent-text); }

/* ============================================================
   TOPBAR — search + extra icon actions
   ============================================================ */
.tb-search {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-base);
  width: 420px; max-width: 40vw;
  color: var(--text-muted); font-size: 13px;
}
.tb-search:focus-within { border-color: var(--accent); background: var(--surface); }
.tb-search .ic { width: 16px; height: 16px; flex-shrink: 0; }
.tb-search input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font-family: inherit; font-size: 13px;
}
.tb-search input::placeholder { color: var(--text-subtle); }
.tb-kbd {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px;
  font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--text-muted); line-height: 1.4;
}
.tb-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center;
  font-weight: 600; font-size: 12.5px;
  border: 0; cursor: pointer; flex-shrink: 0;
  text-decoration: none;
}
.tb-avatar:hover { background: var(--accent-hover); text-decoration: none; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap;
}
.dash-head h1 {
  display: flex; align-items: center; gap: 8px;
  margin: 0; font-size: 26px;
}
.dash-head .lead { margin: .35rem 0 0; font-size: 14px; }
.dash-head-actions { display: flex; gap: .55rem; flex-wrap: wrap; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 1.4rem;
}
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: calc(16px * var(--d)) calc(18px * var(--d));
  display: flex; flex-direction: column; gap: .35rem;
}
.kpi-card-head { display: flex; align-items: center; gap: 10px; }
.kpi-card-icon {
  background: var(--accent-soft); color: var(--accent-soft-text);
  width: 28px; height: 28px;
  border-radius: var(--radius-base);
  display: grid; place-items: center; flex-shrink: 0;
}
.kpi-card-icon .ic { width: 15px; height: 15px; }
.kpi-card-title { color: var(--text-muted); font-size: 12.5px; font-weight: 500; }
.kpi-card-value {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
  color: var(--text);
}
.kpi-card-value small { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.kpi-card-foot { color: var(--text-muted); font-size: 12px; line-height: 1.4; }
.kpi-card-foot strong { color: var(--success); font-weight: 600; }
.kpi-card-foot .warn { background: transparent; color: var(--warning); padding: 0; margin: 0; border: 0; font-weight: 600; font-size: 12px; }
.kpi-card-foot .danger { color: var(--danger); font-weight: 600; }

.dash-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 1.4rem;
}
@media (max-width: 1000px) { .dash-cols { grid-template-columns: 1fr; } }

.dash-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
}
.dash-section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 16px 18px 4px;
}
.dash-section-head h3 { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.dash-section-head p { margin: .15rem 0 0; font-size: 12.5px; color: var(--text-muted); }
.dash-section-head a.link { font-size: 12.5px; color: var(--text-muted); }
.dash-section-head a.link:hover { color: var(--accent); }

.demande-list { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.demande-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--surface-2);
  border-radius: var(--radius-base);
}
.demande-avatar {
  width: 38px; height: 38px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-soft-text);
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.demande-info { flex: 1; min-width: 0; }
.demande-info-line1 { font-weight: 600; font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demande-info-line2 { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.demande-actions { display: flex; gap: 6px; }
.demande-actions button {
  width: 30px; height: 30px;
  border-radius: var(--radius-base);
  border: 1px solid var(--border);
  background: var(--surface); cursor: pointer;
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: background .12s, color .12s, border-color .12s;
}
.demande-actions button:hover { background: var(--surface-hover); color: var(--text); }
.demande-actions .ok:hover { background: var(--success-soft); color: var(--success); border-color: transparent; }
.demande-actions .no:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.demande-actions svg { width: 14px; height: 14px; }

.compteur-list { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.compteur-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; background: var(--surface-2);
  border-radius: var(--radius-base);
}
.compteur-ring { width: 48px; height: 48px; flex-shrink: 0; position: relative; }
.compteur-ring svg { width: 48px; height: 48px; transform: rotate(-90deg); display: block; }
.compteur-ring-bg { fill: none; stroke: var(--surface-hover); stroke-width: 5; }
.compteur-ring-fg { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .5s; }
.compteur-ring-label {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  color: var(--text);
}
.compteur-info { flex: 1; min-width: 0; }
.compteur-info-line1 { font-weight: 600; font-size: 13.5px; color: var(--text); }
.compteur-info-line2 { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.activity-feed { display: flex; flex-direction: column; gap: 14px; padding: 14px 18px 18px; }
.activity-row { display: flex; gap: 12px; align-items: flex-start; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-top: 8px; flex-shrink: 0;
}
.activity-row.muted .activity-dot { background: var(--text-subtle); }
.activity-row-body { flex: 1; min-width: 0; }
.activity-row-text { font-size: 13.5px; color: var(--text); line-height: 1.45; }
.activity-row-text b { font-weight: 600; }
.activity-row-text a { color: var(--accent); }
.activity-row-time { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.empty-state { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ============================================================
   CALENDAR — Mon-Fri grid + segmented tabs + legend pills
   ============================================================ */
.cal-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.cal-tabs {
  display: inline-flex; gap: 4px;
  padding: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-base);
}
.cal-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: calc(var(--radius-base) - 2px);
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  text-decoration: none; cursor: pointer;
  transition: background .12s, color .12s;
}
.cal-tab:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.cal-tab.is-active { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-sm); }
.cal-tab svg { width: 14px; height: 14px; }

.cal-legend { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px; color: var(--text-muted);
}
.cal-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.cal-card { padding: 0; overflow: hidden; }
.cal-month-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cal-month-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; letter-spacing: -0.01em;
  color: var(--text);
}
.cal-nav { display: inline-flex; align-items: center; gap: 4px; }
.cal-iconbtn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--radius-base);
  border: 1px solid transparent;
  background: transparent; color: var(--text-muted);
  cursor: pointer; text-decoration: none;
  transition: background .12s, color .12s;
}
.cal-iconbtn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.cal-iconbtn svg { width: 16px; height: 16px; }
.cal-today-btn {
  padding: 6px 14px;
  border-radius: var(--radius-base);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: background .12s, border-color .12s;
}
.cal-today-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); text-decoration: none; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--border);
  gap: 1px;
}
.cal-head {
  background: var(--surface);
  padding: 10px 14px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
}
.cal-cell {
  background: var(--surface);
  min-height: 108px;
  padding: 8px 10px 10px;
  font-size: 12.5px;
  position: relative;
  display: flex; flex-direction: column; gap: 3px;
}
.cal-cell-outside { background: var(--surface-2); }
.cal-cell-outside .cal-cell-day { color: var(--text-subtle); font-weight: 400; }
.cal-cell-holiday { background: var(--warning-soft); }

.cal-cell-day {
  font-weight: 600; font-size: 13px;
  color: var(--text);
  height: 22px; line-height: 22px;
}
/* Today: teal pill around the day number, mirroring the design mock. */
.cal-cell-today .cal-cell-day {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-text);
  font-weight: 700; font-size: 12px;
  text-align: center; line-height: 1;
}
.cal-holiday-label {
  font-size: 11px; color: var(--warning);
  font-style: italic; line-height: 1.2;
}

.cal-event {
  --c: var(--accent);
  display: flex; align-items: center; gap: 5px;
  padding: 3px 6px 3px 8px;
  border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border-radius: 3px;
  font-size: 11.5px; line-height: 1.3;
  color: var(--text);
  overflow: hidden;
}
.cal-event-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c);
  flex-shrink: 0;
}
.cal-event-text {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-overflow {
  font-size: 11px; color: var(--text-muted);
  padding-left: 8px; margin-top: 1px;
}

@media (max-width: 720px) {
  .cal-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); font-size: 11px; }
  .cal-cell { min-height: 80px; padding: 6px 6px 8px; }
  .cal-event-text { font-size: 10.5px; }
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
@media (max-width: 900px) { .login-page { grid-template-columns: 1fr; } .login-side { display: none; } }
.login-side {
  background: var(--accent); color: var(--accent-text);
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-side-decor {
  position: absolute; inset: 0; opacity: 0.18; pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 80%, currentColor 0, transparent 35%),
    radial-gradient(circle at 80% 20%, currentColor 0, transparent 45%);
}
.login-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-brand-mark {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-base);
  display: grid; place-items: center; font-weight: 700;
}
.login-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.login-quote {
  font-family: var(--font-display);
  font-size: 28px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 600;
  position: relative; z-index: 1; max-width: 480px;
}
.login-quote-author { font-size: 13px; opacity: 0.7; font-weight: 500; margin-top: 14px; }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 48px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 24px; }
.login-h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0; color: var(--text);
}
.login-sub { color: var(--text-muted); font-size: 14px; margin: 4px 0 0; }
.login-cta { width: 100%; justify-content: center; padding: calc(11px * var(--d)) 14px; font-weight: 600; font-size: 14px; }

/* misc */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sb { position: static; height: auto; }
  .content { padding: 1.2rem; }
}
