@font-face {
  font-family: "Alegreya";
  src: url("/assets/fonts/alegreya-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("/assets/fonts/alegreya-italic-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("/assets/fonts/alegreya-sans-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("/assets/fonts/alegreya-sans-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya SC";
  src: url("/assets/fonts/alegreya-sc-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* Charte graphique DovahKii : thème sombre (acier, givre, braise rationnée) */
:root {
  color-scheme: dark;
  --bg-deep: #0E141A;
  --bg-page: #131B22;
  --bg-surface: #1B242C;
  --bg-elevated: #242C32;
  --bg-well: rgba(8, 12, 16, 0.52);

  --line: #33404A;
  --border: #3A464F;
  --border-strong: #55636D;

  --ink-strong: #E8F3F8;
  --ink: #DDE5EA;
  --ink-data: #CBE2EE;
  --ink-muted: #8C99A2;
  --ink-subtle: #77848D;

  --accent: #7E96A5;
  --btn-primary-bg: #4E626E;
  --btn-primary-hover: #617887;
  --btn-primary-ink: #E8F3F8;

  --braise-100: #FFF3D4;
  --braise: #E9B764;
  --braise-400: #E0B36A;
  --braise-bg: rgba(233, 183, 100, 0.14);
  --braise-border: rgba(224, 179, 106, 0.45);

  --sylve: #A9D6A0;
  --sylve-bg: rgba(169, 214, 160, 0.13);
  --sylve-border: #3F5A3C;

  --sang: #FF7B7B;
  --sang-ink: #FFD9D3;
  --sang-bg: rgba(255, 123, 123, 0.14);
  --sang-border: #8C4A44;

  --azur: #9FE8FF;
  --azur-bg: rgba(159, 232, 255, 0.12);
  --azur-border: #3E5F6C;

  --brume: #69747D;
  --brume-bg: rgba(105, 116, 125, 0.16);

  --shadow-panel: 0 14px 40px rgba(0, 0, 0, 0.55);
  --frost-top: inset 0 1px 0 rgba(190, 216, 230, 0.18);
  --radius-sm: 4px;
  --radius: 7px;
  --radius-lg: 10px;
}

/* Charte graphique DovahKii : thème clair (neige) */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-deep: #E8EDF0;
  --bg-page: #F5F8F9;
  --bg-surface: #FFFFFF;
  --bg-elevated: #EDF2F5;
  --bg-well: #E8EDF0;

  --line: #D4DDE3;
  --border: #C6D1D8;
  --border-strong: #9BAAB4;

  --ink-strong: #1C2429;
  --ink: #232B31;
  --ink-data: #2B3B45;
  --ink-muted: #4E626E;
  --ink-subtle: #5C6B76;

  --accent: #4E626E;
  --btn-primary-bg: #3D505C;
  --btn-primary-hover: #4E626E;
  --btn-primary-ink: #F5F8F9;

  --braise-100: #5B3807;
  --braise: #8B5B10;
  --braise-400: #996414;
  --braise-bg: rgba(153, 100, 20, 0.12);
  --braise-border: rgba(153, 100, 20, 0.42);

  --sylve: #235D33;
  --sylve-bg: rgba(35, 93, 51, 0.11);
  --sylve-border: rgba(35, 93, 51, 0.35);

  --sang: #9E2626;
  --sang-ink: #7F1D1D;
  --sang-bg: rgba(158, 38, 38, 0.1);
  --sang-border: rgba(158, 38, 38, 0.35);

  --azur: #175A73;
  --azur-bg: rgba(23, 90, 115, 0.1);
  --azur-border: rgba(23, 90, 115, 0.32);

  --brume: #5C6B76;
  --brume-bg: rgba(92, 107, 118, 0.12);

  --shadow-panel: 0 12px 32px rgba(28, 36, 41, 0.14);
  --frost-top: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-page);
  color: var(--ink);
  font: 15px/1.5 "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
}

a { color: var(--azur); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3, h4, p { margin: 0; }
h1, h2 { font-family: "Alegreya SC", Georgia, serif; font-weight: 400; color: var(--ink-strong); }
h3, h4 { font-family: "Alegreya", Georgia, serif; font-weight: 700; color: var(--ink-strong); }
code, .mono { font-family: Consolas, "Courier New", monospace; font-size: 0.88em; }
.small { font-size: 0.86rem; }
.muted { color: var(--ink-muted); }
.subtle { color: var(--ink-subtle); }
.eyebrow { font-family: "Alegreya SC", Georgia, serif; font-size: 0.92rem; letter-spacing: 0.04em; color: var(--ink-muted); }

.skip-link {
  position: absolute; left: 12px; top: -80px;
  background: var(--btn-primary-bg); color: var(--btn-primary-ink);
  padding: 8px 14px; border-radius: var(--radius-sm); z-index: 200;
}
.skip-link:focus { top: 12px; }
.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;
}

.logo-light { display: none; }
:root[data-theme="light"] .logo-light { display: block; }
:root[data-theme="light"] .logo-dark { display: none; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--ink-strong);
  font-weight: 700; font-size: 0.92rem; line-height: 1.25;
  transition: border-color 0.14s, background-color 0.14s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); background: var(--bg-surface); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--btn-primary-bg); border-color: var(--border-strong); color: var(--btn-primary-ink);
  box-shadow: var(--frost-top);
}
.btn-primary:hover:not(:disabled) { background: var(--btn-primary-hover); border-color: var(--accent); }
.btn-hot {
  background: var(--braise-bg); border-color: var(--braise-border); color: var(--braise);
}
.btn-hot:hover:not(:disabled) { background: rgba(233, 183, 100, 0.24); border-color: var(--braise); }
.btn-danger {
  background: var(--sang-bg); border-color: var(--sang-border); color: var(--sang);
}
.btn-danger:hover:not(:disabled) { border-color: var(--sang); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-muted); font-weight: 400; }
.btn-ghost:hover:not(:disabled) { color: var(--ink-strong); border-color: var(--line); background: var(--bg-elevated); }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }
.btn-xs { padding: 3px 8px; font-size: 0.78rem; }
.btn-lg { padding: 11px 20px; font-size: 1rem; }

