:root {
  --paper: #f3ece1;
  --ink: #1a1612;
  --muted: #6b6258;
  --card: #fffcf7;
  --line: #e0d5c6;
  --copper: #9a4e12;
  --copper-dark: #7a3b0c;
  --forest: #1e3d32;
  --ok: #215c42;
  --bad: #8b1e1e;
  --demo: #6b5a1f;
  --pro: #1e3d32;
  --revendeur: #4a2c6a;
  --rail: #171410;
  --sans: "Segoe UI", "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

a { color: var(--copper-dark); }
h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.15rem; margin-top: 1rem; }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.rail {
  background: var(--rail);
  color: #efe7db;
  padding: 1.6rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.brand {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0;
}
.brand-sub { margin: 0 0 1.4rem; color: #c4b8a8; font-size: 0.85rem; }
.rail nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.rail nav a {
  color: #efe7db;
  text-decoration: none;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
}
.rail nav a.on, .rail nav a:hover { background: #2c2620; }
.nav-label {
  margin-top: 1.2rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9a8f82;
}
.who { font-size: 0.82rem; color: #c4b8a8; display: flex; flex-direction: column; gap: 0.2rem; }
.who strong { color: #fff; }
.pill {
  display: inline-block;
  border: 1px solid #5a5046;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  width: fit-content;
  font-size: 0.72rem;
}

.page { padding: 2rem 2.4rem 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.4rem; }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--copper);
  margin: 0 0 0.35rem;
}
.lede { color: var(--muted); max-width: 42rem; }
.muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.2rem 1.3rem;
  box-shadow: 0 1px 0 rgba(26, 22, 18, 0.04);
  overflow-x: auto;
}
.card.narrow { max-width: 36rem; }
.auth-card { width: min(28rem, 92vw); }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 500px at 10% -10%, #e7d3b8, transparent),
    var(--paper);
}

.stack { display: flex; flex-direction: column; gap: 0.85rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; font-weight: 600; }
input, select, textarea, button {
  font: inherit;
  color: var(--ink);
}
input, select, textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-weight: 400;
}
input.locked,
textarea.locked,
input:read-only:not(.mono),
textarea:read-only:not(.mono) {
  background: #e6e0d6;
  color: var(--muted);
  cursor: not-allowed;
  border-color: #d3c9b8;
}
input.locked[type="date"] {
  pointer-events: none;
}
textarea.mono, .mono { font-family: "Cascadia Mono", "Consolas", monospace; font-size: 0.85rem; }
button, .button {
  background: var(--forest);
  color: #f6efe4;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  font-weight: 600;
}
button.ghost, .button.ghost, a.button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.danger, .button.danger {
  background: #8b3a2f;
  color: #f6efe4;
}
button.danger.ghost {
  background: transparent;
  color: #8b3a2f;
  border-color: #e0c4bc;
}
.linkish {
  background: none;
  color: var(--copper-dark);
  padding: 0;
  border: 0;
  font-weight: 600;
  cursor: pointer;
}
button.linkish.danger {
  background: none;
  color: #8b3a2f;
}
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.alert {
  background: #f8e4de;
  color: var(--bad);
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
}
.alert.ok { background: #e3f0e8; color: var(--ok); }
.hint { font-size: 0.82rem; color: var(--muted); font-weight: 400; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.stats article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}
.stats span { color: var(--muted); font-size: 0.8rem; display: block; }
.stats strong { font-family: var(--serif); font-size: 1.5rem; }

.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
th, td { padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.75rem;
}
.tag.demo { background: var(--demo); }
.tag.pro { background: var(--pro); }
.tag.revendeur { background: var(--revendeur); }
.tag.active { background: var(--ok); }
.tag.replaced { background: #6b6258; }
.tag.supplement { background: var(--copper); }
.due {
  background: #f3ead4;
  border: 1px solid #e0d5c6;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
}
.due strong { font-family: var(--serif); font-size: 1.25rem; }

.filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.inline { display: flex; gap: 0.35rem; align-items: center; }
.tiny { width: 5rem; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }

.qr { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 8px; }
.secret { word-break: break-all; }
.codes { columns: 2; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.facts dt { color: var(--muted); font-size: 0.78rem; }
.facts dd { margin: 0.15rem 0 0; }
.wrap { word-break: break-all; }
.preview { background: #efe6d6; border-radius: 8px; padding: 0.7rem 0.9rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .split, .facts { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
}
