/* Vestra Admin — l'atelier.
 * Vestra est la penderie ; l'administration est l'atelier derrière : même papier chaud et
 * même laiton, colonne sombre couleur d'encre, aucune image de vêtement. Les états ont chacun
 * leur couleur ET leur signe (✓ ! ✕ –), jamais la couleur seule : vert = opérationnel,
 * ambre = à surveiller, rouge = en panne, gris = non configuré. */
:root {
  --paper: #f4efe8;
  --card: #fbf8f3;
  --line: rgb(48 36 24 / 12%);
  --ink: #221c16;
  --ink-2: #5d5247;
  --muted: #7d7165;
  --side: #1f1a15;
  --side-ink: #e9dfd2;
  --side-muted: #a39584;
  --brass: #a8743a;
  --brass-ink: #7a5222;
  --brass-soft: #f1e3cf;
  --bar: #a8743a;
  --track: #ebe1d3;
  --ok: #2f7a4f;
  --ok-soft: #e1f0e6;
  --warn: #9a6412;
  --warn-soft: #f8ebd2;
  --bad: #b3362f;
  --bad-soft: #f8e0dd;
  --off: #6f665d;
  --off-soft: #ece7e0;
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", "Palatino", "Book Antiqua", "Georgia", serif;
  --sans: -apple-system, "BlinkMacSystemFont", "Segoe UI", "Roboto", "Helvetica Neue", "Arial", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  margin: 0;
}

a {
  color: var(--brass-ink);
}

h1,
h2 {
  line-height: 1.2;
  margin: 0;
}

h1 {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 500;
}

h2 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--bad);
}

.warn-text {
  color: var(--warn);
}

/* ---------------------------------------------------------------- boutons */
.btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--brass);
}

.btn:focus-visible,
a:focus-visible,
.link:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brass-ink);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.6;
}

.btn.small {
  font-size: 0.85rem;
  padding: 5px 12px;
}

.link {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
  text-decoration: underline;
}

/* ---------------------------------------------------------------- cadre */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.side {
  background: var(--side);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  align-items: baseline;
  color: var(--side-ink);
  display: flex;
  gap: 10px;
  padding: 0 8px;
  text-decoration: none;
}

.logo {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-style: italic;
  letter-spacing: -0.02em;
}