/* Champs */
input[type="text"], input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
  background: var(--bg-well);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--ink-strong);
  width: 100%;
  min-width: 0;
}
select option { background: var(--bg-surface); color: var(--ink-strong); }
textarea { resize: vertical; min-height: 82px; line-height: 1.45; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 0.86rem; font-weight: 700; color: var(--ink-muted); }
.field-hint { font-size: 0.78rem; color: var(--ink-subtle); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

/* Pastilles et badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; line-height: 1.35;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--ink);
  white-space: nowrap;
}
.badge-azur { color: var(--azur); background: var(--azur-bg); border-color: var(--azur-border); }
.badge-sylve { color: var(--sylve); background: var(--sylve-bg); border-color: var(--sylve-border); }
.badge-braise { color: var(--braise); background: var(--braise-bg); border-color: var(--braise-border); }
.badge-sang { color: var(--sang); background: var(--sang-bg); border-color: var(--sang-border); }
.badge-brume { color: var(--brume); background: var(--brume-bg); border-color: var(--border); }

.role-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.74rem; font-weight: 700;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--ink-data);
}
.role-badge[data-tone="braise"], .role-badge[data-role="fondateur"] { color: var(--braise); border-color: var(--braise-border); background: var(--braise-bg); }
.role-badge[data-tone="azur"], .role-badge[data-role="chef_mj"] { color: var(--azur); border-color: var(--azur-border); background: var(--azur-bg); }
.role-badge[data-tone="sylve"], .role-badge[data-role="mj"] { color: var(--sylve); border-color: var(--sylve-border); background: var(--sylve-bg); }
.role-badge[data-tone="acier"], .role-badge[data-role="petit_mj"] { color: var(--ink-data); border-color: var(--border-strong); background: var(--bg-elevated); }
.role-badge[data-tone="sang"], .role-badge[data-role="chef_moderateur"] { color: var(--sang); border-color: var(--sang-border); background: var(--sang-bg); }
.role-badge[data-tone="amethyst"] { color: #b9a4dc; border-color: rgba(165, 146, 200, 0.48); background: rgba(165, 146, 200, 0.14); }
.role-badge[data-tone="brume"] { color: var(--brume); border-color: var(--border); background: var(--brume-bg); }
[data-theme="light"] .role-badge[data-tone="amethyst"] { color: #5b4384; border-color: rgba(91, 67, 132, 0.35); background: rgba(91, 67, 132, 0.1); }

.alert {
  padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-elevated); font-size: 0.92rem;
}
.alert-danger { border-color: var(--sang-border); background: var(--sang-bg); color: var(--sang); }
.alert-warn { border-color: var(--braise-border); background: var(--braise-bg); color: var(--braise); }
.alert-info { border-color: var(--azur-border); background: var(--azur-bg); color: var(--azur); }

/* Écran de connexion */
.login-shell {
  min-height: 100vh;
  display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at top, var(--bg-surface), var(--bg-deep) 70%);
}
.login-card {
  width: min(680px, 100%);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  box-shadow: var(--shadow-panel);
  display: flex; flex-direction: column; gap: 20px;
}
.login-brand { display: flex; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.login-brand h1 { font-size: 2.1rem; line-height: 1.05; }
.login-subtitle { color: var(--ink-muted); margin-top: 4px; }
.login-section { display: flex; flex-direction: column; gap: 12px; }
.demo-account-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.demo-account-btn {
  text-align: left; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-elevated);
  display: flex; flex-direction: column; gap: 4px;
}
.demo-account-btn:hover { border-color: var(--accent); background: var(--bg-page); }
.login-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; flex-wrap: wrap; }

