/* ============================================================
   FOCUS TV BACKOFFICE v3 — css/app.css
   Design system « Régie » : sombre par défaut, charte Focus TV.
   Une seule police (Roboto). Rouge = action / antenne,
   jaune = focus clavier & mise en avant, ambre = avertissement.
   ============================================================ */

:root {
  --bg:          #0A0A0A;
  --surface:     #141414;
  --surface-2:   #1A1A1A;
  --surface-3:   #222222;
  --line:        #262626;
  --line-strong: #353535;
  --text:        #F4F4F4;
  --text-2:      #A8A8A8;
  --text-3:      #6F6F6F;

  --red:         #E3221F;
  --red-hover:   #F23A36;
  --red-soft:    rgba(227, 34, 31, .14);
  --yellow:      #FCCD0F;
  --yellow-soft: rgba(252, 205, 15, .14);
  --amber:       #F5A41B;
  --amber-soft:  rgba(245, 164, 27, .14);
  --green:       #2FBF71;
  --green-soft:  rgba(47, 191, 113, .14);
  --blue:        #4C8DF6;
  --blue-soft:   rgba(76, 141, 246, .14);

  --focus:       #FCCD0F;
  --overlay:     rgba(0, 0, 0, .62);
  --shadow-pop:  0 18px 50px rgba(0, 0, 0, .55), 0 0 0 1px var(--line);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --sidebar-w: 244px;
  --topbar-h:  58px;

  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fs-xs: .75rem;   /* 12 */
  --fs-sm: .8125rem; /* 13 */
  --fs-md: .875rem;  /* 14 */
  --fs-lg: 1rem;     /* 16 */
  --fs-xl: 1.375rem; /* 22 */
  --fs-2xl: 1.75rem; /* 28 */

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:          #F5F5F4;
  --surface:     #FFFFFF;
  --surface-2:   #F3F3F2;
  --surface-3:   #EAEAE8;
  --line:        #E3E3E1;
  --line-strong: #D0D0CD;
  --text:        #151515;
  --text-2:      #555555;
  --text-3:      #8A8A8A;
  --red-soft:    rgba(227, 34, 31, .09);
  --yellow-soft: rgba(252, 205, 15, .22);
  --amber-soft:  rgba(245, 164, 27, .14);
  --green:       #1E9E5A;
  --green-soft:  rgba(30, 158, 90, .1);
  --blue-soft:   rgba(76, 141, 246, .1);
  --focus:       #B8860B;
  --overlay:     rgba(20, 20, 20, .38);
  --shadow-pop:  0 18px 50px rgba(0, 0, 0, .14), 0 0 0 1px var(--line);
  color-scheme: light;
}

/* ─── Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-md)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

/* ─── Tally « à l'antenne » ────────────────────────────── */
.tally {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: var(--red);
  box-shadow: 0 0 18px 2px rgba(227, 34, 31, .55);
}

