/*
 * Quarta Radar · composants (cahier des charges §9.3).
 * Tout est fait de pilules gris très clair et de panneaux à grands arrondis.
 * Pas de bordures marquées, pas d'ombres, pas de couleurs : le texte reste monochrome.
 */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: var(--fw);
  line-height: var(--lh);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
::selection { background: var(--color-surface-hover); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Mise en page en deux colonnes ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--col-left) var(--col-right);
  column-gap: var(--col-gap);
  justify-content: center;
  align-items: start;
  padding: 110px 16px 80px;
}

.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.section { display: flex; flex-direction: column; gap: var(--gap); }

/* ---------- Triangles pleins (seuls signes graphiques) ---------- */

.tri {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 6px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);           /* ▼ */
  transition: color var(--t-fast) var(--ease);
}
.tri--up { clip-path: polygon(50% 0, 100% 100%, 0 100%); }      /* ▲ */
.tri--right { width: 6px; height: 7px; clip-path: polygon(0 0, 100% 50%, 0 100%); } /* ▶ */

/* ---------- 1. Pilule-accordéon ---------- */

.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--pill-h);
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  text-align: left;
  white-space: nowrap;
}

.toggle { width: var(--col-right); color: var(--color-text); }
.toggle .tri { color: var(--color-muted); }
.toggle:hover .tri, .toggle[aria-expanded="true"] .tri { color: var(--color-text); }
.toggle[aria-expanded="true"] .tri { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.toggle .count { margin-left: auto; color: var(--color-label); }
.toggle:focus-visible, .action:focus-visible, .field:focus-visible { outline: 1px solid var(--color-line); outline-offset: 1px; }

.col--right .toggle { width: 100%; }

/* Le panneau s'ouvre sous la pilule ; la hauteur et l'opacité sont animées par app.js. */
.collapse { overflow: hidden; transition: height var(--t-accordion) var(--ease), opacity var(--t-accordion) var(--ease); }
.collapse[hidden] { display: none; }

/* ---------- 2. Panneau ---------- */

.panel {
  background: var(--color-surface);
  border-radius: var(--radius-panel);
  padding: var(--panel-pad);
}

.panel--table { padding: 14px 14px 22px; }

/* Rubriques en petites capitales (INFORMATION, SERVICES… dans la référence) */
.label {
  display: block;
  padding-bottom: 5px;
  margin-bottom: 9px;
  border-bottom: 1px solid var(--color-line);
  color: var(--color-label);
  font-size: var(--fs-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.block + .block { margin-top: 26px; }
.block p { margin: 0; }
.block p + p { margin-top: 8px; }
.list { margin: 0; padding: 0; list-style: none; }
.muted { color: var(--color-text-2); }
.faint { color: var(--color-label); }

/* ---------- 3. Tableau ---------- */

.table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table th {
  padding: 0 0 5px;
  border-bottom: 1px solid var(--color-line);
  color: var(--color-label);
  font-size: var(--fs-label);
  font-weight: var(--fw);
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}
.table td {
  height: var(--row-h);
  padding: 3px 8px 2px 0;
  border-bottom: 1px solid var(--color-line);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.table .c-num { width: 14%; }
.table .c-title { width: 40%; }
.table .c-source { width: 13%; }
.table .c-score { width: 9%; }
.table .c-deadline { width: 12%; }
.table .c-date { width: 12%; }
.table .c-reason { width: 34%; }
.table td.c-num { position: relative; overflow: visible; }

/* Point de 4 px devant le numéro d'une mission non vue */
.dot {
  position: absolute;
  left: -8px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--color-text-2);
}

.row { cursor: pointer; transition: color var(--t-fast) var(--ease); }

/* 4. Survol : la ligne survolée s'estompe (comme « Dolly Cohen » dans la référence) */
@media (hover: hover) {
  .row:hover, .row:hover .faint { color: var(--color-muted); }
}
.row.is-open { color: var(--color-text); }
.soon { color: var(--color-text); }
.soon::after { content: " · 48 h"; color: var(--color-text-2); }

.detail > td { height: auto; padding: 0; white-space: normal; border-bottom: 0; }
.detail-inner { padding: 12px 0 16px; border-bottom: 1px solid var(--color-line); }
.empty { padding: 10px 0 0; color: var(--color-label); }

/* Aperçu flottant qui suit le curseur (désactivé au toucher) */
.preview {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 236px;
  padding: 12px;
  border-radius: var(--radius-panel);
  background: var(--color-bg);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
  white-space: normal;
}
.preview.is-visible { opacity: 1; }
.preview .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.preview p { margin: 0; }
.preview p + p { margin-top: 6px; }

/* ---------- 5. Pilule d'action ---------- */

.actions { display: flex; flex-direction: column; gap: var(--gap); margin-top: 14px; }
.actions--grid { display: grid; grid-template-columns: 1fr 1fr; }

.action { width: 100%; color: var(--color-text); }
.action .tri { color: var(--color-muted); }
.action:hover .tri { color: var(--color-text); }
.action:hover { background: var(--color-surface-hover); }
.panel .action { background: var(--color-bg); }
.panel .action:hover { background: var(--color-surface-hover); }
.action[disabled] { cursor: default; color: var(--color-label); }
.action[disabled] .tri { color: var(--color-muted); }

/* ---------- 6. Pilule de pied de page ---------- */

.foot { justify-content: center; color: var(--color-text); }
.foot--status { color: var(--color-text-2); }

/* ---------- 7. Chip sur fond ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--color-overlay);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 10px;
}
.preview .chip { background: var(--color-surface); }
.chip--select { cursor: pointer; border: 0; background: var(--color-bg); color: var(--color-text-2); }
.chip--select[aria-pressed="true"] { background: var(--color-surface-hover); color: var(--color-text); }

/* ---------- 8. Champs de saisie ---------- */

.field {
  width: 100%;
  min-height: var(--pill-h);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--color-bg);
  outline: none;
  appearance: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.section > .field { background: var(--color-surface); }
.field:focus { background: var(--color-surface-hover); border-color: var(--color-line); }
textarea.field { min-height: 88px; padding: 8px 14px; border-radius: var(--radius-panel); resize: vertical; }
select.field { padding-right: 28px; }
.field::placeholder { color: var(--color-label); }

.form { display: flex; flex-direction: column; gap: var(--gap); }
.form-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 8px; }
.form-row > span { color: var(--color-text-2); }

/* ---------- Fiche mission ---------- */

.facts { display: grid; grid-template-columns: 92px 1fr; gap: 2px 10px; margin: 0; }
.facts dt { color: var(--color-label); }
.facts dd { margin: 0; }
.fulltext {
  max-height: 260px;
  overflow: auto;
  white-space: pre-line;
  color: var(--color-text-2);
}
.fulltext--page { max-height: none; }
.reasons { display: flex; flex-wrap: wrap; gap: 4px; }
.score-big { font-size: 22px; line-height: 1; letter-spacing: -0.01em; }

/* Liste des sources dans le panneau de droite */
.source { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 0; border-bottom: 1px solid var(--color-line); }
.source:first-child { padding-top: 0; }
.source .action { grid-column: 1 / -1; margin-top: 4px; }
.source-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.link-btn { border: 0; padding: 0; background: none; color: var(--color-text-2); }
.link-btn:hover { color: var(--color-text); }

/* ---------- Connexion ---------- */

.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login .section { width: var(--col-right); }
.error { color: var(--color-text); }
.error::before { content: "— "; color: var(--color-label); }

.page { max-width: calc(var(--col-left) + var(--col-gap) + var(--col-right)); }

/* ---------- Mobile : une seule colonne (prioritaire : les notifications s'ouvrent sur téléphone) ---------- */

@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); row-gap: 24px; padding: 24px 16px 48px; }
  .toggle { width: 100%; }
  .table .c-source, .table .c-date { display: none; }
  .table .c-num { width: 12%; }
  .table .c-title { width: 54%; }
  .table .c-score { width: 12%; }
  .table .c-deadline { width: 22%; }
  .table .c-reason { width: 30%; }
  .actions--grid { grid-template-columns: 1fr; }
  .preview { display: none; }
  .dot { left: -7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}

.reasons-wrap { margin-top: 12px; }
.last-feedback { margin: 10px 0 0; }

textarea.field--tall { min-height: 220px; font-size: var(--fs-body); line-height: 1.5; }
.source-note { grid-column: 1 / -1; }