/* Bandeau supérieur */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg-page); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1580px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-strong); }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.08; }
.brand-name { font-family: "Alegreya SC", Georgia, serif; font-size: 1.35rem; letter-spacing: 0.05em; }
.brand-sub { font-size: 0.76rem; color: var(--ink-muted); }

.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-tab {
  background: transparent; border: 1px solid transparent; border-radius: var(--radius);
  padding: 7px 13px; color: var(--ink-muted); font-weight: 700; font-size: 0.94rem;
  display: inline-flex; align-items: center; gap: 7px;
}
.nav-tab:hover { color: var(--ink-strong); border-color: var(--line); }
.nav-tab.active {
  color: var(--ink-strong); background: var(--bg-elevated); border-color: var(--border);
  box-shadow: var(--frost-top);
}
.tab-badge {
  background: var(--bg-surface); border: 1px solid var(--border); color: var(--braise);
  border-radius: 999px; padding: 0 6px; font-size: 0.72rem; font-family: Consolas, monospace;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo-switcher select { width: auto; max-width: 210px; padding: 5px 8px; font-size: 0.84rem; border-color: var(--braise-border); }
.user-pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: var(--radius); background: var(--bg-surface); border: 1px solid var(--line); }
.user-name { font-weight: 700; font-size: 0.88rem; color: var(--ink-strong); }

.theme-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.theme-switch button { background: transparent; border: 0; padding: 3px 8px; font-size: 0.78rem; color: var(--ink-muted); border-radius: 3px; }
.theme-switch button[aria-pressed="true"] { background: var(--bg-elevated); color: var(--ink-strong); }

.demo-banner {
  background: var(--braise-bg); border-top: 1px solid var(--braise-border);
  color: var(--ink); font-size: 0.82rem; padding: 5px 20px; text-align: center;
}

/* Zone principale */
.main-content { max-width: 1580px; margin: 0 auto; padding: 18px 20px 64px; }
.section-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.section-header h2 { font-size: 1.55rem; line-height: 1.15; }

.card {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px;
}

/* Cartes de veille du plateau */
.kpi-strip { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 16px; }
.kpi-card {
  background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.kpi-card.kpi-hot { border-color: var(--braise-border); }
.kpi-card.kpi-warn { border-color: var(--sang-border); }
.kpi-label { font-size: 0.8rem; color: var(--ink-muted); text-transform: none; }
.kpi-value { font-family: Consolas, monospace; font-size: 1.45rem; font-weight: 700; color: var(--ink-strong); }
.kpi-detail { font-size: 0.82rem; color: var(--ink-muted); }

/* Panneau d'alertes d'espacement */
.spacing-bar {
  background: var(--bg-surface); border: 1px solid var(--braise-border);
  border-left: 3px solid var(--braise);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.spacing-bar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; color: var(--braise); font-size: 0.9rem; }
.spacing-alert-list { display: flex; flex-direction: column; gap: 5px; }
.spacing-alert-item {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.86rem; color: var(--ink);
}
.spacing-link { background: transparent; border: 0; padding: 0; color: var(--azur); text-decoration: underline; font-size: 0.84rem; }

/* Barre d'outils et filtres */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar select, .toolbar input[type="search"] { width: auto; min-width: 145px; padding: 5px 9px; font-size: 0.86rem; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button {
  background: transparent; border: 0; border-right: 1px solid var(--border);
  padding: 5px 11px; font-size: 0.85rem; color: var(--ink-muted);
}
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--bg-elevated); color: var(--ink-strong); font-weight: 700; }
.cal-title { font-family: "Alegreya SC", Georgia, serif; font-size: 1.28rem; color: var(--ink-strong); min-width: 170px; text-align: center; }

