/* Cercle sur téléphone (0.9.6) — palette « Nuit & Ambre », sombre par défaut. */
:root {
  --paper: #14111c;
  --surface: #1c1826;
  --surface-2: #231e30;
  --ink: #ece8f4;
  --ink-soft: #a39db2;
  --line: #2e2840;
  --pine: #a99bff;
  --pine-wash: #2a2450;
  --on-pine: #14111c;
  --ochre: #f3a83b;
  --ok: #4cc38a;
  --ok-wash: #173326;
  --warn: #f3b54f;
  --warn-wash: #3a2c12;
  --brick: #ff7a6b;
  --brick-wash: #3d1c1a;
  --font: -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --paper: #f5f3ef; --surface: #ffffff; --surface-2: #faf8f5; --ink: #1d1a26; --ink-soft: #5e5869; --line: #e4e0d9;
    --pine: #4a3cc0; --pine-wash: #ecebfb; --on-pine: #ffffff; --ok: #18794e; --ok-wash: #e3f3ea;
    --warn: #9a5b00; --warn-wash: #fdf1dc; --brick: #c0322a; --brick-wash: #fbe7e5;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
body { padding: env(safe-area-inset-top) 0 calc(72px + env(safe-area-inset-bottom)); min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.top { position: sticky; top: 0; z-index: 5; background: #1a1624; color: #ece8f4; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand div { display: flex; flex-direction: column; line-height: 1.15; }
.brand span { font-size: 13px; color: #a9a3b8; }
main { padding: 16px; max-width: 760px; margin: 0 auto; }
h1 { font-size: 24px; margin: 4px 0 12px; }
h2 { font-size: 18px; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }

.btn { min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--pine); border-color: var(--pine); color: var(--on-pine); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; }
.btn.danger { color: var(--brick); border-color: color-mix(in srgb, var(--brick) 50%, transparent); background: transparent; }

.search { display: flex; gap: 8px; margin-bottom: 10px; }
.search input { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.chip { flex: none; min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--pine-wash); color: var(--pine); border-color: var(--pine); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { all: unset; display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0; }
.card:focus-visible { outline: 2px solid var(--pine); outline-offset: 3px; border-radius: 10px; }
.poster { position: relative; aspect-ratio: 2 / 3; border-radius: 10px; background: var(--surface-2); overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center; font-weight: 700; color: var(--ink-soft); }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dispo { position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 99px; background: rgba(20, 17, 28, .82); color: #fff; border: 2px solid var(--ochre); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.dispo.zero { border-color: #6b6478; color: #c9c3d6; }
.card strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card span { font-size: 12px; color: var(--ink-soft); }
.more { margin: 18px 0; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.badge { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.badge.attente { background: var(--warn-wash); color: var(--warn); }
.badge.en_cours { background: var(--pine-wash); color: var(--pine); }
.badge.termine { background: var(--ok-wash); color: var(--ok); }
.badge.erreur { background: var(--brick-wash); color: var(--brick); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.panel.ok { background: var(--ok-wash); border-color: transparent; }
.panel.warn { background: var(--warn-wash); border-color: transparent; color: var(--warn); }
.steps { margin: 8px 0 0; padding-left: 22px; }
.steps li { margin-bottom: 6px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; }
.switch input { width: 24px; height: 24px; accent-color: var(--pine); }

dialog#sheet { width: 100%; max-width: 640px; max-height: 92vh; margin: auto auto 0; border: 0; border-radius: 18px 18px 0 0; padding: 0 0 env(safe-area-inset-bottom); background: var(--surface); color: var(--ink); }
dialog#sheet::backdrop { background: rgba(0, 0, 0, .55); }
.sheet-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.sheet-head { display: flex; gap: 14px; }
.sheet-head .poster { width: 110px; flex: none; }
.sheet-close { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 10px 10px 0; background: var(--surface); }
.icon-btn { width: 44px; height: 44px; border-radius: 99px; border: 0; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
.tabs[hidden] { display: none; }
.tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; min-height: 52px; color: var(--ink-soft); }
.tabs button[aria-current="page"] { color: var(--pine); font-weight: 600; }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 20; background: #1a1624; color: #fff; border-radius: 12px; padding: 12px 14px; font-size: 15px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
#toast.error { background: var(--brick); color: #14111c; }
.empty { text-align: center; padding: 40px 10px; color: var(--ink-soft); }
.targets { display: flex; flex-direction: column; gap: 10px; }
.panel.banner { width: 100%; text-align: left; font: inherit; color: var(--pine); font-weight: 600; cursor: pointer; }
.device-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--pine); }
.watch-row { display: flex; gap: 8px; }
