/* Portail des demandes : polices système (aucune police externe), palette craie / encre / bois de Capy Pilot, mode sombre. Aucun style en ligne (CSP). */
:root {
  --bg: #EEF0EB; --panel: #FFFFFF; --panel-2: #F5F6F2; --ink: #1B2430; --muted: #5A6470; --line: #D6DAD2; --line-2: #C3C9BF;
  --bar: #1F2A35; --bar-fg: #F2F3F1; --bar-muted: #AEB8C2;
  --wood: #B8692B; --wood-soft: #F6E6D3; --accent: #2F4596; --accent-ink: #FFFFFF; --accent-soft: #E2E7F6;
  --ok: #2B7549; --ok-soft: #DCEFE2; --warn: #8E5C00; --warn-soft: #F6EBCD; --crit: #B0322A; --crit-soft: #F8E0DC; --info-soft: #E4ECF7;
  --radius: 12px; --shadow: 0 1px 0 rgba(20, 30, 40, .04), 0 8px 24px -16px rgba(20, 30, 40, .35);
  --f: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Segoe UI", Roboto, sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11151B; --panel: #192029; --panel-2: #1F2732; --ink: #ECE8E1; --muted: #A3ABB5; --line: #2B3440; --line-2: #3A4552;
  --bar: #0A0E13; --bar-fg: #EEF1F2; --bar-muted: #8F9BA8;
  --wood: #E39A5C; --wood-soft: #35261A; --accent: #9DAEF3; --accent-ink: #111522; --accent-soft: #222B4A;
  --ok: #6DC28F; --ok-soft: #16291E; --warn: #E2B04F; --warn-soft: #2E2512; --crit: #F0827A; --crit-soft: #351C1A; --info-soft: #1D2836;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 26px -14px rgba(0, 0, 0, .7);
  color-scheme: dark } }
:root[data-theme="dark"] { color-scheme: dark }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--f); }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-size: 17px; line-height: 1.3; font-weight: 700; margin-bottom: 14px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---- barre du haut ---- */
.top { background: var(--bar); color: var(--bar-fg); padding-top: env(safe-area-inset-top, 0px); }
.top .in { max-width: 960px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand .logo { width: 30px; height: 30px; flex: none; }
.logo-bg { fill: #2C3946; } .logo-fg { fill: #F4E2CD; } .brand circle.logo-fg { fill: #E39A5C; }
.brand span { display: grid; line-height: 1.15; min-width: 0; }
.brand b { font-size: 16px; letter-spacing: .01em; }
.brand small { font-size: 12.5px; color: var(--bar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.who { font-size: 13px; color: var(--bar-muted); font-family: var(--f-mono); max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang { color: var(--bar-fg); font-size: 13.5px; text-decoration: none; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: 5px 12px; min-height: 32px; display: inline-flex; align-items: center; }
.lang:hover { background: rgba(255, 255, 255, .08); }
.top .btn.ghost { color: var(--bar-fg); border-color: rgba(255, 255, 255, .25); background: transparent; }
form.inline { margin: 0; }

/* ---- page ---- */
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); flex: 1; display: grid; gap: 18px; align-content: start; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.card.empty { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 36px 22px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.backline { font-size: 14.5px; }
.backline a { text-decoration: none; }
.lead { color: var(--muted); margin-top: 6px; }
.fine { color: var(--muted); font-size: 13.5px; }
.hint { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.meta { color: var(--muted); font-size: 13.5px; }

/* ---- connexion ---- */
.auth { max-width: 440px; width: 100%; justify-self: center; margin-top: 4vh; display: grid; gap: 4px; }
.auth h1 { font-size: 24px; }

/* ---- formulaires ---- */
.form { display: grid; gap: 8px; margin-top: 14px; }
.form label { font-weight: 600; font-size: 14.5px; margin-top: 6px; }
.form input, .form textarea { width: 100%; font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; min-height: 46px; }
.form textarea { resize: vertical; min-height: 180px; line-height: 1.55; }
.form.reply textarea { min-height: 110px; }
.form input:focus, .form textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 15px/1 var(--f); border-radius: 10px; padding: 0 18px; min-height: 44px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); text-decoration: none; cursor: pointer; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.pri:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 999px; }
.btn.wide { width: 100%; margin-top: 12px; }
.alert { border-radius: 10px; padding: 11px 14px; font-size: 14.5px; border: 1px solid transparent; }
.alert.err { background: var(--crit-soft); color: var(--crit); border-color: color-mix(in srgb, var(--crit) 30%, transparent); }
.alert.info { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* ---- liste ---- */
.reqs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.req { display: grid; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.req:hover { border-color: var(--line-2); }
.req .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req .rt { font-weight: 650; font-size: 16.5px; line-height: 1.4; overflow-wrap: anywhere; }
.rid { font-family: var(--f-mono); font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.rid.big { font-size: 14.5px; }
.dot { font-size: 12.5px; font-weight: 600; color: var(--wood); display: inline-flex; align-items: center; gap: 6px; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--wood); }

/* ---- états ---- */
.badge { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600; line-height: 1; padding: 5px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.st-received, .badge.st-analyzing { background: var(--info-soft); color: var(--accent); border-color: transparent; }
.badge.st-waiting { background: var(--wood-soft); color: var(--wood); border-color: transparent; }
.badge.st-launched, .badge.st-in_progress { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.st-on_dev, .badge.st-in_prod { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.st-done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.st-refused { background: var(--crit-soft); color: var(--crit); border-color: transparent; }

/* ---- avancement ---- */
.progress { display: grid; gap: 6px; margin-top: 4px; }
.progress span { font-size: 13.5px; color: var(--muted); }
.progress.compact { grid-template-columns: minmax(80px, 200px) auto; align-items: center; gap: 10px; }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--ok); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--ok); border-radius: 999px; }

/* ---- détail ---- */
.dhead { display: grid; gap: 8px; }
.rowline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.desc { color: var(--muted); }
.grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; } }
.body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 10px; line-height: 1.7; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; column-gap: 12px; position: relative; padding-bottom: 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 20px; bottom: -2px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .mark { grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--panel); margin-top: 1px; position: relative; z-index: 1; }
.timeline .lbl { font-weight: 600; font-size: 15px; }
.timeline .when { font-size: 13px; color: var(--muted); min-height: 1em; }
.timeline .past .mark { background: var(--ok); border-color: var(--ok); }
.timeline .past::before { background: var(--ok); }
.timeline .now .mark { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline .now .lbl { color: var(--accent); }
.timeline .now.refused .mark { background: var(--crit); border-color: var(--crit); box-shadow: 0 0 0 4px var(--crit-soft); }
.timeline .now.refused .lbl { color: var(--crit); }
.timeline .next .lbl, .timeline .skip .lbl { color: var(--muted); font-weight: 500; }
.timeline .skip .mark { border-style: dashed; }

.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.msg { border-radius: 12px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); max-width: 100%; }
.msg.them { background: var(--info-soft); border-color: transparent; }
.msg.me { margin-left: 12%; }
.msg.refusal { background: var(--crit-soft); }
.mh { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font-size: 13.5px; }
.mh time { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.mt { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }

@media (max-width: 520px) {
  h1 { font-size: 22px; }
  .card { padding: 18px 16px; }
  .wrap { padding-top: 20px; gap: 14px; }
  .who { display: none; }
  .progress.compact { grid-template-columns: 1fr; gap: 4px; }
  .msg.me { margin-left: 6%; }
}