.checkbox-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--ink-muted); cursor: pointer; }
.checkbox-inline input { width: auto; }

/* Grille mensuelle du calendrier */
.cal-month-wrap {
  background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden;
}
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--bg-elevated); border-bottom: 1px solid var(--line);
}
.cal-weekdays div {
  padding: 8px 10px; font-family: "Alegreya SC", Georgia, serif;
  font-size: 0.9rem; color: var(--ink-muted); text-align: center;
  border-right: 1px solid var(--line);
}
.cal-weekdays div:last-child { border-right: 0; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell {
  min-height: 132px; padding: 7px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 5px;
  background: var(--bg-surface); position: relative;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other-month { background: var(--bg-deep); opacity: 0.62; }
.cal-cell.is-today { background: rgba(126, 150, 165, 0.1); box-shadow: inset 0 2px 0 var(--braise); }
.cal-cell.has-overlap { box-shadow: inset 0 2px 0 var(--sang); }

.cal-cell-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal-day-num {
  font-family: Consolas, monospace; font-size: 0.84rem; font-weight: 700;
  color: var(--ink-muted); padding: 1px 6px; border-radius: 999px;
}
.cal-cell.is-today .cal-day-num { background: var(--braise-bg); color: var(--braise); border: 1px solid var(--braise-border); }
.cal-cell-meta { display: inline-flex; align-items: center; gap: 4px; }
.load-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.load-dot.warn { background: var(--sang); }
.load-dot.hot { background: var(--braise); }
.cal-add-btn {
  opacity: 0; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 4px; width: 22px; height: 22px; padding: 0; line-height: 1;
  color: var(--ink-strong); font-size: 0.9rem;
}
.cal-cell:hover .cal-add-btn, .cal-add-btn:focus-visible { opacity: 1; }

.cal-events { display: flex; flex-direction: column; gap: 4px; }
.cal-event-chip {
  text-align: left; width: 100%;
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-left: 3px solid var(--arc, var(--accent));
  border-radius: 4px; padding: 4px 6px;
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color 0.12s, transform 0.1s;
}
.cal-event-chip:hover { border-color: var(--accent); background: var(--bg-page); }
.cal-event-chip.is-hot { border-left-color: var(--braise); background: var(--braise-bg); }
.cal-event-chip.is-cancelled { opacity: 0.5; text-decoration: line-through; }
.cal-event-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 0.72rem; color: var(--ink-muted); font-family: Consolas, monospace; }
.cal-event-title { font-size: 0.82rem; font-weight: 700; color: var(--ink-strong); line-height: 1.22; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-event-region { font-size: 0.72rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Vue Semaine */
.week-grid { display: grid; gap: 10px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.week-col {
  background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 360px;
}
.week-col.is-today { border-color: var(--braise-border); }
.week-col-head { border-bottom: 1px solid var(--line); padding-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
.week-col-day { font-family: "Alegreya SC", Georgia, serif; font-size: 1rem; color: var(--ink-strong); }
.week-col-date { font-family: Consolas, monospace; font-size: 0.78rem; color: var(--ink-muted); }

/* Vue Chronologie / Liste */
.agenda-list { display: flex; flex-direction: column; gap: 10px; }
.agenda-row {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-left: 4px solid var(--arc, var(--accent));
  border-radius: var(--radius); padding: 12px 16px;
  display: grid; grid-template-columns: 165px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  cursor: pointer;
}
.agenda-row:hover { border-color: var(--accent); }
.agenda-time { font-family: Consolas, monospace; font-size: 0.85rem; color: var(--ink-data); }

/* Vue Trames */
.trame-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.trame-card {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-top: 3px solid var(--arc, var(--accent));
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer; transition: border-color 0.14s;
}
.trame-card:hover { border-color: var(--accent); }
.trame-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.trame-card h3 { font-size: 1.2rem; line-height: 1.22; }
.trame-meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.trame-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto;
  font-size: 0.82rem; color: var(--ink-muted);
}

/* Fiche détaillée d'une trame */
.trame-detail-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); gap: 18px; align-items: start; }
.trame-hero {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-left: 4px solid var(--arc, var(--accent));
  border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px;
}
.trame-hero h2 { font-family: "Alegreya", Georgia, serif; font-weight: 700; font-size: 1.7rem; margin: 6px 0 8px; }
.detail-stack { display: flex; flex-direction: column; gap: 16px; }
.sub-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 14px; flex-wrap: wrap; }

/* Journal d'avancement RP */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item {
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.timeline-title { font-weight: 700; color: var(--ink-strong); font-size: 1rem; }
.timeline-targets { font-size: 0.82rem; color: var(--ink-data); }

/* Équipe / Membres */
.member-list { display: flex; flex-direction: column; gap: 8px; }
.member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.member-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* Sondages */
.poll-list { display: flex; flex-direction: column; gap: 16px; }
.poll-card {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.poll-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.poll-options { display: flex; flex-direction: column; gap: 10px; }
.poll-option {
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.poll-option.is-best { border-color: var(--sylve-border); box-shadow: inset 3px 0 0 var(--sylve); }
.poll-option-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.poll-counts { display: flex; gap: 8px; flex-wrap: wrap; font-family: Consolas, monospace; font-size: 0.82rem; }
.vote-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.vote-btn {
  padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-surface);
  font-size: 0.82rem; color: var(--ink-muted);
}
.vote-btn.active[data-choice="dispo"] { background: var(--sylve-bg); border-color: var(--sylve-border); color: var(--sylve); font-weight: 700; }
.vote-btn.active[data-choice="peut_etre"] { background: var(--braise-bg); border-color: var(--braise-border); color: var(--braise); font-weight: 700; }
.vote-btn.active[data-choice="indispo"] { background: var(--sang-bg); border-color: var(--sang-border); color: var(--sang); font-weight: 700; }
.voter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.voter-chip { font-size: 0.78rem; padding: 2px 8px; border-radius: 4px; background: var(--bg-surface); border: 1px solid var(--line); }

/* Commentaires */
.comment-list { display: flex; flex-direction: column; gap: 8px; }
.comment-item {
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
}
.comment-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.comment-body { white-space: pre-wrap; word-break: break-word; font-size: 0.94rem; }

/* Matrice des permissions (Fondateur) */
.perm-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg-surface); }
.perm-table { width: 100%; border-collapse: collapse; min-width: 820px; }
.perm-table th, .perm-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table th:first-child, .perm-table td:first-child { text-align: left; min-width: 280px; }
.perm-table thead th { background: var(--bg-elevated); font-family: "Alegreya SC", Georgia, serif; font-size: 0.92rem; color: var(--ink-strong); position: sticky; top: 0; }
.perm-family-row td { background: var(--bg-deep); font-family: "Alegreya SC", Georgia, serif; font-size: 0.95rem; color: var(--braise); text-align: left !important; padding: 8px 12px; }
.perm-toggle {
  width: 32px; height: 26px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg-deep); color: var(--ink-subtle);
  font-weight: 700; font-size: 0.86rem;
}
.perm-toggle.on { background: var(--sylve-bg); border-color: var(--sylve-border); color: var(--sylve); }
.perm-toggle:disabled { opacity: 0.55; cursor: not-allowed; }

