/* Identity shared with Reels Factory (app-reel-editor/DESIGN.md), modelled on
   its "Captions" page: sidebar, page head with one primary action, KPIs,
   filters on one line, table. Measured on Factory on 23/09/2026.
   Light by default, the last choice is remembered. */
:root {
  --bg: #14120d; --surface: #1c1a14; --surface2: #221f18; --surface3: #2a2620;
  --side: #18160f; --border: #332f26; --border-strong: #46402f;
  --text: #f2efe8; --text-2: #cdc7bb; --text-muted: #9c9588;
  --accent: #e8613a; --accent-hover: #ff7f57; --accent-ink: #1a0d07; --accent-text: var(--accent);
  --danger: #e2704f; --success: #5fb888; --warning: #c0861c; --info: #6c91dc;
  --ring: color-mix(in srgb, var(--accent) 55%, transparent);
  --shadow-2: 0 8px 24px -6px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
  --shadow-pop: 0 20px 50px -12px rgba(0,0,0,.7), 0 4px 12px rgba(0,0,0,.5);
}
:root[data-theme="light"] {
  --bg: #faf8f5; --surface: #ffffff; --surface2: #fbf9f6; --surface3: #f3efe8;
  --side: #fdfbf9; --border: #e6e1d8; --border-strong: #d5cec1;
  --text: #17150f; --text-2: #45403a; --text-muted: #6b665c;
  --accent: #c2461f; --accent-hover: #96350f; --accent-ink: #faf8f5; --accent-text: #96350f;
  --danger: #a83b1c; --success: #2f7d52; --warning: #8a6114; --info: #2c5bb8;
  --ring: color-mix(in srgb, var(--accent) 50%, transparent);
  --shadow-2: 0 8px 24px -6px rgba(23,21,15,.10), 0 2px 6px rgba(23,21,15,.06);
  --shadow-pop: 0 24px 50px -12px rgba(23,21,15,.16), 0 4px 12px rgba(23,21,15,.08);
}
:root {
  --accent-tint: color-mix(in srgb, var(--accent) 8%, transparent);
  --danger-tint: color-mix(in srgb, var(--danger) 8%, transparent);
  --success-tint: color-mix(in srgb, var(--success) 8%, transparent);
  --warning-tint: color-mix(in srgb, var(--warning) 8%, transparent);
  --info-tint: color-mix(in srgb, var(--info) 8%, transparent);
  --font: "IBM Plex Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius-sm: 5px; --radius: 7px; --radius-lg: 9px; --radius-pill: 999px;
  --sidebar-w: 232px; --gutter: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 var(--font); color: var(--text); background-color: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 82% -12%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%),
    radial-gradient(900px 600px at 0% 8%, color-mix(in srgb, var(--accent) 4%, transparent), transparent 55%);
  background-attachment: fixed;
}
a { color: var(--accent-text); }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
       stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--text-muted); }

/* --- Layout ------------------------------------------------------------------ */
.app { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column; gap: 3px; padding: 22px 14px;
  background: linear-gradient(var(--surface), var(--side)); border-right: 1px solid var(--border);
}
.side-logo { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; padding: 4px 10px 22px; }
.side-logo .ico { width: 22px; height: 22px; color: var(--accent); }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-2); text-decoration: none;
}
.nav-item:hover { background: var(--surface3); color: var(--text); }
.nav-item.active { background: var(--surface3); color: var(--text); font-weight: 600; }
.side-sep { border-top: 1px solid var(--border); margin: 12px 4px; }
.side-bas { margin-top: auto; }
.nav-pont { font-size: 12.5px; color: var(--text-muted); }
.nav-pont .fleche { margin-left: auto; }

.main { flex: 1; min-width: 0; padding: 0 var(--gutter) var(--gutter); }
.topbar {
  height: 52px; display: flex; align-items: center; gap: 12px; margin: 0 calc(-1 * var(--gutter)) var(--gutter);
  padding: 0 var(--gutter); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(8px);
}
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; font-size: 12.5px;
               border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.status-pill.reel .status-dot { background: var(--danger); }
