/* Backoffice — same palette as the public site, plus form and table bits. */

:root {
  /* chart hues: brand cyan and violet, stepped down for the dark card surface */
  --flow-out:  #1a9cb8;
  --flow-keep: #8f7cf7;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.86em;
  color: var(--mi);
  background: rgba(33 207 189 / 0.08);
  border: 1px solid rgba(33 207 189 / 0.22);
  border-radius: 6px;
  padding: 0.1rem 0.4rem;
}

/* ---------- login ---------- */
.auth-wrap {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-content: center;
  padding: 2.4rem var(--pad);
}
.auth-card {
  width: min(27rem, 100%);
  margin: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.7rem 1.7rem 1.9rem;
  background: linear-gradient(160deg, rgba(255 255 255 / 0.045), transparent 60%);
}
.auth-title { font-size: 1.9rem; margin-top: 0.5rem; }

.field { display: block; margin-top: 1.1rem; }
.field span {
  display: block;
  font-family: var(--font-d);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mut);
  margin-bottom: 0.4rem;
}
.field input, .field select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: rgba(255 255 255 / 0.04);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 0.62rem 0.8rem;
  transition: border-color 0.25s;
}
.field input:hover, .field select:hover { border-color: rgba(33 181 207 / 0.45); }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--mi); outline-offset: 2px; }
/* Sans cette déclaration, l'icône du calendrier reste noire sur un champ sombre. */
.field input[type="date"] { color-scheme: dark; }

.btn.full { display: flex; width: 100%; justify-content: center; margin-top: 1.5rem; cursor: pointer; }
.auth-back { margin-top: 1.1rem; text-align: center; }
.auth-back a { color: var(--mut); text-decoration: none; }
.auth-back a:hover { color: var(--mi); }

.alert, .note {
  margin: 1.2rem 0 0;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
}
.alert {
  border: 1px solid rgba(255 132 132 / 0.35);
  background: rgba(255 132 132 / 0.08);
  color: #ffd6d6;
}
.note {
  border: 1px solid rgba(143 124 247 / 0.3);
  background: rgba(143 124 247 / 0.08);
  color: #d9d1ff;
}

/* ---------- dashboard ---------- */
.admin-top .wrap { gap: 1rem; }
.admin-top .langs { gap: 0.8rem; }
.admin-top form { margin: 0; }
.admin-top .who {
  font-family: var(--font-d);
  font-size: 0.85rem;
  color: var(--mut);
}
.admin-top .lang-btn { cursor: pointer; font: inherit; font-size: 0.8rem; }

.section-title {
  font-family: var(--font-d);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2.4rem 0 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.2rem;
  font-size: 0.9rem;
}
.table th, .table td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th {
  font-family: var(--font-d);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mut);
  font-weight: 500;
}
.table td:nth-child(2) { color: var(--mut); }

/* Le défilement d'un tableau reste dans sa carte : la page ne s'élargit pas. */
.table-scroll { overflow-x: auto; margin-top: 1.2rem; }
.table-scroll > .table { margin-top: 0; }

@media (max-width: 700px) {
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
  .table { font-size: 0.82rem; }
  .table th, .table td { padding: 0.5rem 0.45rem; }
}

/* ---------- indemnity calculation ---------- */
.calc-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.2rem;
  align-items: start;
  margin-top: 1.4rem;
}
.calc-main { grid-column: 1; grid-row: 1; }

.calc-panel {
  grid-column: 2;
  grid-row: 1;
  /* wide enough that the summary's three lines each stay on one line */
  width: 15.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
}
.calc-panel[open] { width: 20rem; }
/* only the closed panel sticks: an open form has to scroll with the page */
.calc-panel:not([open]) { position: sticky; top: 4.6rem; }
.calc-panel > summary {
  position: relative;
  padding: 0.9rem 2.1rem 0.95rem 1.05rem;
  cursor: pointer;
  list-style: none;
  transition: background 0.25s;
}
.calc-panel > summary::-webkit-details-marker { display: none; }
.calc-panel > summary:hover { background: rgba(255 255 255 / 0.03); }
.calc-panel[open] > summary { border-bottom: 1px solid var(--line); }
.calc-panel > summary::after {
  content: "";
  position: absolute;
  right: 1.05rem;
  top: 1.2rem;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--mut);
  border-bottom: 1.5px solid var(--mut);
  transform: rotate(45deg);
  transition: transform 0.25s;
}
.calc-panel[open] > summary::after { transform: rotate(-135deg); }
.panel-title {
  display: block;
  font-family: var(--font-d);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--mut);
}
.panel-state { display: block; margin-top: 0.3rem; font-size: 0.84rem; color: var(--ink); }
.calc-panel .calc-form {
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 1.05rem 1.1rem 1.2rem;
  background: none;
}
/* the sidebar is narrower than the page the form used to fill — below 901px the panel is full width, so the form keeps its own tracks */
@media (min-width: 901px) {
  .calc-panel .charge-list li { grid-template-columns: minmax(0, 1fr) 5.5rem 2rem; gap: 0.4rem; }
  .calc-panel .calc-actions { gap: 0.55rem; }
  .calc-panel .calc-actions .btn { padding: 0.6rem 1rem; }
}