.discord-map-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.audit-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.audit-table th, .audit-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.audit-table thead th { background: var(--bg-elevated); color: var(--ink-muted); font-weight: 700; }

/* Volet latéral (Drawer) */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(6, 10, 14, 0.55); z-index: 80;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 96vw);
  background: var(--bg-page); border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-panel); z-index: 90;
  display: flex; flex-direction: column; overflow: hidden;
}
.drawer-header {
  padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--bg-surface);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.drawer-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; flex: 1; }

/* Modales */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6, 10, 14, 0.68); z-index: 100;
  display: grid; place-items: center; padding: 18px; overflow-y: auto;
}
.modal-dialog {
  width: min(640px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-panel);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 16px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; flex-wrap: wrap; }

/* Utilitaires de mise en page (permet une CSP stricte style-src 'self' sans unsafe-inline) */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 24px; }
.p-sm { padding: 10px; }
.p-md { padding: 12px; }
.gap-sm { gap: 8px; }
.flex-1 { flex: 1; }
.w-auto { width: auto; }
.text-right { text-align: right; }
.pre-wrap { white-space: pre-wrap; }
.justify-between { justify-content: space-between; }
.bg-elevated { background: var(--bg-elevated); }
.border-top-line { padding-top: 10px; border-top: 1px solid var(--line); }
.overflow-x { overflow-x: auto; }
.stack-form { display: flex; flex-direction: column; gap: 8px; }
.drawer-title { margin-top: 8px; font-size: 1.35rem; }
.vote-note-input { max-width: 240px; padding: 4px 8px; font-size: 0.82rem; }