.topbar-droite { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-meta { font-size: 12px; color: var(--text-muted); }
.theme-toggle { display: inline-flex; padding: 6px; border-radius: var(--radius-sm); cursor: pointer;
                border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }

/* --- Page head, KPIs, toolbar ------------------------------------------------- */
.page-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
h1 { font-size: 26px; line-height: 1.15; font-weight: 700; margin: 0 0 5px; }
.page-desc { font-size: 14px; color: var(--text-muted); margin: 0 0 26px; max-width: 588px; }
.page-tete-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.page-tete-actions form { margin: 0; }
.kpis { display: flex; gap: 36px; margin-bottom: 24px; flex-wrap: wrap; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-valeur { font: 600 26px/1.1 var(--font-mono); color: var(--text); }
.kpi-valeur small { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.kpi-accent .kpi-valeur { color: var(--accent-text); }
.kpi-alerte .kpi-valeur { color: var(--warning); }
.kpi-libelle { font-size: 12px; color: var(--text-muted); }
.toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar select, .champ {
  height: 35.5px; padding: 8px 11px; font: 13.5px var(--font); color: var(--text);
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.toolbar input[type=search] { width: 240px; }
.stats-bar { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

/* --- Buttons -------------------------------------------------------------------- */
button, .btn { font: inherit; cursor: pointer; }
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 13.5px; line-height: 1.2; text-decoration: none; white-space: nowrap;
}
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-strong); }
.btn-danger { background: var(--surface2); color: var(--danger); border: 1px solid var(--border); }
.btn-primary .ico, .btn-secondary .ico { width: 13px; height: 13px; stroke-width: 2; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }

/* --- Notices ---------------------------------------------------------------------- */
.notice { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; font-size: 13.5px; }
.notice.ok { background: var(--success-tint); color: var(--success); }
.notice.err { background: var(--danger-tint); color: var(--danger); }
.notice.warn { background: var(--warning-tint); color: var(--warning); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }

/* --- Table ------------------------------------------------------------------------ */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
            color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.cell-texte { width: 100%; min-width: 260px; }
.texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.texte-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.raison { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.provenance { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.table-action { white-space: nowrap; text-align: right; }
.table-action form { display: inline; margin: 0; }
.table-action .btn-sm + .btn-sm, .table-action form + form { margin-left: 6px; }
.vignettes { display: flex; gap: 4px; }
.vignettes img { width: 36px; height: 36px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.vide { padding: 40px 16px; text-align: center; color: var(--text-muted); }
.cell-ville { width: 100%; }
.form-ville { display: flex; gap: 8px; align-items: center; }
.form-ville .champ { width: 260px; max-width: 100%; }
.wrap { overflow-wrap: anywhere; white-space: pre-wrap; }

.badge { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
         padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
.badge-success { background: var(--success-tint); color: var(--success); }
.badge-warning { background: var(--warning-tint); color: var(--warning); }
.badge-danger { background: var(--danger-tint); color: var(--danger); }
.badge-info { background: var(--info-tint); color: var(--info); }
.badge-neutre { background: var(--surface3); color: var(--text-muted); }
.ok-text { color: var(--success); } .err-text { color: var(--danger); } .warn-text { color: var(--warning); }

/* --- Dialogs ----------------------------------------------------------------------- */
dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
         box-shadow: var(--shadow-pop); padding: 0; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(23, 21, 15, .35); }
.dlg-tete { padding: 18px 22px 0; }
.dlg-tete h2 { font-size: 17px; margin: 0 0 4px; }
.dlg-corps { padding: 6px 22px 4px; }
.dlg-pied { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }
label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
        color: var(--text-muted); margin: 14px 0 5px; }
input[type=text], input[type=password], textarea {
  width: 100%; font: 14px/1.45 var(--font); color: var(--text); background: var(--surface2);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; }
textarea { min-height: 110px; resize: vertical; }
input[type=file] { font-size: 13px; color: var(--text-2); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compteur { font: 12px var(--font-mono); color: var(--text-muted); text-align: right; margin-top: 4px; }
.compteur.trop { color: var(--danger); }

/* --- Login -------------------------------------------------------------------------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login { width: 100%; max-width: 348px; padding: 30px 32px 32px; background: var(--surface);
         border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
.login .side-logo { padding: 0 0 6px; }
.login p { margin: 0 0 8px; font-size: 12.5px; color: var(--text-muted); }
.login button { width: 100%; justify-content: center; margin-top: 16px; }

/* --- Phone: the sidebar becomes a top row, each table row a card --------------------- */
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .app { flex-direction: column; }
  .side { position: sticky; z-index: 5; height: auto; width: 100%; flex-direction: row; align-items: center;
          gap: 4px; padding: 8px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .side-logo { padding: 4px 6px; } .side-logo span, .side-sep, .nav-pont { display: none; }
  .side-bas { margin-top: 0; margin-left: auto; }
  .topbar { height: auto; min-height: 48px; flex-wrap: wrap; padding: 8px var(--gutter); }
  .topbar-meta { display: none; }
  .page-tete { flex-direction: column; gap: 0; }
  .page-tete-actions { justify-content: flex-start; margin-bottom: 20px; }
  .kpis { gap: 24px; }
  .toolbar input[type=search] { width: 100%; }
  .deux { grid-template-columns: 1fr; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px; border-bottom: 1px solid var(--border); }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: 3px 0; border: 0; min-width: 0; }
  .table-action { text-align: left; padding-top: 8px !important; }
}
