/* Presse OnceSuite : les couleurs et les polices du site oncesuite.app. Aucun style dans les pages (CSP stricte). */
:root {
  --paper: #ECEEF1;
  --surface: #FFFFFF;
  --surface-2: #F5F6F8;
  --ink: #15171B;
  --muted: #5C616B;
  --line: #D5D8DE;
  --brass: #B08A2E;
  --brass-ink: #8C6A1C;
  --focus: #2F6FDE;
  --good: #1F7A4D;
  --good-bg: #E3F2E9;
  --best: #8C6A1C;
  --best-bg: #F6EDD5;
  --wait: #2F5FB8;
  --wait-bg: #E4ECFA;
  --warn: #9A5B00;
  --warn-bg: #FBEFD9;
  --bad: #B3261E;
  --bad-bg: #FBE4E2;
  --off: #6B7079;
  --off-bg: #E8EAEE;
  --sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif: 'New York', 'Newsreader', ui-serif, Georgia, serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(21, 23, 27, .05), 0 4px 16px rgba(21, 23, 27, .04);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F1013;
    --surface: #1A1C20;
    --surface-2: #22252A;
    --ink: #EEF0F3;
    --muted: #9AA0AA;
    --line: #2E3138;
    --brass: #C9A043;
    --brass-ink: #D9B45E;
    --focus: #7EA6FF;
    --good: #6FD39C;
    --good-bg: #16301F;
    --best: #E2C06A;
    --best-bg: #33290F;
    --wait: #8FB2FF;
    --wait-bg: #1A2640;
    --warn: #F0B45A;
    --warn-bg: #352512;
    --bad: #FF8A80;
    --bad-bg: #3A1A18;
    --off: #9AA0AA;
    --off-bg: #25282D;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font: 600 clamp(1.6rem, 3vw, 2.1rem)/1.15 var(--serif); letter-spacing: -.01em; }
h2 { font-size: 1.08rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 650; margin-top: .6em; }
p { margin: 0 0 .7em; }
code { font: .88em var(--mono); background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.muted { color: var(--muted); }
.small { font-size: .88rem; }
.nowrap { white-space: nowrap; }
.ok { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }

/* ---------- La pièce et le mot once ---------- */
.coin {
  --d: 1em;
  display: inline-block;
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  padding: calc(var(--d) / 7);
  background: linear-gradient(135deg, #F3F4F7, #CDD0D7 50%, #A2A7B1);
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .18);
  vertical-align: middle;
  flex: none;
}
.coin i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle farthest-corner at 34% 26%, #E9CD7C, #BE9636 46%, #8C6A1C 83%);
}
.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.01em;
}
.wordmark .coin { --d: .56em; margin-right: .02em; transform: translateY(.02em); }