/* Couleurs d'arc narratif (sans style inline) */
.arc-steel { --arc: #7E96A5; --swatch: #7E96A5; }
.arc-ember { --arc: #E0B36A; --swatch: #E0B36A; }
.arc-sylve { --arc: #7EB88A; --swatch: #7EB88A; }
.arc-azur { --arc: #69B7D1; --swatch: #69B7D1; }
.arc-clay { --arc: #D98A7A; --swatch: #D98A7A; }
.arc-amethyst { --arc: #A592C8; --swatch: #A592C8; }
.arc-parchment { --arc: #C5A880; --swatch: #C5A880; }

/* Tickets Discord */
.scan-panel {
  background: var(--bg-surface); border: 1px solid var(--azur-border);
  border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.scan-list { display: flex; flex-direction: column; gap: 8px; }
.scan-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.scan-row.is-non-trame { opacity: 0.72; }

.ticket-list { display: flex; flex-direction: column; gap: 14px; }
.ticket-card {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.ticket-card.is-ignored { opacity: 0.72; }
.ticket-card.is-confidential { border-left: 3px solid var(--sang); }
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ticket-dossier-grid {
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  padding: 12px; background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.dossier-field { display: flex; flex-direction: column; gap: 3px; }
.dossier-field.full { grid-column: 1 / -1; }
.dossier-label { font-size: 0.76rem; font-weight: 700; color: var(--ink-muted); letter-spacing: 0.02em; }
.dossier-value { font-size: 0.92rem; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.ticket-links-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ticket-link-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--azur-border); background: var(--bg-surface);
  color: var(--azur); font-size: 0.84rem; text-decoration: none;
}
.ticket-link-pill:hover { border-color: var(--azur); }
.form-fields-editor { display: flex; flex-direction: column; gap: 8px; }
.form-field-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px; background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.checkbox-inline input[type="checkbox"] { width: auto; }
.rules-table td, .rules-table th { vertical-align: middle; }
.rules-table td:first-child { width: 150px; }
.rules-table td:nth-child(3) { width: 210px; }
.rules-table td:nth-child(4) { width: 110px; }
.rules-table td:last-child { width: 84px; text-align: right; }
.rules-add-row {
  display: grid; grid-template-columns: 150px minmax(180px, 1fr) 200px auto auto;
  gap: 8px; align-items: center;
  padding: 10px; background: var(--bg-elevated); border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.ticket-actions-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--line);
}
.ticket-mini-card {
  padding: 10px 12px; background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 6px;
}
.ticket-mini-card details summary { cursor: pointer; font-size: 0.84rem; color: var(--azur); }

/* Swatches couleur de trame */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent;
  background: var(--swatch);
}
.color-swatch.selected { border-color: var(--ink-strong); box-shadow: 0 0 0 2px var(--bg-surface); }

/* Toasts */
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 140; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--ink-strong);
  padding: 10px 14px; border-radius: var(--radius); box-shadow: var(--shadow-panel); font-size: 0.9rem;
}
.toast.ok { border-color: var(--sylve-border); }
.toast.err { border-color: var(--sang-border); color: var(--sang); }

.empty-state {
  padding: 30px 18px; text-align: center; color: var(--ink-muted);
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* Responsive */
@media (max-width: 1120px) {
  .trame-detail-layout { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .cal-weekdays { display: none; }
  .cal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .rules-add-row { grid-template-columns: 1fr; }
  .agenda-row { grid-template-columns: 1fr; gap: 6px; }
  .week-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .cal-grid { grid-template-columns: 1fr; }
  .topbar-inner { padding: 10px 12px; }
  .main-content { padding: 14px 12px 48px; }
}