/* ─── Layout ───────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.app.is-collapsed { --sidebar-w: 72px; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 18px;
  border-bottom: 1px solid var(--line);
}
.sb-logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--red); color: #fff; font-weight: 900; font-size: .8rem;
}
.sb-logo img { width: 100%; height: 100%; object-fit: contain; }
.sb-name { font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.sb-name span { color: var(--yellow); }

.sb-create { padding: 14px 14px 6px; }
.sb-create .btn { width: 100%; justify-content: center; }

.sb-nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.sb-group { margin-top: 14px; }
.sb-group-title { padding: 0 10px 6px; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.sb-link {
  display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 10px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-size: var(--fs-md);
  white-space: nowrap;
}
.sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-link[aria-current="page"] { background: var(--surface-3); color: var(--text); font-weight: 500; }
.sb-link[aria-current="page"] .ico { color: var(--red); }
.sb-link .sb-badge { margin-left: auto; }
.sb-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: auto; animation: pulse 1.6s infinite; }

.sb-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid var(--line);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: var(--surface-3); color: var(--text); font-weight: 500; font-size: var(--fs-sm);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 44px; height: 44px; font-size: var(--fs-lg); }
.sb-user { min-width: 0; flex: 1; }
.sb-user-mail { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-role { font-size: var(--fs-xs); color: var(--text-3); }

.app.is-collapsed .sb-name,
.app.is-collapsed .sb-group-title,
.app.is-collapsed .sb-link span,
.app.is-collapsed .sb-user,
.app.is-collapsed .sb-create .btn span,
.app.is-collapsed .sb-live-dot { display: none; }
.app.is-collapsed .sb-link { justify-content: center; padding: 0; }
.app.is-collapsed .sb-brand { justify-content: center; padding: 0; }
.app.is-collapsed .sb-foot { flex-direction: column; }

.main { min-width: 0; display: flex; flex-direction: column; }
.nav-scrim { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tb-crumb { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); font-size: var(--fs-sm); }
.tb-crumb strong { color: var(--text); font-weight: 500; }
.tb-spacer { flex: 1; }
.tb-search {
  display: flex; align-items: center; gap: 8px;
  height: 36px; width: min(340px, 34vw); padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-3); cursor: pointer;
  font-size: var(--fs-sm);
}
.tb-search:hover { border-color: var(--line-strong); color: var(--text-2); }
.tb-search kbd { margin-left: auto; }
kbd {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px;
  font: 500 .7rem/1 var(--font); color: var(--text-2); background: var(--surface-2);
}
.onair {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--red); color: #fff; text-decoration: none;
  font-size: var(--fs-sm); font-weight: 500;
}
.onair .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
.onair .num { opacity: .9; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.content { padding: 28px 28px 64px; width: 100%; max-width: 1320px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 500; line-height: 1.15; }
.page-head p { color: var(--text-2); margin-top: 6px; max-width: 64ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.mobile-only { display: none !important; }

/* ─── Boutons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  font-size: var(--fs-md); font-weight: 500; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled, .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); }
.btn-outline { background: transparent; border-color: var(--line-strong); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.btn-danger:hover { background: var(--red-soft); }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); gap: 6px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--fs-lg); }
.btn-icon { width: 36px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 30px; }
.btn[aria-busy="true"]::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Cartes & sections ────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: var(--fs-lg); }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 16px 20px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }

/* Indicateurs : une rangée sobre séparée par des filets, pas des cartes empilées */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 20px; overflow: hidden;
}
.kpi { padding: 16px 20px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi-label { font-size: var(--fs-sm); color: var(--text-2); }
.kpi-value { font-size: var(--fs-2xl); font-weight: 500; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.kpi-sub.up { color: var(--green); }

/* ─── Barre d'outils / filtres ─────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.search {
  position: relative; display: flex; align-items: center;
  min-width: 220px; flex: 1; max-width: 360px;
}
.search .ico { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 34px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.seg button {
  height: 28px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent;
  color: var(--text-2); font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  height: 40px; padding: 0 14px; border: 0; background: transparent; cursor: pointer;
  color: var(--text-2); font-size: var(--fs-md); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--red); font-weight: 500; }
.tab .count { color: var(--text-3); margin-left: 4px; }

/* ─── Formulaires ──────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.field .hint { font-size: var(--fs-xs); color: var(--text-3); }
.field .req { color: var(--red); }
.row { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--text); font-size: var(--fs-md);
  transition: border-color .12s, background .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); background: var(--surface); }
.input[aria-invalid="true"] { border-color: var(--red); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.select-sm, .input-sm { height: 32px; font-size: var(--fs-sm); }
.input-color { width: 44px; padding: 3px; cursor: pointer; }

.switch { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; width: 38px; height: 22px; flex: none; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line-strong); transition: background .15s;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-2); transition: transform .15s, background .15s;
}
.switch input:checked + .track { background: var(--red); border-color: var(--red); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch .sw-text { display: flex; flex-direction: column; }
.switch .sw-text small { color: var(--text-3); font-size: var(--fs-xs); }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 120px; padding: 18px; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: var(--fs-sm);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--red); color: var(--text); background: var(--red-soft); }
.dropzone strong { color: var(--text); font-weight: 500; }

.media-field { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: start; }
.media-preview {
  aspect-ratio: 16/9; border-radius: var(--r-sm); overflow: hidden;
  background: var(--surface-3); display: grid; place-items: center; color: var(--text-3);
  border: 1px solid var(--line);
}
.media-preview.square { aspect-ratio: 1; }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-actions { display: flex; flex-direction: column; gap: 8px; }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--red); transition: width .2s; }
.progress-text { font-size: var(--fs-xs); color: var(--text-2); margin-top: 6px; }

/* Éditeur d'article */
.rte { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.rte:focus-within { border-color: var(--focus); }
.rte-bar { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rte-bar button { height: 30px; min-width: 30px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; color: var(--text-2); cursor: pointer; font-size: var(--fs-sm); }
.rte-bar button:hover { background: var(--surface-3); color: var(--text); }
.rte-body { min-height: 260px; max-height: 52vh; overflow-y: auto; padding: 14px; outline: none; line-height: 1.65; }
.rte-body h2 { font-size: 1.2rem; margin: .8em 0 .3em; }
.rte-body h3 { font-size: 1.05rem; margin: .8em 0 .3em; }
.rte-body p { margin: 0 0 .7em; }
.rte-body blockquote { margin: .6em 0; padding-left: 12px; border-left: 3px solid var(--red); color: var(--text-2); }
.rte-body:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.rte-foot { padding: 6px 10px; font-size: var(--fs-xs); color: var(--text-3); border-top: 1px solid var(--line); }

/* ─── Tableaux ─────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th {
  text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--text-2);
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-selected { background: var(--red-soft); }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.cell-thumb { width: 84px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; flex: none; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); position: relative; }
.cell-thumb.square { width: 40px; aspect-ratio: 1; }
.cell-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cell-thumb .dur { position: absolute; right: 4px; bottom: 4px; font-size: .68rem; padding: 0 4px; border-radius: 3px; background: rgba(0,0,0,.75); color: #fff; }
.cell-title { font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cell-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.row-actions { display: inline-flex; gap: 2px; }
.check { width: 16px; height: 16px; accent-color: var(--red); cursor: pointer; }

.bulkbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: var(--fs-sm);
}
.table-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--text-2); }
.table-foot .pager { margin-left: auto; display: flex; gap: 4px; align-items: center; }

/* Liste simple (sans en-têtes) */
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Badges / statuts ─────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-green  { background: var(--green-soft);  color: var(--green); }
.badge-red    { background: var(--red-soft);    color: var(--red); }
.badge-amber  { background: var(--amber-soft);  color: var(--amber); }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge-blue   { background: var(--blue-soft);   color: var(--blue); }
:root[data-theme="light"] .badge-yellow { color: #8a6a00; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-2); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ─── États ────────────────────────────────────────────── */
.empty { padding: 56px 24px; text-align: center; color: var(--text-2); }
.empty .ico { width: 36px; height: 36px; color: var(--text-3); margin: 0 auto 12px; stroke-width: 1.4; }
.empty h3 { font-size: var(--fs-lg); color: var(--text); margin-bottom: 4px; }
.empty p { max-width: 46ch; margin: 0 auto; }
.empty .btn { margin-top: 16px; }
.state-error .ico { color: var(--red); }

.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 6px; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.sk-line { height: 12px; margin: 6px 0; }

.callout {
  display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--amber-soft); color: var(--text); font-size: var(--fs-sm); margin-bottom: 16px;
}
.callout .ico { color: var(--amber); margin-top: 1px; }
.callout.info { background: var(--blue-soft); }
.callout.info .ico { color: var(--blue); }
.callout.danger { background: var(--red-soft); }
.callout.danger .ico { color: var(--red); }

/* ─── Drawer (panneau latéral d'édition) ───────────────── */
.layer { position: fixed; inset: 0; z-index: 80; display: none; }
.layer.is-open { display: block; }
.layer-backdrop { position: absolute; inset: 0; background: var(--overlay); animation: fade .15s; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(600px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-pop); animation: slide .18s ease-out;
}
.drawer-wide { width: min(860px, 100vw); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: var(--fs-lg); }
.drawer-head .btn-icon { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.drawer-foot .spacer { flex: 1; }
.form-section { padding-bottom: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; margin-bottom: 0; }
.form-section > h3 { font-size: var(--fs-md); margin-bottom: 12px; color: var(--text); }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: absolute; left: 50%; top: 14vh; transform: translateX(-50%);
  width: min(460px, calc(100vw - 32px));
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  animation: fade .15s;
}
.modal-body { padding: 22px 22px 8px; }
.modal-body h2 { font-size: var(--fs-lg); margin-bottom: 8px; }
.modal-body p { color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }

/* Palette de commandes */
.cmdk {
  position: absolute; left: 50%; top: 12vh; transform: translateX(-50%);
  width: min(600px, calc(100vw - 24px));
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  overflow: hidden; animation: fade .12s;
}
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmdk-input input { flex: 1; height: 52px; border: 0; background: transparent; outline: none; font-size: var(--fs-lg); }
.cmdk-list { max-height: 54vh; overflow-y: auto; padding: 6px; }
.cmdk-group { padding: 8px 10px 4px; font-size: var(--fs-xs); color: var(--text-3); }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 0 10px; height: 42px; border-radius: var(--r-sm); cursor: pointer; color: var(--text-2); }
.cmdk-item[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.cmdk-item .hint { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); }
.cmdk-empty { padding: 28px; text-align: center; color: var(--text-3); }

/* ─── Toasts ───────────────────────────────────────────── */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 420px; padding: 12px 14px;
  background: var(--surface-3); color: var(--text); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); font-size: var(--fs-md); animation: slideup .18s;
}
.toast .ico { margin-top: 1px; }
.toast.success .ico { color: var(--green); }
.toast.error .ico   { color: var(--red); }
.toast.warning .ico { color: var(--amber); }
.toast.info .ico    { color: var(--blue); }
.toast .toast-action { margin-left: auto; background: none; border: 0; color: var(--yellow); cursor: pointer; font-weight: 500; padding: 0 0 0 8px; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: .2s; }
@keyframes slideup { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Régie (live) ─────────────────────────────────────── */
.regie {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; margin-bottom: 20px;
}
.regie.is-live { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.regie-screen { position: relative; background: #000; min-height: 280px; display: grid; place-items: center; color: #777; }
.regie-screen iframe { background: #000; }
.regie-screen iframe, .regie-screen img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.regie-screen .tag {
  position: absolute; left: 12px; top: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: var(--fs-xs); font-weight: 500;
}
.regie-screen .tag.live { background: var(--red); }
.regie-panel { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.timecode { font-size: 2.6rem; font-weight: 300; letter-spacing: .02em; font-variant-numeric: tabular-nums; line-height: 1; }
.regie.is-live .timecode { color: var(--red); }
.regie-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* Notification : aperçu téléphone */
.phone-preview {
  border-radius: 20px; padding: 18px 14px; background: linear-gradient(160deg, #1d1d1f, #2a2a2d);
  color: #fff;
}
.push {
  display: flex; gap: 10px; padding: 12px; border-radius: 14px;
  background: rgba(255,255,255,.12); backdrop-filter: blur(6px);
}
.push-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--red); display: grid; place-items: center; font-weight: 900; font-size: .7rem; flex: none; }
.push-app { font-size: .7rem; opacity: .7; display: flex; justify-content: space-between; }
.push-title { font-weight: 500; font-size: .86rem; margin-top: 2px; }
.push-body { font-size: .8rem; opacity: .85; margin-top: 2px; }

/* Barres horizontales (stats) */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.bar-track { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--red); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

.spark { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.spark > div { flex: 1; background: var(--red); border-radius: 3px 3px 0 0; min-height: 3px; opacity: .85; }
.spark-labels { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-3); margin-top: 6px; }

/* Arborescence catégories */
.tree-cat { border-bottom: 1px solid var(--line); }
.tree-cat:last-child { border-bottom: 0; }
.tree-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.tree-head .grow { flex: 1; min-width: 0; }
.tree-toggle { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 4px; border-radius: 4px; display: grid; place-items: center; }
.tree-toggle .ico { transition: transform .15s; }
.tree-cat.is-open .tree-toggle .ico { transform: rotate(90deg); }
.tree-rubs { display: none; padding: 0 16px 10px 54px; }
.tree-cat.is-open .tree-rubs { display: block; }
.tree-rub { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); }
.tree-rub:hover { background: var(--surface-2); }
.tree-rub .grow { flex: 1; }

/* Cartes média (grilles) */
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.media-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; }
.media-card .thumb { aspect-ratio: 16/9; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); position: relative; }
.media-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-card .thumb .badge { position: absolute; left: 8px; top: 8px; }
.media-card .body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.media-card .foot { display: flex; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--line); }
.media-card.is-dragging { opacity: .4; }
.media-card.is-over { outline: 2px dashed var(--red); outline-offset: -2px; }
.drag-handle { cursor: grab; color: var(--text-3); }

/* Connexion */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-aside {
  position: relative; overflow: hidden; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: #050505; color: #fff; border-right: 1px solid var(--line);
}
.login-aside .bars-deco { position: absolute; inset: auto 0 0 0; height: 46%; display: flex; gap: 0; opacity: .9; }
.login-aside .bars-deco span { flex: 1; }
.login-aside h1 { font-size: 2.6rem; font-weight: 300; line-height: 1.1; max-width: 13ch; position: relative; }
.login-aside p { color: #9a9a9a; margin-top: 14px; max-width: 40ch; position: relative; }
.login-main { display: grid; place-items: center; padding: 32px; }
.login-box { width: min(380px, 100%); }
.login-box h2 { font-size: var(--fs-xl); margin-bottom: 6px; }
.login-box > p { color: var(--text-2); margin-bottom: 26px; }
.login-box .btn { width: 100%; justify-content: center; }
.pw-wrap { position: relative; }
.pw-wrap .btn { position: absolute; right: 3px; top: 3px; height: 32px; width: 32px; }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid-main, .regie { grid-template-columns: 1fr !important; }
  .regie-screen { aspect-ratio: 16/9; min-height: 0; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 90; width: 270px;
    transform: translateX(-100%); transition: transform .2s;
  }
  .app.is-nav-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .nav-scrim { position: fixed; inset: 0; z-index: 85; background: var(--overlay); display: none; }
  .app.is-nav-open .nav-scrim { display: block; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .topbar { padding: 0 16px; }
  .tb-search { width: 40px; padding: 0; justify-content: center; }
  .tb-search span, .tb-search kbd { display: none; }
  .content { padding: 20px 16px 56px; }
  .grid-2, .grid-3, .row, .row-3 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: var(--fs-xl); }
  .page-head .actions { margin-left: 0; width: 100%; }
  .search { max-width: none; min-width: 0; width: 100%; flex: 1 1 100%; }
  .toolbar .seg { max-width: 100%; overflow-x: auto; }
  .onair > span:not(.dot):not(.num) { display: none; }
  .onair { padding: 0 10px; }
  .media-field { grid-template-columns: 1fr; }
  .kpi { border-right: 0; border-bottom: 1px solid var(--line); }
  .login { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .table .hide-sm { display: none; }
  .bar-row { grid-template-columns: 90px 1fr 40px; }
}

/* Boutons radio au style des interrupteurs */
.switch input[type="radio"] + .track { width: 20px; height: 20px; border-radius: 50%; }
.switch input[type="radio"] + .track::after { top: 4px; left: 4px; width: 10px; height: 10px; background: transparent; }
.switch input[type="radio"]:checked + .track::after { transform: none; background: #fff; }
code { font-size: .85em; padding: 1px 5px; border-radius: 4px; background: var(--surface-3); }