.calc-form {
  margin-top: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.15rem 1.3rem 1.3rem;
  background: linear-gradient(160deg, rgba(255 255 255 / 0.03), transparent 60%);
}
.calc-form .field { margin-top: 0; }
.calc-form .hint { font-size: 0.78rem; color: var(--mut); margin: 0.4rem 0 0; }
.calc-form .fine { margin-top: 1.1rem; font-size: 0.76rem; }

.charge-list { list-style: none; margin: 0.45rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.charge-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8.5rem 2.1rem;
  gap: 0.5rem;
}
.charge-list input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: rgba(255 255 255 / 0.04);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  transition: border-color 0.25s;
}
.charge-list input:hover { border-color: rgba(33 181 207 / 0.45); }
.charge-list input:focus-visible { outline: 2px solid var(--mi); outline-offset: 2px; }
.charge-list .new input { border-style: dashed; }
.charge-remove {
  font: inherit;
  color: var(--mut);
  background: rgba(255 255 255 / 0.04);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.charge-remove:hover { color: #ffd6d6; border-color: rgba(255 132 132 / 0.45); background: rgba(255 132 132 / 0.08); }

.calc-actions { display: flex; gap: 0.7rem; margin-top: 1.2rem; flex-wrap: wrap; }
.calc-actions button[type="submit"] { cursor: pointer; }

/* 2 columns: the side panel takes the width 4 tiles used to have */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.kpi {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem 1.15rem 1.15rem;
  background: linear-gradient(160deg, rgba(255 255 255 / 0.035), transparent 60%);
}
.kpi-label {
  font-family: var(--font-d);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mut);
}
.kpi-value {
  font-family: var(--font-d);
  font-weight: 600;
  font-size: clamp(1.45rem, 1.05rem + 1.5vw, 2rem);
  line-height: 1.12;
  color: var(--ink);
}
.kpi-note { font-size: 0.78rem; color: var(--mut); }

.waterfall {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.2rem 1.3rem 1rem;
  background: linear-gradient(160deg, rgba(255 255 255 / 0.03), transparent 60%);
}
.wf-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.wf-head h3 { font-family: var(--font-d); font-size: 0.95rem; font-weight: 600; }
.wf-legend { list-style: none; display: flex; gap: 1rem; margin: 0; padding: 0; font-size: 0.78rem; color: var(--mut); }
.wf-legend li { display: flex; align-items: center; gap: 0.4rem; }
.wf-legend i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.sw-out { background: var(--flow-out); }
.sw-keep { background: var(--flow-keep); }

.wf-row {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr) 6.5rem;
  gap: 0.9rem;
  align-items: center;
  margin-top: 0.55rem;
}
.wf-label { font-size: 0.85rem; color: var(--mut); }
.wf-track { position: relative; height: 18px; border-radius: 4px; background: rgba(255 255 255 / 0.05); }
.wf-bar { position: absolute; top: 0; height: 100%; min-width: 2px; border-radius: 4px; }
.wf-bar.out { background: var(--flow-out); }
.wf-bar.keep { background: var(--flow-keep); }
.wf-ca { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }
.wf-value { text-align: right; font-size: 0.86rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wf-final { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.wf-final .wf-label, .wf-final .wf-value { color: var(--ink); font-weight: 600; }
.wf-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: var(--mut);
  font-variant-numeric: tabular-nums;
}

/* auto-fit: the details sit next to the panel, so their width depends on the panel state, not the viewport */
.calc-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.detail {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem 1.15rem 1.15rem;
}
.detail h3 {
  font-family: var(--font-d);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mut);
  margin-bottom: 0.6rem;
}
.detail dl { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 0.8rem; margin: 0; font-size: 0.85rem; }
.detail dt { color: var(--mut); }
.detail dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail .sum { border-top: 1px solid var(--line); padding-top: 0.4rem; color: var(--ink); font-weight: 600; }
.detail .empty { margin: 0; font-size: 0.85rem; color: var(--mut); }

