:root {
  --paper: #f4efe6;
  --surface: #fffdf8;
  --surface-2: #efe8db;
  --ink: #1f1c18;
  --ink-soft: #4b463f;
  --muted: #7a736a;
  --line: #ddd4c4;
  --line-strong: #c8bda8;
  --accent: #b4502a;
  --accent-dark: #8c3b1d;
  --accent-soft: #f6e3d9;
  --ok: #2f7a4f;
  --ok-soft: #e1f0e6;
  --warn: #a86f12;
  --warn-soft: #f7ead1;
  --danger: #a3271b;
  --danger-soft: #f7dcd8;
  --info: #2b5e8c;
  --info-soft: #dfe9f3;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.06), 0 6px 18px -12px rgba(40, 30, 10, 0.25);
  --font-title: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-text: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.9rem; line-height: 1.15; }
h2 { font-size: 1.25rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }
code, pre, .mono { font-family: var(--font-mono); font-size: 0.86em; }
pre {
  background: #1f1c18;
  color: #e9e2d6;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  overflow: auto;
  max-height: 480px;
  white-space: pre-wrap;
  word-break: break-word;
}
small, .small { font-size: 0.86rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Structure */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: var(--ink);
  color: #d9d1c3;
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.brand { font-family: var(--font-title); font-size: 1.35rem; color: #fff; display: flex; align-items: baseline; gap: 0.5rem; }
.brand span { font-family: var(--font-text); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: #a39a8b; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: #d9d1c3;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 150ms;
}
.nav a:hover { background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.nav a.active { background: var(--accent); color: #fff; }
.nav .count { font-size: 0.75rem; background: rgba(255, 255, 255, 0.12); padding: 0 0.45rem; border-radius: 10px; }
.side-foot { margin-top: auto; font-size: 0.8rem; color: #8f877a; }
.side-foot a { color: #c9c0b1; }
.main { padding: 2rem 2.6rem 4rem; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.page-head .lead { color: var(--ink-soft); margin: 0.3rem 0 0; max-width: 60ch; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.2rem; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card h2 .actions { font-size: 0.9rem; }
.stack > * + * { margin-top: 1.2rem; }

/* Identité */
.identity { display: grid; grid-template-columns: auto 1fr; gap: 1rem 1.4rem; align-items: start; }
.identity .mark {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark);
  display: grid; place-items: center; font-family: var(--font-title); font-size: 1.6rem;
}
.identity dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 1rem; margin: 0.6rem 0 0; }
.identity dt { color: var(--muted); }
.identity dd { margin: 0; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--ink-soft); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--line-strong); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: rgba(0, 0, 0, 0.015); }
table.dense td, table.dense th { padding: 0.35rem 0.5rem; }
td .mono { word-break: break-all; }

/* Badges */
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.76rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--surface-2); color: var(--ink-soft); }
.badge.hostinger { background: #e4e9f7; color: #3a4f9c; }
.badge.njalla { background: #e9e3f5; color: #5a3e8e; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-weight: 500; font-size: 0.92rem;
  padding: 0.5rem 0.95rem; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: background 150ms, border-color 150ms, transform 100ms;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #d9a39c; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 0.25rem 0.6rem; font-size: 0.82rem; }
.btn.link { border-color: transparent; background: transparent; color: var(--accent-dark); padding-left: 0.3rem; padding-right: 0.3rem; }
.btn[disabled] { opacity: 0.55; cursor: default; }

/* Formulaires */
form.inline { display: inline; }
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field .help { color: var(--muted); font-size: 0.84rem; }
.field .error { color: var(--danger); font-size: 0.86rem; }
input[type='text'], input[type='password'], input[type='email'], input[type='number'], select, textarea {
  font: inherit; font-size: 0.95rem;
  padding: 0.5rem 0.65rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); width: 100%;
  transition: border-color 150ms, box-shadow 150ms;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(180, 80, 42, 0.15); }
textarea { min-height: 120px; font-family: var(--font-mono); font-size: 0.86rem; }
input.mono { font-family: var(--font-mono); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.8rem; }
.checks { display: grid; gap: 0.35rem; }
.checks label { display: flex; gap: 0.5rem; align-items: baseline; font-weight: 400; cursor: pointer; }
.checks label:hover { color: var(--accent-dark); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8rem 1rem 0.2rem; margin: 0 0 1rem; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.4rem; }

/* Messages */
.flash { padding: 0.7rem 1rem; border-radius: var(--radius); margin-bottom: 1.2rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfdcc9; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: #e8b9b3; }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: #e5cf9b; }
.flash.info { background: var(--info-soft); color: var(--info); border-color: #bcd0e4; }
.notice { border-left: 3px solid var(--line-strong); padding: 0.4rem 0.9rem; color: var(--ink-soft); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; margin: 0.6rem 0; }
.notice.warn { border-color: var(--warn); }
.notice.ok { border-color: var(--ok); }

/* Étapes de mission */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 0.6rem; align-items: start; padding: 0.35rem 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 0.3rem; border: 2px solid var(--line-strong); background: var(--surface); }
.steps li.ok .dot { background: var(--ok); border-color: var(--ok); }
.steps li.erreur .dot { background: var(--danger); border-color: var(--danger); }
.steps li.en_cours .dot { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.steps li.ignoré .dot, .steps li.annulé .dot { background: var(--line); border-color: var(--line); }
.steps .name { font-weight: 500; }
.steps .detail { color: var(--muted); font-size: 0.88rem; }
.steps li.erreur .detail { color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.log { max-height: 360px; font-size: 0.8rem; }

/* Divers */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.2rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.stat { display: flex; flex-direction: column; gap: 0.1rem; }
.stat .n { font-family: var(--font-title); font-size: 2rem; line-height: 1; }
.stat .l { color: var(--muted); font-size: 0.85rem; }
.folder-list { list-style: none; padding: 0; margin: 0; }
.folder-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.folder-list li:last-child { border-bottom: 0; }
.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--line-strong); margin-bottom: 1rem; }
.tabs button { font: inherit; background: none; border: 0; padding: 0.5rem 0.9rem; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.diff { font-family: var(--font-mono); font-size: 0.84rem; }
.diff .before { color: var(--danger); text-decoration: line-through; }
.diff .after { color: var(--ok); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.auth .card { width: 100%; max-width: 420px; }
.auth h1 { margin-bottom: 0.4rem; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 1rem; text-align: center; color: var(--muted); }
.dropzone input { display: none; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.8rem 1rem; gap: 0.8rem; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: none; }
  .main { padding: 1.2rem 1rem 3rem; }
  .identity { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}

/* Parcours guidé */
.guide { border-left: 4px solid var(--accent); margin-bottom: 1.2rem; }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.progress { flex: 1; min-width: 160px; max-width: 320px; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); transition: width 300ms; }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.guide-steps li a { display: grid; grid-template-columns: 28px 1fr; gap: 0.6rem; align-items: start; padding: 0.6rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--surface); transition: border-color 150ms, background 150ms; height: 100%; }
.guide-steps li a:hover { text-decoration: none; border-color: var(--line-strong); background: var(--surface-2); }
.guide-steps .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 0.85rem; background: var(--surface-2); color: var(--muted); }
.guide-steps li.done .num { background: var(--ok); color: #fff; }
.guide-steps li.current a { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(180, 80, 42, 0.12); }
.guide-steps li.current .num { background: var(--accent); color: #fff; }
.just-added { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(47, 122, 79, 0.15); }
@media (max-width: 900px) { .guide-steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .guide-steps { grid-template-columns: 1fr; } }

.identity h2 { display: block; }

.sub-projects { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-top: 0.3rem; font-size: 0.86rem; }
.folder-list li > div:first-child { min-width: 0; }
