/* Interface famille OuiBox : sobre, neutre, lisible. Le marquage orange est réservé au logo. */
:root {
  --ink: #1B2A49;
  --text: #1F2937;
  --soft: #5B6575;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --line: #DDE1E8;
  --wash: #EEF1F5;
  --primary: #1B2A49;
  --accent: #E8833A;
  --green: #1E7A4C;
  --green-bg: #E3F2EA;
  --amber: #8A5A12;
  --amber-bg: #FAF0DC;
  --red: #B3372B;
  --red-bg: #FBE9E6;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; max-width: 100%; overflow-x: clip; overflow-wrap: anywhere; padding-bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--bg); }
.hidden { display: none !important; }
h1 { font-size: 24px; margin: 8px 0 16px; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; color: var(--ink); }
h2 { font-size: 17px; margin: 28px 0 10px; font-weight: 650; color: var(--ink); }
p { line-height: 1.5; }
a { color: var(--ink); }
.i { flex: none; vertical-align: middle; }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--ink); color: #fff;
}
.brand { padding: 10px 0; color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 2px; letter-spacing: -0.01em; }
.brand .dot { background: var(--accent); color: var(--ink); border-radius: 6px; padding: 1px 7px; margin-right: 3px; }
.senior { flex: 1; font-size: 14px; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: transparent; border: 0; color: inherit; padding: 10px; margin: -6px -6px -6px 0; cursor: pointer; display: flex; border-radius: 8px; }
.icon-btn:focus-visible { outline: 2px solid #fff; }

.view { max-width: 640px; margin: 0 auto; padding: 16px 16px 24px; outline: none; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none;
  color: var(--soft); font-size: 11.5px; font-weight: 600; padding: 8px 0 6px; position: relative;
}
.tabs a .ico { display: flex; }
.tabs a.active { color: var(--ink); }
.tabs a.active::before { content: ''; position: absolute; top: -5px; left: 28%; right: 28%; height: 2px; background: var(--ink); border-radius: 2px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow, .list-item > .grow { flex: 1; min-width: 0; }
.row > input { flex: 1; min-width: 0; width: auto; }
.muted { color: var(--soft); font-size: 14px; }
.small { font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 8px; border: 1px solid var(--primary); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  background: var(--primary); color: #fff; text-decoration: none;
}
.btn:hover { background: #263964; }
.btn:focus-visible { outline: 3px solid rgba(27, 42, 73, 0.3); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.secondary { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn.secondary:hover { background: var(--wash); }
.btn.danger { background: var(--card); border-color: #E6BFB9; color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 13.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 14px; color: var(--ink); }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text);
}
input, select, textarea { max-width: 100%; min-width: 0; }
input[type="date"], input[type="time"], input[type="datetime-local"] {
  -webkit-appearance: none; appearance: none; min-height: 46px; display: block; text-align: left;
}
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value { text-align: left; min-height: 1.4em; }
.grid2 > * { min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(27, 42, 73, 0.18); border-color: var(--ink); }
textarea { min-height: 140px; resize: vertical; }
.hint { font-size: 13px; color: var(--soft); margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { color: var(--red); font-weight: 600; margin-top: 12px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 128px;
}
.tile:hover { background: var(--wash); }
.tile .ico { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 8px; background: var(--wash); color: var(--ink); margin-bottom: 6px; }
.tile strong { font-size: 16px; font-weight: 650; }
.tile span:not(.ico) { font-size: 13px; color: var(--soft); }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: var(--wash); color: var(--soft); white-space: nowrap; }
.chip.seen { background: var(--green-bg); color: var(--green); }
.chip.wait { background: var(--amber-bg); color: var(--amber); }
.chip.off { background: var(--red-bg); color: var(--red); }

.kind-ico { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; background: var(--wash); color: var(--ink); flex: none; }
.thumbs { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; }
.thumbs img, .thumbs video { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; background: var(--wash); flex: none; }
.notif { border-left: 3px solid var(--ink); }
.notif-text { margin: 0; display: flex; gap: 10px; align-items: flex-start; }
.notif-ico { color: var(--ink); display: flex; padding-top: 2px; }

.progress { height: 6px; background: var(--wash); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; width: 0; background: var(--ink); transition: width 0.2s; }

.rec { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 0; }
.rec-btn { width: 104px; height: 104px; border-radius: 50%; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rec-btn.on { background: var(--red); border-color: var(--red); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(179, 55, 43, 0.15); } }
.timer { font-size: 26px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; }
.status-dot.on { background: var(--green); }
.linkbox { word-break: break-all; background: var(--wash); padding: 12px; border-radius: 8px; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; font-weight: 500; font-size: 14.5px; max-width: 90vw;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.22);
}
.center { text-align: center; }
.hero { text-align: center; padding: 24px 0 8px; }
.hero .big { display: inline-flex; width: 64px; height: 64px; align-items: center; justify-content: center; border-radius: 14px; background: var(--wash); color: var(--ink); margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 650; padding: 11px 0; color: var(--ink); }

/* Choix d'affichage de l'écran : cartes avec aperçu */
fieldset.looks { border: 0; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
fieldset.looks legend { font-weight: 600; font-size: 14px; color: var(--ink); padding: 0; margin-bottom: 8px; }
fieldset.looks.two { grid-template-columns: 1fr 1fr; }
.look { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400; }
.look:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.look { position: relative; }
.look input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.look:has(input:focus-visible) { outline: 3px solid rgba(27, 42, 73, 0.3); }
.look-prev { grid-row: span 2; width: 86px; height: 52px; border-radius: 6px; background: #000; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; line-height: 1.15; }
.look-prev b { color: #fff; font-size: 16px; font-weight: 800; }
.look-prev i { color: #FFAA4D; font-size: 12px; font-style: normal; font-weight: 800; }
.look-prev.lumineux { border: 3px solid #fff; outline: 1px solid var(--line); }
.look-prev.lumineux i { color: #fff; }
.look-prev.doux { filter: brightness(0.55); }
.look-name { font-weight: 650; color: var(--ink); font-size: 15px; }
.look-desc { font-size: 13px; color: var(--soft); line-height: 1.35; }
fieldset.looks.two .look { grid-template-columns: 1fr; }

/* Mouvements réduits */
@media (prefers-reduced-motion: reduce) {
  .rec-btn.on { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* Téléphone en mode paysage : barre d'onglets plus basse pour garder de la place */
@media (max-height: 480px) {
  .tabs a { flex-direction: row; justify-content: center; gap: 6px; padding: 10px 0; }
  body { padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
}

/* Tablette et ordinateur : on exploite la largeur sans étirer le texte */
@media (min-width: 700px) {
  .view { max-width: 760px; padding: 24px 24px 32px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  fieldset.looks:not(.two) { grid-template-columns: repeat(3, 1fr); }
  fieldset.looks:not(.two) .look { grid-template-columns: 1fr; }
  fieldset.looks:not(.two) .look-prev { grid-row: auto; margin-bottom: 10px; }
  .tabs { justify-content: center; }
  .tabs a { max-width: 140px; }
  h1 { font-size: 28px; }
}

/* Fenêtres de dialogue dans la page */
.popup-back { position: fixed; inset: 0; z-index: 20; background: rgba(15, 23, 42, 0.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.popup { background: var(--card); border-radius: 12px; padding: 20px; width: 100%; max-width: 420px; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.3); }
.popup h2 { margin: 0 0 8px; font-size: 18px; }
.popup p { margin: 0 0 12px; color: var(--muted, #4B5563); overflow-wrap: anywhere; }
.popup-actions { display: flex; flex-direction: column-reverse; gap: 8px; margin-top: 16px; }
.popup-actions .btn { width: 100%; }
@media (min-width: 480px) { .popup-actions { flex-direction: row; justify-content: flex-end; } .popup-actions .btn { width: auto; } }