@media (max-width: 900px) {
  .calc-shell { grid-template-columns: 1fr; }
  .calc-panel, .calc-main { grid-column: 1; grid-row: auto; }
  .calc-panel, .calc-panel[open] { width: auto; }
  .calc-panel:not([open]) { position: static; }
  /* Le bloc identité ne se réduit pas : autoriser la ligne à casser évite qu'elle déborde. */
  .admin-top .wrap { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .admin-top .mods { order: 3; width: 100%; margin: 0.2rem 0 0; }
  .kpis { grid-template-columns: 1fr; }
  .charge-list li { grid-template-columns: 1fr 1fr; }
  .charge-remove { grid-column: 2; justify-self: end; min-width: 2.4rem; }
  .wf-row { grid-template-columns: 1fr auto; gap: 0.35rem; }
  .wf-label { grid-column: 1; grid-row: 1; }
  .wf-value { grid-column: 2; grid-row: 1; }
  .wf-track { grid-column: 1 / -1; grid-row: 2; }
  .wf-value { font-size: 0.82rem; }
}

/* ---------- module navigation ---------- */
.admin-top .mods {
  display: flex;
  /* Jamais de retour à la ligne à l'intérieur du nav : les icônes restent côte à côte. */
  flex-wrap: nowrap;
  justify-content: center;
  gap: 1rem;
  margin: 0 0.6rem;
}
.mods .mod {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--mut);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0.42rem;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.mods .mod .icon { width: 1.7rem; height: 1.7rem; }
.mods .mod:hover { color: var(--ink); border-color: var(--line-2); }
.mods .mod.active {
  color: var(--mi);
  border-color: rgba(33 181 207 / 0.5);
  background: rgba(33 181 207 / 0.1);
}

/* ---------- module launcher ---------- */
.cards.modules { margin-top: 2.2rem; }
@media (min-width: 900px) { .cards.modules { grid-template-columns: repeat(3, 1fr); } }
.modules .card {
  --card-bg: linear-gradient(160deg, rgba(255 255 255 / 0.03), transparent 60%);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 1.1rem;
  color: inherit;
  text-decoration: none;
  background: var(--card-bg);
}
.modules .card .icon { grid-column: 1; grid-row: 1; width: 3.2rem; height: 3.2rem; margin: auto; }
.modules .card h3 { grid-column: 2; grid-row: 1; }
.modules .card p { grid-column: 2; grid-row: 2; }
/* Pas de surlignage au survol : la carte ne change que de bordure. */
.modules .card:hover, .modules .card:focus-visible {
  transform: none;
  border-color: var(--line-2);
  background: var(--card-bg);
}
.modules .card:hover .icon { color: var(--cy); }

/* ---------- time-tracker ---------- */
.field-date { max-width: 12rem; }

.tt-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.8rem 1.2rem;
  margin-top: 1.4rem;
  margin-bottom: 0.4rem;
}
.tt-filters .field { margin: 0; }
.tt-range { display: flex; align-items: center; gap: 0.6rem; }
.tt-window {
  margin: 0;
  font-family: var(--font-d);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  min-width: 14rem;
  text-align: center;
}
.tt-arrow { color: var(--mut); }
.tt-step {
  width: 2rem; height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--mut);
  text-decoration: none;
  transition: border-color 0.25s, color 0.25s;
}
.tt-step:hover, .tt-step:focus-visible { color: var(--mi); border-color: rgba(33 181 207 / 0.45); }
.tt-apply { cursor: pointer; }

.tt-card, .tt-heat {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.2rem 1.3rem 1.25rem;
  background: linear-gradient(160deg, rgba(255 255 255 / 0.03), transparent 60%);
  margin-top: 1rem;
}
.card-head h3 { font-family: var(--font-d); font-size: 0.95rem; font-weight: 600; margin: 0; }
.card-sub { margin: 0.25rem 0 0; font-size: 0.78rem; color: var(--mut); }
.tt-empty { margin: 1.1rem 0 0; font-size: 0.85rem; color: var(--mut); }

