/* ==========================================================================
   Console TV — interface d'administration
   Palette Océan (bleu → cyan), thème clair / sombre, sans ressource externe.
   ========================================================================== */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/manrope-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Thème ---------- */
:root {
  color-scheme: light dark;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

  --bg: light-dark(#f2f6fa, #0a111b);
  --bg-soft: light-dark(#e6edf5, #0e1725);
  --surface: light-dark(#fbfdff, #111c2b);
  --surface-2: light-dark(#f2f6fb, #172334);
  --raised: light-dark(#ffffff, #1c2a3d);
  --ink: light-dark(#0f1b2d, #e8eff8);
  --ink-soft: light-dark(#2d3c52, #c3d0e0);
  --muted: light-dark(#5c6b80, #93a4bb);
  --faint: light-dark(#8593a6, #6f8199);
  --line: light-dark(rgba(15, 27, 45, 0.09), rgba(232, 239, 248, 0.08));
  --line-strong: light-dark(rgba(15, 27, 45, 0.17), rgba(232, 239, 248, 0.16));

  /* Accent Océan : bleu vers cyan, plus lumineux en thème sombre. */
  --accent: light-dark(#0a6fd6, #4cc3f5);
  --accent-ink: light-dark(#0752a1, #a3e0fc);
  --accent-soft: light-dark(rgba(10, 111, 214, 0.1), rgba(76, 195, 245, 0.13));
  --accent-line: light-dark(rgba(10, 111, 214, 0.3), rgba(76, 195, 245, 0.32));
  --accent-grad: linear-gradient(135deg, #38bdf8 0%, #0e87e0 50%, #0a5cc0 100%);
  --on-accent: #ffffff;
  /* Teinte de l'accent pour les halos (R G B). */
  --glow: 56 189 248;

  --ok: light-dark(#0f7a52, #4fd6a0);
  --ok-bg: light-dark(rgba(15, 122, 82, 0.1), rgba(79, 214, 160, 0.12));
  --warn: light-dark(#9a5b00, #f5bb5a);
  --warn-bg: light-dark(rgba(214, 140, 20, 0.13), rgba(245, 187, 90, 0.13));
  --danger: light-dark(#b42336, #ff8b99);
  --danger-bg: light-dark(rgba(180, 35, 54, 0.09), rgba(255, 139, 153, 0.12));
  --info: light-dark(#5b3fd6, #b3a4ff);
  --info-bg: light-dark(rgba(91, 63, 214, 0.1), rgba(179, 164, 255, 0.13));

  /* Barre latérale : bleu marine, dans les deux thèmes. */
  --side-bg: #081424;
  --side-bg-2: #0e203a;
  --side-ink: #e3edf9;
  --side-muted: #8aa1bf;
  --side-line: color-mix(in srgb, var(--side-ink) 8%, transparent);
  --side-link: #c9d8ec;
  --side-active-ink: #d2ecff;
  --side-active-icon: #7dd3fc;
  --auth-bg: #06101d;
  --auth-card-1: rgba(17, 38, 66, 0.85);
  --auth-card-2: rgba(8, 20, 36, 0.92);
  --auth-field: #10223c;
  --hero-1: #0f2c52;
  --hero-2: #081424;
  --hero-muted: #9fb7d6;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: light-dark(0 1px 2px rgba(15, 27, 45, 0.06), 0 1px 2px rgba(0, 0, 0, 0.35));
  --shadow: light-dark(0 1px 2px rgba(15, 27, 45, 0.05), 0 1px 2px rgba(0, 0, 0, 0.3)), light-dark(0 12px 32px -16px rgba(15, 27, 45, 0.18), 0 16px 40px -18px rgba(0, 0, 0, 0.7));
  --shadow-lg: 0 30px 70px -24px light-dark(rgba(15, 27, 45, 0.35), rgba(0, 0, 0, 0.85));
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);

  --side-w: 264px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

/* Texte clair sur fond sombre : paraît plus gras, on allège d'un cran. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body {
    font-weight: 400;
  }
}

:root[data-theme="dark"] body {
  font-weight: 400;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.55;
  font-weight: 450;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  line-height: 1.2;
}

a {
  color: var(--accent);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

svg.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.icon-sm {
  width: 15px !important;
  height: 15px !important;
}

.icon-lg {
  width: 22px !important;
  height: 22px !important;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.mono {
  font-family: var(--mono);
  font-size: 0.88em;
}

.muted {
  color: var(--muted);
}

.truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Écran de démarrage ---------- */
.splash {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.splash img {
  width: 64px;
  height: 64px;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
    transform: scale(0.96);
  }
}

/* ---------- Connexion ---------- */
.auth {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 16px;
  background: var(--auth-bg);
  color: var(--side-ink);
  overflow: hidden;
}

.auth::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(50% 45% at 50% 0%, rgb(var(--glow) / 0.22), transparent 70%),
    radial-gradient(40% 40% at 90% 100%, rgb(var(--glow) / 0.1), transparent 70%);
}

.auth::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(60% 60% at 50% 30%, #000, transparent 75%);
}

.auth-card {
  width: min(100%, 420px);
  padding: 40px 36px 34px;
  border: 1px solid color-mix(in srgb, var(--side-ink) 10%, transparent);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--auth-card-1), var(--auth-card-2));
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  animation: rise 0.6s var(--ease) both;
  color-scheme: dark;
  --ink: var(--side-ink);
  --muted: var(--side-muted);
  --surface-2: var(--auth-field);
  --line-strong: color-mix(in srgb, var(--side-ink) 16%, transparent);
  --danger: #ff8a98;
  --danger-bg: rgba(255, 138, 152, 0.12);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  text-align: center;
}

.auth-brand img {
  width: 68px;
  height: 68px;
  filter: drop-shadow(0 12px 24px rgb(var(--glow) / 0.25));
}

.auth-brand h1 {
  font-size: 1.55rem;
  font-weight: 700;
}

.auth-brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth .form {
  gap: 16px;
}

.auth .btn-primary {
  width: 100%;
  margin-top: 6px;
}

.auth-foot {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.code-input {
  font-family: var(--mono);
  font-size: 1.5rem !important;
  letter-spacing: 0.4em;
  text-align: center;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* ---------- Structure ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 14px 16px;
  background: linear-gradient(180deg, var(--side-bg-2), var(--side-bg));
  color: var(--side-ink);
  border-right: 1px solid var(--side-line);
  color-scheme: dark;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 22px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--side-line);
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 46px;
  height: 46px;
  flex: none;
  filter: drop-shadow(0 10px 20px rgb(var(--glow) / 0.18));
}

.brand strong {
  display: block;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand div > span {
  display: block;
  color: var(--side-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  padding: 14px 12px 6px;
  color: var(--side-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--side-link);
  font-size: 0.92rem;
  font-weight: 550;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.nav a .icon {
  color: var(--side-muted);
  transition: color 0.2s;
}

.nav a:hover {
  background: color-mix(in srgb, var(--side-ink) 6%, transparent);
  color: #fff;
}

.nav a[aria-current="page"] {
  background: linear-gradient(90deg, rgb(var(--glow) / 0.18), rgb(var(--glow) / 0.05));
  color: var(--side-active-ink);
}

.nav a[aria-current="page"] .icon {
  color: var(--side-active-icon);
}

.nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-grad);
}

.nav .count {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--side-ink) 8%, transparent);
  color: var(--side-muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.nav a[aria-current="page"] .count {
  background: rgb(var(--glow) / 0.2);
  color: var(--side-active-ink);
}

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--side-line);
}

.side-foot .nav a {
  font-size: 0.88rem;
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 4px;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-grad);
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.who strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
}

.who div > span {
  display: block;
  color: var(--side-muted);
  font-size: 0.75rem;
}

.main {
  min-width: 0;
}

.topbar {
  display: none;
}

.page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 36px 64px;
  animation: fade 0.35s var(--ease) both;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 26px;
}

.page-head h1 {
  font-size: clamp(1.55rem, 1.2vw + 1.1rem, 2rem);
  font-weight: 700;
}

.page-head p {
  margin-top: 6px;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Cartes ---------- */
.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 26px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 0;
}

.card-head h2 {
  font-size: 1.08rem;
  font-weight: 600;
}

.card-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-title .chip-icon {
  flex: none;
}

.chip-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.stack {
  display: grid;
  /* Colonne bornée à la largeur disponible : un texte tronqué (.truncate) ne déborde pas. */
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

/* ---------- Statistiques ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.25s var(--ease), box-shadow 0.25s;
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat[aria-pressed="true"] {
  border-color: var(--accent-line);
  box-shadow: var(--ring);
}

.stat .chip-icon {
  width: 42px;
  height: 42px;
}

.stat-ok .chip-icon {
  background: var(--ok-bg);
  color: var(--ok);
}

.stat-warn .chip-icon {
  background: var(--warn-bg);
  color: var(--warn);
}

.stat-danger .chip-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat strong {
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat div > span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background-color 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}

.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: 0 10px 24px -12px rgb(var(--glow) / 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -12px rgb(var(--glow) / 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-outline {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.btn-outline:not(:disabled):hover {
  border-color: var(--accent-line);
  background: var(--surface-2);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}

.btn-ghost:not(:disabled):hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: light-dark(#fff, #2a0d12);
}

.btn-danger-soft {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.icon-btn.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Formulaires ---------- */
.form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

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

.field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.field > label,
.field-label {
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-weight: 600;
}

.field .hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--accent-line);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--raised);
  box-shadow: var(--ring);
}

.textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.textarea.mono {
  font-size: 0.85rem;
  word-break: break-all;
}

.input-wrap {
  position: relative;
}

.input-wrap > .icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input-wrap > .input {
  padding-left: 40px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}

.segmented button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed="true"] {
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--accent-line);
}

.segmented.full {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  width: 100%;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
}

.check input,
.cb {
  appearance: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  flex: none;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--raised);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.check input:checked,
.cb:checked,
.cb:indeterminate {
  border-color: transparent;
  background: var(--accent-grad);
}

.check input:checked::after,
.cb:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border: 2px solid var(--on-accent);
  border-top: 0;
  border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}

.cb:indeterminate::after {
  content: "";
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--on-accent);
}

.check strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.check div > span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 500;
}

.form-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--info-bg);
  color: var(--info);
  font-size: 0.86rem;
}

.form-note.accent {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* Renouvellement d'un abonnement : échéance actuelle → nouvelle échéance */
.renouv-dates {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
}

.renouv-dates > div {
  display: grid;
  gap: 2px;
}

.renouv-dates > div:last-child {
  text-align: right;
}

.renouv-dates > div:last-child strong {
  color: var(--accent);
}

/* Dépôt de l'APK de Zappia (Configuration) */
.depot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 18px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.depot:hover,
.depot:focus-visible,
.depot.survol {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.depot[hidden] {
  display: none;
}

.depot .depot-icone {
  width: 30px;
  height: 30px;
  color: var(--accent);
}

.depot-version {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Création de compte ---------- */
.create {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.preview {
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.preview-top {
  position: relative;
  padding: 24px 24px 22px;
  background:
    radial-gradient(70% 90% at 100% 0%, rgb(var(--glow) / 0.28), transparent 60%),
    linear-gradient(160deg, var(--hero-1), var(--hero-2));
  color: var(--side-ink);
}

.preview-top small {
  color: var(--hero-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.preview-top h3 {
  margin-top: 6px;
  font-size: 1.25rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.preview-top p {
  margin-top: 2px;
  color: var(--hero-muted);
  font-size: 0.86rem;
}

.kv {
  display: grid;
  gap: 2px;
  padding: 18px 24px 22px;
}

.kv div {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}

.kv div:last-child {
  border-bottom: 0;
}

.kv dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.kv dd {
  margin: 0;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Fiche rapide d'un compte. */
.fiche {
  padding: 8px 0 4px;
}

.fiche-valeur {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fiche-valeur > span {
  min-width: 0;
}

.fiche-lien {
  font-size: 0.8rem;
  font-weight: 500;
}

.fiche-nombre {
  display: block;
  margin-bottom: 4px;
}

.kv .fiche-appareils {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 0;
  border: 0;
}

.kv .fiche-appareils div {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
}

.fiche-appareils span {
  font-size: 0.82rem;
  font-weight: 500;
}

.icon-btn-sm {
  flex: none;
  width: 30px;
  height: 30px;
}

.kv dd.is-empty {
  color: var(--faint);
  font-weight: 450;
}

/* Aperçu : d'où vient le serveur de la fiche. */
.preview-note {
  margin: 0 24px 22px;
}

/* Autocomplétion */
.combo {
  position: relative;
}

.combo-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  box-shadow: var(--shadow-lg);
}

.combo-list button {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.combo-list button:hover,
.combo-list button[aria-selected="true"] {
  background: var(--accent-soft);
}

.combo-list small {
  color: var(--muted);
}

.combo-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.combo-list li {
  min-width: 0;
}

.combo-list strong,
.combo-list small {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Liste déroulante : flèche à droite du champ, tournée vers le bas (vers le haut quand la liste est ouverte). */
.combo-champ > .input {
  padding-right: 46px;
}

.combo-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 100%;
  border: 0;
  border-radius: 0 12px 12px 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.combo-toggle:hover {
  color: var(--accent);
}

.combo-toggle .icon {
  transform: rotate(90deg);
  transition: transform 0.2s var(--ease);
}

.combo.ouvert .combo-toggle .icon {
  transform: rotate(-90deg);
}

/* Écran tactile : des choix plus hauts, faciles à toucher. */
@media (pointer: coarse) {
  .combo-list button {
    min-height: 48px;
    justify-content: center;
    padding: 11px 14px;
  }
}

/* ---------- Tableau ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.toolbar .input-wrap {
  flex: 1 1 260px;
  min-width: 0;
}

.bulkbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--accent-line);
  background: var(--accent-soft);
  animation: fade 0.25s var(--ease) both;
}

.bulkbar strong {
  color: var(--accent-ink);
  font-weight: 600;
}

.bulkbar .spacer {
  flex: 1;
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  container-type: inline-size;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color 0.15s;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table tbody tr.selected {
  background: var(--accent-soft);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .col-check {
  width: 44px;
  padding-right: 0;
}

.table .col-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.cell-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cell-main strong {
  font-weight: 550;
}

.cell-main span {
  color: var(--muted);
  font-size: 0.84rem;
}

.cell-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.actions {
  display: inline-flex;
  gap: 2px;
}

/* Colonnes de largeur fixe : le tableau tient dans sa carte, les textes longs passent à la ligne au lieu de déborder. */
.table.fixe {
  table-layout: fixed;
}

.table.fixe td {
  overflow-wrap: anywhere;
}

.table.fixe .col-actions-6 {
  width: 252px;
}

.table .col-parrain {
  width: 160px;
}

.table .col-expiration {
  width: 190px;
}

.table .col-date {
  width: 172px;
  white-space: nowrap;
}

.table .col-action {
  width: 196px;
}

.table .col-origine {
  width: 220px;
}

.origine {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
}

.origine .mono {
  font-size: 0.8rem;
}

/* Ligne qui ouvre une fiche d'un clic. */
.ligne-ouvrable {
  cursor: pointer;
}

.ligne-ouvrable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Carte trop étroite pour le tableau : une fiche par ligne, libellé à gauche, rien de coupé. */
@container (max-width: 860px) {
  .table.responsive thead {
    display: none;
  }

  .table.responsive,
  .table.responsive tbody,
  .table.responsive tr,
  .table.responsive td {
    display: block;
    width: auto;
  }

  .table.responsive tr {
    position: relative;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--line);
  }

  .table.responsive tr:has(> td.col-check) {
    padding-left: 54px;
  }

  .table.responsive tbody tr:last-child {
    border-bottom: 0;
  }

  .table.responsive td {
    padding: 3px 0;
    border: 0;
  }

  .table.responsive td.col-check {
    position: absolute;
    left: 16px;
    top: 16px;
    width: auto;
  }

  .table.responsive td.col-actions {
    padding-top: 8px;
    text-align: left;
    white-space: normal;
  }

  .table.responsive td.col-actions .actions {
    display: flex;
    flex-wrap: wrap;
  }

  .table.responsive td[data-label] {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: baseline;
    gap: 10px;
  }

  .table.responsive td[data-label]::before {
    content: attr(data-label);
    color: var(--faint);
    font-size: 0.8rem;
  }
}

.table-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.badge-muted {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

/* ---------- Parrains ---------- */
.parrains {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.parrain {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}

.parrain:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.parrain.ready {
  border-color: var(--accent-line);
  background:
    radial-gradient(80% 60% at 100% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
}

.parrain-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.parrain-head .avatar {
  width: 42px;
  height: 42px;
  font-size: 0.95rem;
}

.parrain-head strong {
  display: block;
  font-size: 1.02rem;
  font-weight: 600;
}

.parrain-head div > span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.84rem;
}

.progress-label strong {
  font-weight: 600;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-grad);
  transition: width 0.8s var(--ease);
}

.parrain-stats {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 0.84rem;
}

.parrain-stats b {
  color: var(--ink);
  font-weight: 600;
}

.parrain-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.parrain-actions .btn {
  flex: 1 1 120px;
}

/* ---------- Journal ---------- */
.action-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.action-tag i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.action-tag.t-ok i {
  background: var(--ok);
}

.action-tag.t-danger i {
  background: var(--danger);
}

.action-tag.t-accent i {
  background: var(--accent);
}

.action-tag.t-info i {
  background: var(--info);
}

/* ---------- États vides et chargement ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
}

.empty .chip-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.empty h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.empty p {
  max-width: 380px;
  color: var(--muted);
  font-size: 0.9rem;
}

.skeleton {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--surface-2), var(--bg-soft), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Fenêtres ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog.modal.wide {
  width: min(760px, calc(100vw - 32px));
}

dialog.modal[open] {
  display: flex;
  flex-direction: column;
  animation: pop 0.28s var(--ease) both;
}

dialog.modal::backdrop {
  background: rgba(4, 12, 24, 0.55);
  backdrop-filter: blur(3px);
  animation: fadein 0.2s both;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@keyframes fadein {
  from {
    opacity: 0;
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 0;
}

.modal-head h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.modal-body {
  flex: 1;
  overflow: auto;
  padding: 20px 24px;
}

.modal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.chip:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.result-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.88rem;
}

.qr {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.qr img {
  width: 164px;
  height: 164px;
  padding: 8px;
  border-radius: 14px;
  background: #fff;
}

.secret {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 16px;
  border: 1px dashed var(--accent-line);
  border-radius: 14px;
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 0.95rem;
  text-align: center;
}

/* ---------- Notifications ---------- */
.toasts {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  animation: toast-in 0.35s var(--ease) both;
}

.toast.leaving {
  animation: toast-out 0.25s ease both;
}

.toast .icon {
  margin-top: 1px;
}

.toast.ok .icon {
  color: var(--ok);
}

.toast.error .icon {
  color: var(--danger);
}

.toast.info .icon {
  color: var(--accent);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* ---------- Mon compte ---------- */
.theme-pick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.theme-pick button {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.theme-pick button[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: var(--ring);
  color: var(--ink);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
}

.status-line strong {
  display: block;
  font-weight: 600;
}

.status-line div > span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-line > .truncate {
  flex: 1 1 160px;
}

/* Application Zappia : un fichier et ses appareils */
.zappia-fichier {
  display: grid;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.zappia-fichier .status-line {
  flex-wrap: wrap;
}

.zappia-appareil {
  margin-left: 18px;
  padding: 10px 14px;
  background: transparent;
}

.zappia-vide {
  margin: 0;
  padding: 6px 16px 10px 34px;
  font-size: 0.85rem;
}

.zappia-resultat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: 16px;
  border: 1px solid var(--accent);
  border-radius: 18px;
  background: var(--surface-2);
}

.zappia-resultat > .stack {
  flex: 1 1 240px;
  gap: 10px;
}

.zappia-resultat p {
  margin: 0;
}

.code-telechargement {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.zappia-qr {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  background: #fff;
  image-rendering: pixelated;
}

/* Lien d'installation : QR code à côté du lien et des boutons ; empilés sur téléphone. */
.installation {
  align-items: flex-start;
}

.installation-qr {
  flex: none;
  width: 168px;
  height: 168px;
  border-radius: 12px;
  background: #fff;
  image-rendering: pixelated;
}

.installation-infos {
  display: grid;
  flex: 1 1 280px;
  min-width: 0;
  gap: 10px;
}

.installation-lien {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  user-select: all;
}

.installation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.installation-firetv {
  line-height: 1.7;
}

.installation-firetv .code-telechargement {
  font-size: 1.15rem;
  white-space: nowrap;
}

.lien-rapide {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lien-rapide .input {
  flex: 1 1 220px;
  min-width: 0;
}

/* Fenêtre Zappia d'un compte : lien d'installation ou fichier seul, côte à côte sur grand écran. */
.zappia-choix {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 721px) {
  .zappia-choix {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.zappia-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.zappia-option:first-child {
  border-color: var(--accent-line);
  background:
    radial-gradient(90% 70% at 100% 0%, var(--accent-soft), transparent 70%),
    var(--surface-2);
}

.zappia-option > strong {
  font-weight: 600;
}

.zappia-option > p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.zappia-option-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
}

/* Validité d'un lien : libellé et liste sur une ligne. */
.zappia-validite {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.zappia-validite .select {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
}

/* Boutons d'une ligne (lien, fichier, appareil) : à droite du texte, sous lui s'il manque de place. */
.status-line:has(> .ligne-actions) {
  flex-wrap: wrap;
}

/* Le texte reste lisible en entier : moins de 240 px pour lui, et les boutons passent dessous. */
.status-line:has(> .ligne-actions) > .truncate {
  flex: 1 1 240px;
}

.status-line:has(> .ligne-actions) > .truncate,
.status-line:has(> .ligne-actions) > .truncate > * {
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ligne-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

@media (max-width: 560px) {
  .installation {
    justify-content: center;
    padding: 14px;
  }

  .installation-qr {
    width: min(220px, 70vw);
    height: auto;
    aspect-ratio: 1;
  }

  .installation-actions .btn,
  .lien-rapide .btn {
    flex: 1 1 100%;
  }

  /* Choix côte à côte (durée, parrainage) : un libellé long passe sur deux lignes au lieu de déborder. */
  .segmented.full button {
    padding: 6px 8px;
    line-height: 1.25;
    white-space: normal;
  }

  /* Lignes d'état (liens, fichiers, appareils) : le texte garde toute la largeur, l'état et les boutons passent dessous. */
  .status-line {
    flex-wrap: wrap;
  }

  .status-line > .truncate {
    flex: 1 1 calc(100% - 56px);
  }

  .status-line > .truncate,
  .status-line > .truncate > * {
    overflow: visible;
    white-space: normal;
  }

  /* Boutons sous le texte, sur toute la largeur restante, alignés à droite ; plus compacts mais assez hauts
     pour le doigt. */
  .status-line:has(> .ligne-actions) {
    gap: 10px;
    padding: 12px 14px;
  }

  .status-line:has(> .ligne-actions) > .truncate {
    flex-basis: calc(100% - 56px);
  }

  .ligne-actions {
    flex: 1 1 auto;
  }

  .zappia-fichier > .status-line {
    padding-inline: 12px;
  }

  .ligne-actions .btn {
    min-height: 38px;
    padding: 0 9px;
  }

  .ligne-actions .btn .icon {
    display: none;
  }

  .zappia-option-actions > .btn,
  .zappia-validite {
    flex: 1 1 100%;
  }

  .zappia-validite .select {
    flex: 1 1 auto;
  }

  .zappia-appareil {
    margin-left: 8px;
  }

  /* Fenêtres : plus de place pour le contenu sur téléphone. */
  .modal-head {
    padding: 18px 16px 0;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-foot {
    padding: 14px 16px 16px;
  }
}

.zappia-limite {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.select-sm {
  width: auto;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .create {
    grid-template-columns: minmax(0, 1fr);
  }

  .preview {
    position: static;
  }
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    z-index: 60;
    inset: 0 auto 0 0;
    width: min(290px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .shell.menu-open .sidebar {
    transform: none;
  }

  .scrim {
    position: fixed;
    z-index: 55;
    inset: 0;
    background: rgba(4, 12, 24, 0.5);
    animation: fadein 0.2s both;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 60px;
    padding: 0 12px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }

  .topbar img {
    width: 34px;
    height: 34px;
  }

  .topbar strong {
    font-size: 1rem;
    font-weight: 700;
  }

  .page {
    padding: 24px 20px 56px;
  }

  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .page {
    padding: 20px 16px 48px;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-actions,
  .page-actions .btn {
    width: 100%;
  }

  .stats {
    gap: 10px;
  }

  .stat {
    padding: 14px;
    gap: 10px;
  }

  .stat .chip-icon {
    width: 36px;
    height: 36px;
  }

  .stat strong {
    font-size: 1.3rem;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-pad {
    padding: 20px 18px;
  }

  .card-head {
    padding: 18px 18px 0;
  }

  .toolbar {
    padding: 14px;
  }

  .toolbar .segmented {
    width: 100%;
  }


  .qr {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .theme-pick {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-foot .btn {
    flex: 1;
  }

  .kv div {
    grid-template-columns: 100px minmax(0, 1fr);
  }
}

/* Téléphone : dans la fiche, le libellé passe au-dessus de la valeur. */
@media (max-width: 480px) {
  .kv.fiche > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.status-line > .btn {
  margin-left: auto;
}

.nowrap {
  white-space: nowrap;
}