/* ---------- En-tête ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; font-size: 1.55rem; flex: none; }
.brand-sub { font: 600 .78rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 550;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a.on { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.badge {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 .4em;
  border-radius: 999px;
  background: var(--brass);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.4em;
  text-align: center;
}
.logout { margin: 0; flex: none; }
.link { border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 6px; }
.link:hover { color: var(--ink); text-decoration: underline; }

.banner { padding: 8px 16px; text-align: center; font-size: .9rem; }
.banner.essai { background: var(--warn-bg); color: var(--warn); }

.main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 18px; }
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 0 16px 32px; }

/* ---------- Cartes, titres de page ---------- */
.page-head { display: grid; gap: 4px; }
.page-head .actions { margin-top: 6px; }
.back { color: var(--muted); text-decoration: none; font-size: .92rem; }
.back:hover { color: var(--ink); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.pad { padding: 16px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card > summary, details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; }
details.card > summary::after { content: '＋'; float: right; color: var(--muted); }
details.card[open] > summary::after { content: '－'; }
details.card[open] > summary { margin-bottom: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: grid; gap: 12px; align-content: start; }
.inline, .inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.empty { color: var(--muted); margin: 0; }
.note {
  border-left: 3px solid var(--brass);
  background: var(--best-bg);
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
  margin: 0;
}

/* ---------- Alertes et messages ---------- */
.flash {
  background: var(--good-bg);
  color: var(--good);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 550;
}
.flash.error { background: var(--bad-bg); color: var(--bad); }
.alerts { display: grid; gap: 8px; }
.alert {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.alert.tone-warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.alert.tone-bad { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.alert.tone-wait { background: var(--wait-bg); border-color: transparent; color: var(--wait); }
.alert.tone-good { background: var(--good-bg); border-color: transparent; color: var(--good); }

/* ---------- Boutons, puces ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 600 .95rem var(--sans);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--brass)); }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: .86rem; }
.btn.wide { width: 100%; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: transparent; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: .45; cursor: not-allowed; transform: none; }

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 650;
  white-space: nowrap;
  background: var(--off-bg);
  color: var(--off);
}
.chip.tone-idle { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.chip.tone-wait { background: var(--wait-bg); color: var(--wait); }
.chip.tone-good { background: var(--good-bg); color: var(--good); }
.chip.tone-best { background: var(--best-bg); color: var(--best); }
.chip.tone-off { background: var(--off-bg); color: var(--off); }
.chip.tone-bad { background: var(--bad-bg); color: var(--bad); }
.chip.tone-warn { background: var(--warn-bg); color: var(--warn); }

.app-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.app-chip i, .app-title i, .app-card-name i {
  display: inline-block;
  width: .7em;
  height: .7em;
  border-radius: 50%;
  background: var(--app, var(--muted));
  flex: none;
}
.prio { font-size: .84rem; color: var(--muted); }
.prio::before { content: "· "; }
.prio + * { margin-left: 2px; }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list .row + .row { border-top: 1px solid var(--line); }
.row { display: flex; gap: 12px; align-items: center; padding: 12px 18px; }
.row-main, .row-link { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-link { text-decoration: none; margin: -12px -18px; padding: 12px 18px; }
.row-link:hover { background: var(--surface-2); }
.row-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: .9rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-excerpt { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-date { color: var(--muted); font-size: .85rem; white-space: nowrap; flex: none; }
.row.unread .row-title::before, .unread > .row-link .row-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass);
  margin-right: 8px;
  vertical-align: middle;
}
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }

/* ---------- Chiffres, apps ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stat {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  text-decoration: none;
  border-top: 3px solid var(--app, var(--line));
}
.stat:hover { background: color-mix(in srgb, var(--app, var(--muted)) 8%, var(--surface-2)); }
.stat-name { font-weight: 700; }
.stat-line { color: var(--muted); font-size: .9rem; }
.stat-line b { color: var(--ink); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.app-card {
  display: grid;
  gap: 4px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--app, var(--line));
  text-decoration: none;
  box-shadow: var(--shadow);
}
.app-card:hover { border-color: var(--app, var(--muted)); }
.app-card-name { display: inline-flex; align-items: center; gap: 8px; font: 600 1.3rem var(--serif); }
.app-card-line { font-size: .9rem; }
.app-title { display: inline-flex; align-items: center; gap: 12px; }
.app-title i { width: .55em; height: .55em; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th {
  text-align: left;
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.off { opacity: .55; }
.table a { font-weight: 600; }
.cell-sub { display: block; color: var(--muted); font-size: .84rem; font-weight: 400; }
.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Formulaires ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.filters input[type='search'], .filters input[name='q'] { flex: 1 1 220px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: .86rem; font-weight: 600; color: var(--muted); }
.field > span b { color: var(--brass-ink); }
.inline-field { display: inline-grid; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  width: 100%;
  min-height: 42px;
}
textarea { line-height: 1.5; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.filters select, .filters input { width: auto; }
input[type='color'] { padding: 4px; width: 64px; }
input[type='checkbox'] { width: 18px; height: 18px; min-height: 0; accent-color: var(--ink); margin: 0; flex: none; }
input[type='file'] { padding: 8px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
.check { display: flex; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 18px; margin-bottom: 12px; max-height: 420px; overflow: auto; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.help > summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.help[open] > summary { margin-bottom: 8px; }
.steps { padding-left: 1.2em; display: grid; gap: 8px; margin: 0; }
.test-result { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.test-result p { margin: 0 0 4px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checks li { padding: 8px 12px 8px 34px; border-radius: 10px; background: var(--surface-2); position: relative; overflow-wrap: anywhere; }
.checks li::before { position: absolute; left: 12px; font-weight: 800; }
.checks li.ok::before { content: '✓'; color: var(--good); }
.checks li.bad::before { content: '✕'; color: var(--bad); }
.checks li.warn::before { content: '!'; color: var(--warn); }
.checks li.ok, .checks li.bad, .checks li.warn { color: var(--ink); }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a {
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: .92rem;
}
.tabs a.on, .tabs a[aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Fiche contact, fil ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.pitches { display: grid; gap: 12px; }
.pitch { border: 1px solid var(--line); border-left: 4px solid var(--app, var(--line)); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.pitch-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pitch-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pitch-edit > summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.pitch-edit[open] > summary { margin-bottom: 8px; }
.thread { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.msg-meta { display: inline-flex; gap: 10px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); min-width: 0; }
.msg.in { border-left: 4px solid var(--brass); }
.msg.out { background: var(--surface-2); margin-left: clamp(0px, 6vw, 48px); }
.msg-head { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.msg-who { font-weight: 650; }
.msg-date { color: var(--muted); font-size: .84rem; }
.msg-subject { font-weight: 600; margin-bottom: 6px; }
.msg pre, .message-body, .preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .95rem/1.55 var(--sans);
  margin: 0;
}
.quoted { margin-top: 8px; }
.quoted > summary { cursor: pointer; color: var(--muted); font-size: .86rem; }
.quoted pre { color: var(--muted); border-left: 2px solid var(--line); padding-left: 12px; margin-top: 6px; font-size: .9rem; }
.message { display: grid; gap: 14px; }
.message-head { display: grid; gap: 4px; }
.message-meta { color: var(--muted); font-size: .9rem; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.message-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.danger-zone-inline { display: flex; justify-content: flex-end; }

/* ---------- Écrire ---------- */
.compose { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.compose-form textarea[name='body'] { font-family: var(--mono); font-size: .9rem; min-height: 320px; }
.perso textarea { border-color: color-mix(in srgb, var(--brass) 55%, var(--line)); background: color-mix(in srgb, var(--brass) 5%, var(--surface)); }
.perso small { font-size: .82rem; }
.preview-card { display: grid; gap: 12px; }
.preview-card h2 { margin: 0; }
.preview { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; min-height: 200px; }
.preview mark { background: var(--warn-bg); color: var(--warn); border-radius: 4px; padding: 0 2px; }

/* ---------- Connexion ---------- */
.bare { min-height: 100vh; display: grid; place-items: center; }
.auth { width: min(420px, calc(100% - 32px)); display: grid; gap: 20px; padding: 40px 0; }
.auth-brand { display: flex; align-items: baseline; gap: 10px; justify-content: center; font-size: 2.6rem; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-card h1 { font-size: 1.5rem; margin: 0; }

/* ---------- Petits écrans ---------- */
@media (max-width: 860px) {
  .compose { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 6px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .nav { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 12px 2px; }
  .logout { margin-left: auto; }
  .main { padding: 16px 12px 40px; gap: 14px; }
  .card { padding: 14px; border-radius: 12px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .row { padding: 12px 14px; flex-wrap: wrap; }
  .row-link { margin: -12px -14px; padding: 12px 14px; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
  .msg.out { margin-left: 0; }
  .form-actions .btn { flex: 1 1 auto; }
  .table th, .table td { padding: 9px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.stack > .btn, .stack > button { justify-self: start; }