.tag {
  color: var(--brass);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.side nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side nav a {
  border-radius: 8px;
  color: var(--side-muted);
  font-weight: 600;
  padding: 9px 10px;
  text-decoration: none;
}

.side nav a:hover {
  color: var(--side-ink);
}

.side nav a[aria-current="page"] {
  background: rgb(255 240 220 / 9%);
  color: var(--side-ink);
  box-shadow: inset 3px 0 0 var(--brass);
}

.privacy {
  border-top: 1px solid rgb(255 240 220 / 12%);
  color: var(--side-muted);
  font-size: 0.8rem;
  margin: 0;
  padding: 14px 8px 0;
}

.who {
  color: var(--side-muted);
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  gap: 6px;
  margin-top: auto;
  padding: 0 8px;
}

.who span {
  color: var(--side-ink);
  overflow: hidden;
  text-overflow: ellipsis;
}

.who a {
  color: var(--side-muted);
}

.main {
  max-width: 1180px;
  padding: 30px 40px 60px;
  width: 100%;
}

.head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.tools {
  display: flex;
  gap: 8px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.empty {
  padding: 60px 0;
  text-align: center;
}

/* ---------------------------------------------------------------- tableau de bord */
.banner {
  align-items: center;
  border-radius: var(--radius);
  color: var(--ink);
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px 16px;
  text-decoration: none;
}

.banner.st-ok {
  background: var(--ok-soft);
}

.banner.st-warn {
  background: var(--warn-soft);
}

.banner.st-bad {
  background: var(--bad-soft);
}

.banner .go {
  color: var(--ink-2);
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
}

.tiles {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 18px;
}

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  text-decoration: none;
}

.tile b {
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 500;
  line-height: 1.1;
}

.tile span {
  color: var(--ink-2);
  font-weight: 600;
}

.tile small {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 6px;
}

.split {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brow {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 150px 1fr 150px;
}

.blabel {
  color: var(--ink-2);
  font-size: 0.9rem;
}

.btrack {
  background: var(--track);
  border-radius: 4px;
  display: block;
  height: 10px;
  overflow: hidden;
}

.btrack i {
  background: var(--bar);
  border-radius: 0 4px 4px 0;
  display: block;
  height: 100%;
}

.bval {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.bval small {
  display: block;
  font-weight: 400;
}

.facts {
  color: var(--ink-2);
  font-size: 0.86rem;
  margin: 16px 0 0;
}

.todo {
  list-style: none;
  margin: 0;
  padding: 0;
}

.todo li {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
}

.todo li:first-child {
  border-top: 0;
}

.todo li.done {
  color: var(--muted);
}

/* ---------------------------------------------------------------- états */
.state {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  white-space: nowrap;
}

.state i {
  align-items: center;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  font-size: 0.72rem;
  font-style: normal;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.st-ok .state,
.state.st-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.state.st-ok i {
  background: var(--ok);
}

.state.st-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.state.st-warn i {
  background: var(--warn);
}

.state.st-bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.state.st-bad i {
  background: var(--bad);
}

.state.st-off {
  background: var(--off-soft);
  color: var(--off);
}

.state.st-off i {
  background: var(--off);
}

.banner .state {
  background: rgb(255 255 255 / 70%);
}

/* ---------------------------------------------------------------- tableaux */
.grid {
  border-collapse: collapse;
  width: 100%;
}

.grid th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 12px 18px;
  text-align: left;
  text-transform: uppercase;
}

.grid td {
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  vertical-align: middle;
}

.grid .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------------------------------------------------------------- réparations */
.repairs {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

.repair {
  align-items: flex-start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.repair p {
  color: var(--ink-2);
  margin: 0;
}

.repair .out {
  color: var(--ok);
  font-weight: 600;
  margin-top: 8px;
}

.repair.focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px var(--brass-soft);
}

/* ---------------------------------------------------------------- fenêtres, messages, portes */
.modal-back {
  align-items: center;
  background: rgb(20 16 12 / 45%);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 20;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 460px;
  padding: 24px;
  width: calc(100% - 32px);
}

.modal p {
  color: var(--ink-2);
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

#toast {
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: fixed;
  right: 20px;
  z-index: 30;
}

.toast {
  background: var(--ink);
  border-radius: 10px;
  color: #fff;
  padding: 10px 16px;
}

.toast.bad {
  background: var(--bad);
}

.gate {
  align-items: center;
  background: var(--side);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.gate-card {
  background: var(--card);
  border-radius: 18px;
  max-width: 420px;
  padding: 36px;
  text-align: center;
}

.gate-card .logo {
  color: var(--ink);
}

.gate-card h1 {
  margin: 14px 0 8px;
}

.gate-card p {
  color: var(--ink-2);
  margin: 0 0 22px;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .side {
    height: auto;
    position: static;
  }

  .main {
    padding: 20px;
  }

  .tiles {
    grid-template-columns: 1fr 1fr;
  }

  .split,
  .repairs {
    grid-template-columns: 1fr;
  }

  .brow {
    grid-template-columns: 110px 1fr 110px;
  }
}

/* ---------------------------------------------------------------- associations */
.tiles.three {
  grid-template-columns: repeat(3, 1fr);
}

.combos {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.combos li {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 80px 96px;
}

.combos .pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.combos .piece {
  background: var(--brass-soft);
  border-radius: 999px;
  color: var(--brass-ink);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 9px;
}

.combos .plus {
  color: var(--muted);
  font-size: 0.8rem;
}

.grid.compact td,
.grid.compact th {
  padding: 9px 6px;
}
