/* Noah — interface web V1
   Thème sombre unique. Les couleurs sont des jetons : ne pas écrire de couleur en dur ailleurs. */

@font-face { font-family: "Space Grotesk"; font-weight: 500; font-display: swap; src: url("/fonts/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url("/fonts/space-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url("/fonts/space-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600; font-display: swap; src: url("/fonts/jetbrains-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #060A11;
  --surface: #0A1019;
  --surface-2: #0D1520;
  --surface-3: #111B27;
  --line: #16212F;
  --line-2: #22303F;
  --text: #E7EDF5;
  --text-2: #C9D3E0;
  --muted: #8A97AB;
  --faint: #6B788B;
  --ghost: #4E5C70;
  --accent: #38D9F0;
  --accent-text: #6FE3F4;
  --accent-ink: #04121A;
  --accent-soft: rgba(56, 217, 240, 0.10);
  --accent-line: rgba(56, 217, 240, 0.45);
  --warn: #F5B84F;
  --warn-soft: rgba(245, 165, 36, 0.12);
  --warn-line: rgba(245, 165, 36, 0.50);
  --danger: #FF8F9A;
  --symrise: #FF4D5E;
  --lemapack: #FF9A1F;
  --danisco: #4C8DFF;
  --radius: 14px;
  --radius-lg: 20px;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --header-h: 68px;
  --tabbar-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #8BEBF8; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; }
.mono { font-family: var(--font-mono); }
.label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Mode couvert ---------- */
[data-s] { transition: filter 0.2s ease; }
body.masked [data-s="1"] { filter: blur(6px); user-select: none; }
.mask-badge { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--warn); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--warn-line); }

/* ---------- En-tête ---------- */
.header { position: sticky; top: 0; z-index: 30; height: var(--header-h); display: flex; align-items: center; gap: 20px; padding: 0 32px; background: rgba(6, 10, 17, 0.88); border-bottom: 1px solid #111B27; backdrop-filter: blur(10px); }
.header.over-map { position: fixed; left: 0; right: 0; background: transparent; border-bottom-color: transparent; backdrop-filter: none; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; border: 1.5px solid var(--accent); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 16px rgba(56, 217, 240, 0.3); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.24em; }
.nav { display: flex; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }
.nav a { padding: 9px 14px; border-radius: 10px; color: var(--muted); font-size: 14px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid #1B2635; background: transparent; color: #AEB9C8; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn[aria-pressed="true"] { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #13202F; border: 1px solid #2A3A4F; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; overflow: hidden; padding: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.menu { position: absolute; top: calc(var(--header-h) - 6px); right: 24px; z-index: 40; min-width: 240px; padding: 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55); }
.menu-who { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.menu-who strong { display: block; color: var(--text); font-weight: 600; }
.menu button { width: 100%; text-align: left; min-height: 40px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent; }
.menu button:hover { background: var(--surface-3); }

/* Barre d'onglets du téléphone */
.tabbar { display: none; }

/* ---------- Mise en page générale ---------- */
.page { max-width: 1376px; margin: 0 auto; padding: 32px 32px 72px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title { margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 600; }
.page-sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.btn { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { color: var(--text); border-color: #2E3F53; }
.btn-primary { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.btn-accent { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid #1B2635; background: transparent; color: var(--muted); font-size: 13px; }
.chip[aria-selected="true"], .chip[aria-pressed="true"] { border-color: rgba(56, 217, 240, 0.5); background: var(--accent-soft); color: var(--text); }
.chip .count { font-family: var(--font-mono); font-size: 11px; opacity: 0.7; margin-left: 4px; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.error-box { padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(255, 93, 108, 0.45); background: rgba(40, 12, 18, 0.55); color: var(--text-2); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin: 32px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Accueil ---------- */
.home-hero { position: relative; height: 100vh; min-height: 620px; overflow: hidden; }
.map-wrap { position: absolute; top: 0; right: 0; height: 100%; aspect-ratio: 1000 / 853; }
.map-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-land { fill: url(#noah-dots); }
.map-route { fill: none; stroke: #33465E; stroke-width: 1.6; stroke-dasharray: 4 6; stroke-linejoin: round; }
.map-port { fill: #E7EDF5; }
.map-port.minor { fill: #56687F; }
.map-label { font-family: var(--font-mono); font-size: 11px; fill: #B4BFCD; }
.map-label.minor { fill: #62748B; }
.home-layer { position: absolute; inset: 0; display: flex; flex-direction: column; padding-top: var(--header-h); }
.home-center { flex: 1; display: flex; align-items: center; padding: 0 40px; }
.home-box { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 20px; }
.home-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 46px; letter-spacing: -0.015em; line-height: 1.05; }
.home-title span { color: #7D8A9E; }
.ask { position: relative; display: flex; align-items: center; gap: 4px; padding: 7px; border-radius: 18px; border: 1px solid rgba(56, 217, 240, 0.4); background: rgba(9, 15, 24, 0.9); box-shadow: 0 0 40px rgba(56, 217, 240, 0.12); }
.ask input { flex: 1; min-width: 0; height: 52px; border: 0; outline: none; background: transparent; font-size: 17px; padding: 0 12px; }
.ask .send { flex: none; width: 52px; height: 52px; border-radius: 13px; border: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.home-note { font-size: 13px; color: var(--faint); }
.home-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 0 40px 28px; }
.home-down { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: #AEB9C8; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.symrise { background: var(--symrise); }
.dot.lemapack { background: var(--lemapack); }
.dot.danisco { background: var(--danisco); }
.home-detail { max-width: 1376px; margin: 0 auto; padding: 40px 32px 80px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.stat { padding: 20px 22px; }
.stat-value { font-family: var(--font-display); font-size: 40px; font-weight: 600; margin-top: 6px; }
.stat-sub { font-size: 13px; color: var(--muted); }
.soon { padding: 20px 22px; border-style: dashed; }
.soon h3 { margin: 6px 0 4px; font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.soon p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Recherche ---------- */
.search-form { display: flex; gap: 8px; padding: 7px; border-radius: 18px; border: 1px solid var(--accent-line); background: var(--surface); box-shadow: 0 0 40px rgba(56, 217, 240, 0.06); }
.search-form .s-icon { align-self: center; margin-left: 12px; color: var(--faint); flex: none; }
.search-form input { flex: 1; min-width: 0; height: 52px; border: 0; outline: none; background: transparent; font-size: 17px; padding: 0 8px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0; }
.filters select, .filters input { min-height: 38px; border-radius: 999px; border: 1px solid #1B2635; background: var(--bg); color: #AEB9C8; font-size: 13px; padding: 0 14px; }
.filters input { width: 270px; }
.filters .grow { flex: 1; }
.search-meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--faint); }
.askbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.split { display: flex; gap: 24px; align-items: flex-start; }
.results { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.result { width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.result:hover { border-color: var(--line-2); }
.result[aria-pressed="true"] { border-color: rgba(56, 217, 240, 0.55); background: #0D1824; }
.result-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.result-who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.result-who span, .ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-title { font-size: 14px; font-weight: 600; }
.result-snippet { font-size: 13px; color: #AEB9C8; line-height: 1.5; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.badge.warn { color: var(--warn); }
mark { background: rgba(56, 217, 240, 0.22); color: var(--text); border-radius: 3px; padding: 0 2px; }
.more { align-self: center; margin-top: 6px; }

.viewer { flex: 999 1 620px; min-width: 0; position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow: auto; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.viewer-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer-back { display: none; }
.viewer-body { padding: 20px 22px 26px; display: flex; flex-direction: column; gap: 16px; }
.v-subject { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.headers { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: grid; grid-template-columns: 64px 1fr; row-gap: 6px; column-gap: 14px; font-size: 13px; }
.headers dt { color: var(--faint); }
.headers dd { margin: 0; color: var(--text-2); word-break: break-word; }
.headers dd strong { color: var(--text); font-weight: 600; }
.thread { display: flex; flex-direction: column; gap: 6px; }
.thread button { display: flex; align-items: baseline; gap: 12px; padding: 10px 14px; border-radius: 10px; border: 0; background: var(--surface-2); text-align: left; font-size: 13px; }
.thread button:hover { background: var(--surface-3); }
.thread .t-from { font-weight: 600; white-space: nowrap; }
.thread .t-prev { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .t-date { font-family: var(--font-mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 9px; background: var(--surface-2); font-size: 12px; color: var(--faint); }
.mail-text { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.65; color: var(--text-2); }
.mail-frame { width: 100%; min-height: 420px; border: 0; border-radius: 10px; background: #FFFFFF; }
.atts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.att { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.att-head { display: flex; align-items: flex-start; gap: 10px; }
.att-ext { flex: none; width: 36px; height: 42px; border-radius: 6px; background: rgba(255, 77, 94, 0.12); color: #FF97A1; font-family: var(--font-mono); font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; text-transform: uppercase; }
.att-name { font-size: 13px; font-weight: 500; word-break: break-all; }
.att-meta { font-size: 12px; color: var(--faint); margin-top: 3px; }
.att-actions { display: flex; gap: 6px; }
.att-actions .btn { flex: 1; min-height: 34px; font-size: 12px; }
.origin { width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.origin svg { flex: none; }
.origin small { display: block; color: var(--faint); font-size: 12px; }
.doc-text { padding: 18px 20px; border-radius: 12px; background: #F4F6F8; color: #1A2230; font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.doc-text mark { background: #BDEFF7; color: inherit; }
.viewer-empty { padding: 64px 24px; text-align: center; color: var(--faint); }

/* ---------- Pages à venir ---------- */
.coming { max-width: 760px; margin: 40px auto; padding: 32px; text-align: left; }
.coming h1 { margin: 8px 0 10px; font-family: var(--font-display); font-size: 30px; }
.coming p { color: var(--text-2); }
.coming ul { color: var(--muted); padding-left: 20px; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; padding: 32px; text-align: center; }
.login-card h1 { font-family: var(--font-display); margin: 18px 0 8px; font-size: 26px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }

/* ---------- Téléphone ---------- */
@media (max-width: 860px) {
  :root { --header-h: 60px; --tabbar-h: 64px; }
  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
  .header { padding: 0 16px; gap: 10px; }
  .header .nav { display: none; }
  .mask-badge { display: none; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + var(--safe-b)); padding: 6px 6px var(--safe-b); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: rgba(8, 13, 21, 0.97); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .page { padding: 20px 16px 40px; }
  .page-title { font-size: 26px; }
  .home-hero { height: calc(100vh - var(--tabbar-h)); }
  .map-wrap { right: -48%; top: -16%; }
  .map-fade-l { display: none; }
  .home-note { display: none; }
  .askbar > span { display: none; }
  .askbar { padding: 0; border: 0; background: transparent; }
  .filters-toggle { display: inline-flex !important; }
  .filters:not(.show-adv) .adv { display: none; }
  .filters .adv { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .home-center { align-items: flex-end; padding: 0 16px 24px; }
  .home-title { font-size: 30px; }
  .home-bottom { padding: 0 16px 16px; }
  .home-detail { padding: 24px 16px 40px; }
  .filters input { flex: 1 1 100%; width: auto; }
  .split { display: block; }
  .viewer { position: fixed; top: var(--header-h); left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 25; max-height: none; border-radius: 0; border: 0; }
  .viewer:not(.open) { display: none; }
  .viewer-back { display: inline-flex; }
  .menu { right: 12px; }
}

/* Compléments recherche */
.filters .adv { display: contents; }
.filters-toggle { display: none !important; }
.filters-tabs { display: flex; gap: 6px; }
.search-form .btn { width: 52px; height: 52px; padding: 0; border-radius: 13px; flex: none; }
.more-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.more-item { padding: 18px 20px; color: var(--text); font-size: 16px; font-weight: 500; }