/* Calendrier d'intensité : une teinte, quatre paliers, la clarté porte la valeur. */
.tt-heat {
  --hm-cell: 14px;
  --hm-gap: 4px;
  --hm-labels: 2.4rem;
  --hm-1: #1a5566;
  --hm-2: #227a90;
  --hm-3: #2a9fb8;
  --hm-4: #42c0d6;
}
.hm-scroll { overflow-x: auto; padding-bottom: 0.3rem; margin-top: 1.1rem; }
.hm-inner {
  display: grid;
  grid-template-columns: var(--hm-labels) 1fr;
  column-gap: 0.5rem;
  row-gap: 0.4rem;
}
/* Les libellés de mois sont posés sur les mêmes colonnes que les cases : le pas n'a plus à être connu. */
.hm-months, .hm-grid {
  grid-template-columns: repeat(var(--hm-weeks), minmax(var(--hm-cell), 1fr));
  gap: var(--hm-gap);
  /* Le même resserrage des deux côtés : sinon les libellés glissent par rapport aux colonnes. */
  padding: 0 0.25rem;
}
.hm-months { grid-column: 2; grid-row: 1; display: grid; height: 1.1rem; }
.hm-months span {
  font-size: 0.72rem;
  color: var(--mut);
  white-space: nowrap;
}
.hm-weeks {
  grid-column: 1; grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, var(--hm-cell));
  gap: var(--hm-gap);
}
.hm-weeks span { font-size: 0.68rem; line-height: var(--hm-cell); color: var(--mut); }
.hm-grid {
  grid-column: 2; grid-row: 2;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--hm-cell));
}
.hm-cell { display: block; height: var(--hm-cell); border-radius: 3px; width: 100%; }
.hm-l0 { background: rgba(255 255 255 / 0.05); }
.hm-l1 { background: var(--hm-1); }
.hm-l2 { background: var(--hm-2); }
.hm-l3 { background: var(--hm-3); }
.hm-l4 { background: var(--hm-4); }
.hm-today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--mut); }
.hm-selected { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
a.hm-cell:hover, a.hm-cell:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--mi); }
.hm-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.9rem;
  margin-top: 0.9rem;
  font-size: 0.75rem;
  color: var(--mut);
}
.hm-legend-title {
  font-family: var(--font-d);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hm-legend-item { display: flex; align-items: center; gap: 0.4rem; }
.hm-legend .hm-cell { width: 12px; height: 12px; }

/* Frise de la journée : un bloc par séance, les chevauchements montent de voie. */
.tl { margin-top: 1.1rem; }
.tl-plot { position: relative; display: grid; grid-auto-rows: 22px; row-gap: 4px; }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl-lane { position: relative; }
.tl-block {
  position: absolute;
  top: 0; height: 100%;
  min-width: 3px;
  border-radius: 4px;
  background: var(--c);
}
.tl-axis { position: relative; height: 1.1rem; margin-top: 0.45rem; }
.tl-axis span {
  position: absolute;
  font-size: 0.7rem;
  color: var(--mut);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Répartition par tâche : la barre porte la couleur du projet, le texte porte l'identité. */
.tb-list { list-style: none; margin: 1.1rem 0 0; padding: 0; }
.tb-row {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr) 4.6rem;
  gap: 0.9rem;
  align-items: center;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}
.tb-row:first-child { border-top: 0; }
.tb-label { display: grid; gap: 0.15rem; min-width: 0; }
.tb-label b { font-size: 0.88rem; font-weight: 500; color: var(--ink); }
.tb-label small { font-size: 0.74rem; color: var(--mut); }
.tb-track { position: relative; height: 14px; border-radius: 4px; background: rgba(255 255 255 / 0.05); }
.tb-bar { position: absolute; top: 0; height: 100%; min-width: 3px; border-radius: 4px; background: var(--c); }
.tb-value { text-align: right; font-size: 0.86rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-value small { display: block; font-size: 0.72rem; color: var(--mut); }
@media (max-width: 620px) {
  .tb-row { grid-template-columns: minmax(0, 1fr) 4.6rem; }
  .tb-track { grid-column: 1 / -1; grid-row: 2; }
}

.tt-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 1rem 0 0; padding: 0; font-size: 0.78rem; color: var(--mut); }
.tt-legend li { display: flex; align-items: center; gap: 0.4rem; }
.tt-legend i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

.tt-tip {
  position: fixed;
  z-index: 30;
  max-width: 17rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #0f141c;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
}
.tt-tip.on { opacity: 1; }

.dot {
  display: inline-block;
  width: 0.5rem; height: 0.5rem;
  border-radius: 99px;
  margin-right: 0.5rem;
  background: currentColor;
}

.day-table { margin-top: 0.4rem; }
.day-table td:first-child, .day-table td:last-child { white-space: normal; }
.day-table td:last-child { color: var(--mut); }

/* Facturation : la saisie tient sur deux colonnes, les listings les suivent. */
.bill-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.1rem;
  margin-top: 1.1rem;
}
.bill-fields .field { margin: 0; }
.bill-estimate {
  margin: 1.1rem 0 0;
  font-size: 0.85rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tt-card .fine { margin-top: 1rem; }
.table tfoot td {
  border-top: 1px solid var(--line-2);
  border-bottom: 0;
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 620px) {
  .bill-fields { grid-template-columns: 1fr; }
}
