:root {
  color-scheme: light;
  --bg: #f6efe6;
  --bg-glow: #fde3c4;
  --surface-1: #fffdf9;
  --surface-2: #f3ece2;
  --border: #e6dccd;
  --text-primary: #1d1a16;
  --text-secondary: #5c554b;
  --text-muted: #8a8276;
  --accent: #d9622b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe2d3;
  --grid: #ebe3d6;
  --series-temp: #eb6834;
  --series-rain: #2a78d6;
  --good: #1d8a4e;  --good-soft: #dff3e6;
  --warn: #a86a00;  --warn-soft: #fbefd2;
  --bad: #c43c3b;   --bad-soft: #fbe1e0;
  --info: #2a6fc0;  --info-soft: #e1ecfa;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 24px rgba(60, 40, 20, .06);
  --radius: 18px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #16130f; --bg-glow: #3a2414;
    --surface-1: #1f1b16; --surface-2: #2a251e; --border: #3a332a;
    --text-primary: #f6f1ea; --text-secondary: #c9c0b3; --text-muted: #948a7d;
    --accent: #f0864f; --accent-ink: #1a0f08; --accent-soft: #4a2a19;
    --grid: #332d25;
    --series-temp: #d95926; --series-rain: #3987e5;
    --good: #5cc98b; --good-soft: #17352a; --warn: #e6b44c; --warn-soft: #3b2f15;
    --bad: #ef7c7b; --bad-soft: #3d1d1d; --info: #79aef0; --info-soft: #1a2c44;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16130f; --bg-glow: #3a2414;
  --surface-1: #1f1b16; --surface-2: #2a251e; --border: #3a332a;
  --text-primary: #f6f1ea; --text-secondary: #c9c0b3; --text-muted: #948a7d;
  --accent: #f0864f; --accent-ink: #1a0f08; --accent-soft: #4a2a19;
  --grid: #332d25;
  --series-temp: #d95926; --series-rain: #3987e5;
  --good: #5cc98b; --good-soft: #17352a; --warn: #e6b44c; --warn-soft: #3b2f15;
  --bad: #ef7c7b; --bad-soft: #3d1d1d; --info: #79aef0; --info-soft: #1a2c44;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.25);
}

/* ---------- palettes (choisies dans le panneau « Apparence ») : chacune en clair et en sombre */
:root[data-palette="ocean"] {
  --bg: #eef4f7; --bg-glow: #cfe6f0; --surface-1: #fbfdfe; --surface-2: #e6eff3; --border: #d3e0e7;
  --text-primary: #10202a; --text-secondary: #4a5e6a; --text-muted: #7a8c96;
  --accent: #0f7c9c; --accent-ink: #ffffff; --accent-soft: #d4ecf3; --grid: #dde8ee;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="ocean"]:not([data-theme="light"]) {
  --bg: #0b1419; --bg-glow: #0f3342; --surface-1: #111d24; --surface-2: #18272f; --border: #243741;
  --text-primary: #eaf4f8; --text-secondary: #b3c7d1; --text-muted: #7f97a3;
  --accent: #3cc0dc; --accent-ink: #04161c; --accent-soft: #113a46; --grid: #1d2d35;
  }
}
:root[data-palette="ocean"][data-theme="dark"] {
  --bg: #0b1419; --bg-glow: #0f3342; --surface-1: #111d24; --surface-2: #18272f; --border: #243741;
  --text-primary: #eaf4f8; --text-secondary: #b3c7d1; --text-muted: #7f97a3;
  --accent: #3cc0dc; --accent-ink: #04161c; --accent-soft: #113a46; --grid: #1d2d35;
}
:root[data-palette="foret"] {
  --bg: #f1f3ec; --bg-glow: #dbe8cf; --surface-1: #fcfdf9; --surface-2: #e9eee1; --border: #d6dfca;
  --text-primary: #18201a; --text-secondary: #4f5b4c; --text-muted: #7e8a79;
  --accent: #3f7d3a; --accent-ink: #ffffff; --accent-soft: #dcebd6; --grid: #e1e7d7;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="foret"]:not([data-theme="light"]) {
  --bg: #0f140f; --bg-glow: #1e3320; --surface-1: #161d16; --surface-2: #1f281f; --border: #2e3a2d;
  --text-primary: #eef3ea; --text-secondary: #bfcab9; --text-muted: #8a9784;
  --accent: #7cc46a; --accent-ink: #0b1609; --accent-soft: #24402a; --grid: #263024;
  }
}
:root[data-palette="foret"][data-theme="dark"] {
  --bg: #0f140f; --bg-glow: #1e3320; --surface-1: #161d16; --surface-2: #1f281f; --border: #2e3a2d;
  --text-primary: #eef3ea; --text-secondary: #bfcab9; --text-muted: #8a9784;
  --accent: #7cc46a; --accent-ink: #0b1609; --accent-soft: #24402a; --grid: #263024;
}
:root[data-palette="crepuscule"] {
  --bg: #f4f0f8; --bg-glow: #f6d6df; --surface-1: #fdfbff; --surface-2: #ece6f3; --border: #ddd3ea;
  --text-primary: #1d1830; --text-secondary: #57506b; --text-muted: #878099;
  --accent: #d0532a; --accent-ink: #ffffff; --accent-soft: #f8dccf; --grid: #e5def0;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="crepuscule"]:not([data-theme="light"]) {
  --bg: #13112a; --bg-glow: #3b2353; --surface-1: #1b1835; --surface-2: #252141; --border: #352f55;
  --text-primary: #f1eefb; --text-secondary: #c3bddb; --text-muted: #8f88ad;
  --accent: #ff8f5e; --accent-ink: #1a0c06; --accent-soft: #4a2a3a; --grid: #2a2548;
  }
}
:root[data-palette="crepuscule"][data-theme="dark"] {
  --bg: #13112a; --bg-glow: #3b2353; --surface-1: #1b1835; --surface-2: #252141; --border: #352f55;
  --text-primary: #f1eefb; --text-secondary: #c3bddb; --text-muted: #8f88ad;
  --accent: #ff8f5e; --accent-ink: #1a0c06; --accent-soft: #4a2a3a; --grid: #2a2548;
}
:root[data-palette="graphite"] {
  --bg: #f3f4f6; --bg-glow: #e3e7ee; --surface-1: #ffffff; --surface-2: #eceef2; --border: #dadde3;
  --text-primary: #16181d; --text-secondary: #4f5561; --text-muted: #80868f;
  --accent: #2f6fe4; --accent-ink: #ffffff; --accent-soft: #dde8fc; --grid: #e4e7ec;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="graphite"]:not([data-theme="light"]) {
  --bg: #0e0f12; --bg-glow: #1c2230; --surface-1: #16181c; --surface-2: #1f2228; --border: #2c3038;
  --text-primary: #eef0f4; --text-secondary: #b9bfca; --text-muted: #868c98;
  --accent: #6aa2ff; --accent-ink: #08101f; --accent-soft: #1b2a47; --grid: #24272e;
  }
}
:root[data-palette="graphite"][data-theme="dark"] {
  --bg: #0e0f12; --bg-glow: #1c2230; --surface-1: #16181c; --surface-2: #1f2228; --border: #2c3038;
  --text-primary: #eef0f4; --text-secondary: #b9bfca; --text-muted: #868c98;
  --accent: #6aa2ff; --accent-ink: #08101f; --accent-soft: #1b2a47; --grid: #24272e;
}
:root[data-palette="sakura"] {
  --bg: #fbf1f3; --bg-glow: #fbd9e2; --surface-1: #fffbfc; --surface-2: #f5e8ec; --border: #ecd6dd;
  --text-primary: #24161b; --text-secondary: #63505a; --text-muted: #94808a;
  --accent: #c2416b; --accent-ink: #ffffff; --accent-soft: #f8dbe4; --grid: #efdfe4;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="sakura"]:not([data-theme="light"]) {
  --bg: #170f13; --bg-glow: #3a1826; --surface-1: #1f161a; --surface-2: #2a1e24; --border: #3d2b33;
  --text-primary: #f8eef2; --text-secondary: #d2bcc6; --text-muted: #9c8790;
  --accent: #f27aa0; --accent-ink: #200a12; --accent-soft: #4a1f30; --grid: #30232a;
  }
}
:root[data-palette="sakura"][data-theme="dark"] {
  --bg: #170f13; --bg-glow: #3a1826; --surface-1: #1f161a; --surface-2: #2a1e24; --border: #3d2b33;
  --text-primary: #f8eef2; --text-secondary: #d2bcc6; --text-muted: #9c8790;
  --accent: #f27aa0; --accent-ink: #200a12; --accent-soft: #4a1f30; --grid: #30232a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 15px/1.5 var(--font-body);
  color: var(--text-primary);
  background: radial-gradient(1200px 500px at 50% -180px, var(--bg-glow), transparent 70%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 1.15rem; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 650; font-size: 1.1rem; text-decoration: none; color: var(--text-primary); }
.brand img { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav a, .icon-btn {
  padding: 7px 12px; border-radius: 999px; text-decoration: none; color: var(--text-secondary);
  white-space: nowrap; font-weight: 500; font-size: .92rem; border: 0; background: none; cursor: pointer;
}
.nav a:hover, .icon-btn:hover, .nav-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-actions { display: flex; gap: 4px; }
.nav-btn { padding: 7px 12px; border-radius: 999px; color: var(--text-secondary); white-space: nowrap; font-weight: 500; font-size: .92rem;
  border: 1px solid var(--border); background: none; cursor: pointer; }
.nav-btn:disabled { opacity: .6; cursor: wait; }
.nav a.active { background: var(--text-primary); color: var(--bg); }
@media (max-width: 640px) {
  .nav { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; justify-content: space-around;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--surface-1); border-top: 1px solid var(--border); z-index: 20; }
  .wrap { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .topbar .theme-btn { margin-left: auto; }
  /* le flou d'arrière-plan piégerait la barre de navigation (position fixe) dans l'en-tête : on le retire sur téléphone */
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  /* sur téléphone, la navigation passe en bas : les actions restent en haut, en icônes */
  .nav-actions { position: fixed; z-index: 21; top: calc(10px + env(safe-area-inset-top)); right: 112px; }
  .nav-btn { padding: 6px 10px; }
  .nav a { padding: 7px 8px; font-size: .84rem; }
  .nav-btn .lbl { display: none; }
}

.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
@media (max-width: 960px) { .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; } }

.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .kicker { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; }

/* ---------- hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 28px 0 20px; }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); line-height: 1.1; }
.hero .date::first-letter { text-transform: uppercase; }
.hero .date { color: var(--text-secondary); margin: 6px 0 12px; }
.hero .headline { font-size: 1.05rem; color: var(--text-secondary); max-width: 62ch; margin: 0; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 640px) { .hero { grid-template-columns: 1fr; } .score { justify-self: start; } }

.score { display: grid; place-items: center; position: relative; width: 132px; height: 132px; }
.score svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score .val { font-family: var(--font-display); font-size: 2.3rem; font-weight: 650; line-height: 1; }
.score .val small { font-size: .9rem; color: var(--text-muted); }
.score .lbl { font-size: .72rem; color: var(--text-secondary); text-align: center; max-width: 92px; margin-top: 2px; }

/* ---------- KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { font-size: .78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-family: var(--font-display); font-size: 1.75rem; font-weight: 650; line-height: 1.15; margin-top: 4px; }
.kpi .v .unit { font-size: .95rem; color: var(--text-secondary); font-family: var(--font-body); font-weight: 500; }
.kpi .s { font-size: .85rem; color: var(--text-secondary); margin-top: 2px; }

/* ---------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-1); cursor: pointer; font-weight: 500;
  text-decoration: none; color: var(--text-primary); transition: transform .08s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 11px; font-size: .85rem; }
.btn[disabled] { opacity: .55; pointer-events: none; }

label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { font-size: .82rem; color: var(--text-muted); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=time], input[type=url], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.chip-toggle span {
  display: inline-block; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-size: .9rem; user-select: none;
}
.chip-toggle input:checked + span { background: var(--text-primary); color: var(--bg); border-color: var(--text-primary); }
.chip-toggle input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; border: 1px solid var(--border); flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--text-secondary); font-size: .88rem; }
.seg button.on { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); font-weight: 600; }

/* ---------- auth */
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth .logo { text-align: center; margin-bottom: 20px; }
.auth .logo img { width: 64px; height: 64px; }
.auth h1 { text-align: center; font-size: 2rem; }
.auth p.lead { text-align: center; color: var(--text-secondary); margin: 6px 0 24px; }
.error { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 12px; margin-bottom: 14px; font-size: .9rem; }

/* ---------- brief content */
.brief-text { font-size: 1.04rem; line-height: 1.65; margin: 0 0 14px; }
ul.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
ul.points li { padding-left: 22px; position: relative; }
ul.points li::before { content: ''; position: absolute; left: 4px; top: .62em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.night-card { background: linear-gradient(160deg, #1d2340, #2b2350); color: #eef0ff; border-color: transparent; }
.night-card .kicker, .night-card .muted { color: #a9b0d8; }
.night-card ul.points li::before { background: #ffd56b; }
.night-card a { color: #cfd6ff; }
.curiosity { background: var(--accent-soft); border-color: transparent; }

.advice { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.advice span { background: var(--surface-2); padding: 6px 12px; border-radius: 999px; font-size: .88rem; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }

.commute-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.commute-big .num { font-family: var(--font-display); font-size: 3.2rem; font-weight: 650; line-height: 1; }
.leave { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.leave strong { font-family: var(--font-display); font-size: 1.6rem; }
.bar-compare { margin-top: 14px; display: grid; gap: 8px; }
.bar-compare .r { display: grid; grid-template-columns: 90px 1fr 54px; gap: 8px; align-items: center; font-size: .85rem; color: var(--text-secondary); }
.bar-compare .track { height: 10px; border-radius: 6px; background: var(--grid); overflow: hidden; }
.bar-compare .fill { height: 100%; border-radius: 6px; }

/* ---------- news */
.news-list { display: grid; gap: 2px; }
.news-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 8px; border-radius: 12px; text-decoration: none; color: inherit; }
.news-item:hover { background: var(--surface-2); }
.news-item .t { font-weight: 600; line-height: 1.35; }
.news-item .m { font-size: .82rem; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.news-item img { width: 76px; height: 56px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.tag { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-size: .75rem; color: var(--text-secondary); }
.tag.hot { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.night { background: #2b2350; color: #dfe2ff; }
.tabs { display: flex; flex-wrap: nowrap !important; max-width: 100%; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; padding-bottom: 2px; }

/* ---------- weather chart */
.chart { position: relative; margin-top: 10px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--text-muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .title { font-size: .8rem; color: var(--text-secondary); font-weight: 600; margin: 4px 0; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--text-primary); color: var(--bg);
  padding: 7px 10px; border-radius: 10px; font-size: .82rem; white-space: nowrap; transform: translate(-50%, -110%);
  opacity: 0; transition: opacity .1s; z-index: 2;
}
.tooltip.show { opacity: 1; }
.wx-now { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.wx-now .icon { font-size: 3rem; line-height: 1; }
.wx-now .t { font-family: var(--font-display); font-size: 2.6rem; font-weight: 650; line-height: 1; }
.wx-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.wx-facts div { background: var(--surface-2); border-radius: 12px; padding: 9px 12px; font-size: .85rem; color: var(--text-secondary); }
.wx-facts b { display: block; color: var(--text-primary); font-size: 1rem; }

/* ---------- tables & misc */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: 8px; border-bottom: 1px solid var(--border); }
td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-scroll { overflow-x: auto; }
.setup { border: 1.5px dashed var(--accent); background: var(--accent-soft); }
.qr { background: #fff; padding: 10px; border-radius: 12px; display: inline-block; line-height: 0; }
.qr svg { width: 150px; height: 150px; }
code, .mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .88em; word-break: break-all; }
.steps { padding-left: 20px; margin: 8px 0; } .steps li { margin-bottom: 6px; }
.history-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.history-item pre { white-space: pre-wrap; font: inherit; color: var(--text-secondary); margin: 8px 0 0; font-size: .9rem; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text-primary); color: var(--bg); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: .25s; z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
@media (max-width: 640px) { #toast { bottom: calc(90px + env(safe-area-inset-bottom)); } }
.footer { text-align: center; color: var(--text-muted); font-size: .8rem; margin-top: 28px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- lecteur audio du brief */
.player { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--shadow); display: grid; gap: 8px; max-width: 520px; }
.player audio { width: 100%; height: 40px; }
.player .speeds { justify-self: start; }

/* ---------- bascule matin / soir */
.kind-switch { margin-bottom: 14px; }

/* les petits plus : agenda, rappels, football, cryptos */
h3.sub { font-size: .9rem; margin: 18px 0 8px; color: var(--text-secondary); }
ul.agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
ul.agenda li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: baseline; }
ul.agenda .when { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-secondary); font-size: .9rem; }
.match { display: flex; gap: 14px; align-items: center; }
.match img { width: 48px; height: 48px; object-fit: contain; flex: none; }
.match-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 650; margin: 2px 0; }
.coins { display: grid; gap: 12px; }
.coin { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 12px; align-items: center; }
.coin-name { display: flex; gap: 10px; align-items: center; min-width: 0; }
.coin-name img { width: 26px; height: 26px; flex: none; }
.coin-price { display: grid; justify-items: end; gap: 4px; font-variant-numeric: tabular-nums; }
.spark { height: 36px; touch-action: none; cursor: crosshair; }
@media (max-width: 420px) { .coin { grid-template-columns: minmax(0, 1fr) auto; } .spark { grid-column: 1 / -1; grid-row: 2; } }
.rem { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rem input[data-k=label] { flex: 1 1 100%; }
.rem select { flex: 1 1 120px; width: auto; min-width: 0; }
.rem [data-del] { flex: none; }
.rem-ref { flex: 1 1 100%; display: flex; gap: 8px; align-items: center; }
.rem-ref input { width: auto; }
.rem:last-child { margin-bottom: 10px; }

/* organisation du dashboard */
.layout-bar { position: sticky; top: 8px; z-index: 20; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding: 12px 16px; border-radius: 16px; background: var(--surface-1); border: 1.5px solid var(--accent); box-shadow: var(--shadow); }
.layout-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card.editing { outline: 1.5px dashed var(--border); outline-offset: -1px; cursor: grab; position: relative; }
.card.editing > :not(.mod-bar) { pointer-events: none; user-select: none; }
.card.editing.is-hidden > :not(.mod-bar) { opacity: .3; }
.card.editing.is-hidden { outline-color: var(--text-muted); }
.card.dragging { opacity: .45; }
.card.drop-before { box-shadow: inset 0 4px 0 var(--accent); }
.card.drop-after { box-shadow: inset 0 -4px 0 var(--accent); }
.card.span-6.drop-before { box-shadow: inset 4px 0 0 var(--accent); }
.card.span-6.drop-after { box-shadow: inset -4px 0 0 var(--accent); }
.mod-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.mod-bar .grip { color: var(--text-muted); font-size: 1.1rem; }
.mod-tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.air-row { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.air-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.air-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.air-line b { font-family: var(--font-display); font-size: 1.4rem; }
.cur-switch button { min-width: 34px; }

/* tuiles cliquables et bulle de détail */
.kpi[data-open] { cursor: pointer; position: relative; transition: border-color .15s, transform .15s; }
.kpi[data-open]::after { content: '›'; position: absolute; top: 10px; right: 12px; color: var(--text-muted); font-size: 1.1rem; transform: rotate(90deg); transition: transform .15s; }
.kpi[data-open]:hover, .kpi[data-open][aria-expanded="true"] { border-color: var(--accent); }
.kpi[data-open][aria-expanded="true"]::after { transform: rotate(-90deg); color: var(--accent); }
.kpi[data-open]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.pop { position: absolute; z-index: 50; max-height: min(75vh, 760px); overflow: auto; border-radius: 18px; border: 1.5px solid var(--accent);
  background: var(--surface-1); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); animation: pop-in .14s ease-out; }
.pop::before { content: ''; position: absolute; top: -8px; left: calc(var(--arrow, 40px) - 8px); width: 14px; height: 14px; background: var(--surface-1);
  border-left: 1.5px solid var(--accent); border-top: 1.5px solid var(--accent); transform: rotate(45deg); }
.pop .card { margin: 0; border: 0; box-shadow: none; background: transparent; }
.pop .card .card-head { padding-right: 36px; }
.pop-close { position: sticky; float: right; top: 10px; margin: 10px 10px -40px 0; z-index: 2; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); cursor: pointer; }
.pop.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 82vh; border-radius: 20px 20px 0 0; border-bottom: 0; animation: sheet-in .2s ease-out; }
.pop.sheet::before { display: none; }
.pop-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(0, 0, 0, .45); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes sheet-in { from { transform: translateY(40%); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .pop, .pop.sheet { animation: none; } }
.kpi[data-open] .k { padding-right: 18px; }

/* bandeau « en ce moment » : rotation des 3 titres */
.ticker { display: flex; align-items: stretch; margin: -4px 0 16px; border-radius: 14px; overflow: hidden; min-height: 46px;
  background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--shadow); }
.tick-label { flex: none; display: flex; align-items: center; gap: 8px; padding: 0 14px; font-size: .74rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; background: var(--surface-2); color: var(--text-primary); border-right: 1px solid var(--border); white-space: nowrap; }
.tick-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tick-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: tick-pulse 1.8s ease-out infinite; }
.tick-label.live { color: var(--bad); }
.tick-label.live .tick-dot { background: var(--bad); }
@keyframes tick-pulse { from { transform: scale(1); opacity: .7; } to { transform: scale(2.8); opacity: 0; } }
.tick-stage { flex: 1; position: relative; overflow: hidden; min-width: 0; }
.tick-item { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 0 16px; text-decoration: none; color: var(--text-primary);
  opacity: 0; transform: translateY(70%); transition: opacity .45s ease, transform .55s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.tick-item.on { opacity: 1; transform: none; pointer-events: auto; }
.tick-item.out { opacity: 0; transform: translateY(-70%); }
.tick-item:hover .tick-title { text-decoration: underline; }
.tick-time { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.tick-title { flex: 1; min-width: 0; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tick-src { flex: none; font-size: .78rem; color: var(--text-muted); }
.tick-urgent { flex: none; font-size: .68rem; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: var(--bad); color: var(--bg); letter-spacing: .05em; }
.tick-steps { flex: none; display: flex; align-items: center; gap: 5px; padding: 0 14px; }
.tick-steps button { width: 26px; height: 18px; padding: 0; border: 0; background: none; cursor: pointer; display: flex; align-items: center; }
.tick-steps i { display: block; width: 100%; height: 4px; border-radius: 4px; background: var(--grid);
  background-image: linear-gradient(var(--accent), var(--accent)); background-repeat: no-repeat; background-size: 0% 100%; }
.tick-steps .done i { background-size: 100% 100%; }
.tick-steps .run i { animation: tick-fill 6s linear forwards; }
.ticker:hover .tick-steps .run i, .ticker:focus-within .tick-steps .run i { animation-play-state: paused; }
@keyframes tick-fill { to { background-size: 100% 100%; } }
/* mouvement réduit : simple fondu, pas de glissement (la rotation continue) */
@media (prefers-reduced-motion: reduce) {
  .tick-item, .tick-item.out { transform: none !important; transition: opacity .5s ease !important; } /* un fondu doux reste permis */
  .tick-steps .run i { background-size: 100% 100%; opacity: .55; }
}
@media (max-width: 640px) {
  .ticker { flex-wrap: wrap; min-height: 0; }
  .tick-label { padding: 8px 12px; border-right: 0; }
  .ticker { background: var(--surface-1); }
  .tick-label { flex: 1; }
  .tick-steps { order: 1; background: var(--surface-2); }
  .tick-stage { order: 2; flex-basis: 100%; height: 64px; border-top: 1px solid var(--border); }
  .tick-item { flex-wrap: wrap; align-content: center; gap: 2px 8px; padding: 0 14px; }
  .tick-title { flex-basis: 100%; order: 3; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
}

/* vigilance Météo-France : même bandeau que « En ce moment », couleur selon le niveau le plus élevé */
.vigil-strip.lvl-2 { --vig: #e0b400; }
.vigil-strip.lvl-3 { --vig: #ee7f22; }
.vigil-strip.lvl-4 { --vig: var(--bad); }
.vigil-strip { border-color: color-mix(in srgb, var(--vig) 70%, var(--border)); }
.vigil-strip .tick-label { color: var(--vig); }
.vigil-strip .tick-dot { background: var(--vig); }
.vigil-strip .tick-steps i { background-image: linear-gradient(var(--vig), var(--vig)); }
button.tick-item { font: inherit; text-align: left; border: 0; background: none; width: 100%; cursor: pointer; }
.vigil-badge { flex: none; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 6px; color: #1a1205; }
.vigil-badge.lvl-2 { background: #f5d33a; }
.vigil-badge.lvl-3 { background: #f39a3d; }
.vigil-badge.lvl-4 { background: #e5484d; color: #fff; }
.vigil-detail { padding: 12px 0; border-top: 1px solid var(--border); }
.vigil-detail:first-of-type { border-top: 0; padding-top: 0; }
.vigil-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vigil-detail p { margin: 8px 0 0; font-size: .92rem; color: var(--text-secondary); }

/* bandeaux placés dans la grille comme des modules */
.card.strip-mod { padding: 0; border: 0; background: none; box-shadow: none; align-self: start; }
.card.strip-mod .ticker { margin: 0; }
.card.strip-mod.editing { padding: 12px; border: 1px solid var(--border); background: var(--surface-1); }
.strip-empty { margin: 0; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 14px; }

/* raccourcis vers vos services */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.link-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 12px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-primary); text-decoration: none; font: inherit; cursor: pointer;
  transition: transform .12s, border-color .12s; min-width: 0; }
a.link-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.link-ico { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; flex: none; }
.link-letter { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 1.3rem; }
.link-emoji { display: grid; place-items: center; font-size: 2rem; }
.link-name { font-size: .85rem; font-weight: 550; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); box-shadow: 0 0 0 2px var(--surface-2); }
.link-dot.up { background: var(--good); }
.link-dot.down { background: var(--bad); }
.link-tile.editing { cursor: default; border-style: dashed; }
.link-tools { display: flex; gap: 2px; }
.link-tools button { border: 0; background: var(--surface-1); color: var(--text-secondary); border-radius: 6px; width: 24px; height: 24px; cursor: pointer; font-size: .8rem; }
.link-tools button:hover:not(:disabled) { color: var(--accent); }
.link-tools button:disabled { opacity: .3; cursor: default; }
.link-add { border-style: dashed; background: none; color: var(--text-secondary); }
/* colonnes fixées sur les côtés gauche et droit, de l'en-tête au bas de l'écran (grand écran) */
.wrap { --gutter: max(16px, calc((100vw - 1180px) / 2)); }
.wrap.wide-l, .wrap.wide-r { max-width: none; margin: 0; padding-left: var(--gutter); padding-right: var(--gutter); }
.wrap.wide-l { --side-l: max(210px, calc((100vw - 1180px) / 2 - 8px)); padding-left: calc(var(--side-l) + 16px); }
.wrap.wide-r { --side-r: max(300px, calc((100vw - 1180px) / 2 - 8px)); padding-right: calc(var(--side-r) + 16px); }
.wrap.wide-l.wide-l-xl { --side-l: max(340px, calc((100vw - 1180px) / 2 - 8px)); }
.wrap.wide-r.wide-r-xl { --side-r: max(340px, calc((100vw - 1180px) / 2 - 8px)); }
.wrap.wide-l.side-edit-l { --side-l: max(360px, calc((100vw - 1180px) / 2 - 8px)); }
.wrap.wide-r.side-edit-r { --side-r: max(360px, calc((100vw - 1180px) / 2 - 8px)); }
.side-col:empty { display: none; }
.side-col { position: fixed; z-index: 5; left: 0; top: var(--top-h, 59px); bottom: 0; width: var(--side-l); overflow-y: auto; scrollbar-width: none; }
.side-col.right { left: auto; right: 0; width: var(--side-r); }
.side-col::-webkit-scrollbar { display: none; }
.side-col > .card { margin: 28px 0 18px 16px; }
.side-col.right > .card { margin: 28px 16px 18px 0; }
.side-col > .card + .card { margin-top: 0; }
/* seulement les tuiles, dans le style des indicateurs du haut ; le cadre n'apparaît qu'en édition */
.links-card:not(.editing):not(.lk-editing) { padding: 0; border-color: transparent; background: none; box-shadow: none; }
.side-col .links-card { padding: 0; border: 1px solid transparent; background: none; box-shadow: none; }
.side-col .links-card.lk-editing, .side-col.organizing .links-card { padding: 14px; border-color: var(--border); background: var(--surface-1); }
.links-card:not(.editing):not(.lk-editing) .card-head { display: none; }
.side-col.organizing .links-card .card-head { display: flex; }
.side-col .card-head { flex-wrap: wrap; gap: 8px; }
.side-col .card-head .kicker, .side-col .card-head .btn { white-space: nowrap; }
.side-col .links-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.links-card .link-tile { background: var(--surface-1); border-radius: 16px; box-shadow: var(--shadow); padding: 16px 8px 14px; }
.side-col .link-form .row { grid-template-columns: 1fr; }
.link-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.link-icon-pick { display: flex; gap: 10px; align-items: center; }
.link-preview { flex: none; }
.link-icons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 132px; overflow: auto; }
.link-icons button { width: 44px; height: 44px; padding: 5px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.link-icons button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.link-icons img { width: 100%; height: 100%; object-fit: contain; }

/* webradio */
.radio-card { display: flex; flex-direction: column; gap: 12px; }
#radioBody { display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 1; }
.side-col.right .radio-card { height: calc(100% - 46px); padding: 16px; }
.radio-now { display: grid; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.radio-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.radio-art { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: #fff; flex: none; }
.radio-art-ph { display: grid; place-items: center; font-size: 1.8rem; background: var(--accent-soft); }
.radio-meta { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.radio-name { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radio-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radio-state { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.radio-now.is-playing .radio-state { color: var(--bad); }
.radio-now.is-error .radio-state { color: var(--warn, #e0a030); }
.radio-eq { display: none; gap: 2px; align-items: flex-end; height: 10px; }
.radio-now.is-playing .radio-eq, .radio-now.is-loading .radio-eq { display: inline-flex; }
.radio-eq i { width: 3px; height: 100%; background: currentColor; border-radius: 1px; animation: radio-eq .9s ease-in-out infinite; }
.radio-eq i:nth-child(2) { animation-delay: -.3s; } .radio-eq i:nth-child(3) { animation-delay: -.6s; }
.radio-now.is-loading .radio-eq i { animation-duration: 1.6s; opacity: .6; }
@keyframes radio-eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.radio-eq i { transform-origin: bottom; }
.radio-ctrl { display: flex; align-items: center; gap: 8px; }
.radio-play { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 1rem; cursor: pointer; flex: none; box-shadow: var(--shadow); }
.radio-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary); cursor: pointer; flex: none; font-size: 1rem; }
.radio-btn.on { color: #f5b301; }
.radio-play:disabled, .radio-btn:disabled { opacity: .4; cursor: default; }
.radio-vol { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 60px; }
.radio-vol input { width: 100%; accent-color: var(--accent); }
.radio-tabs { display: flex; width: 100%; }
.radio-tabs button { flex: 1; padding: 6px 4px; }
.radio-search { display: grid; gap: 8px; }
.radio-search input { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.radio-genres { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-genres button { border: 1px solid var(--border); background: none; color: var(--text-secondary); border-radius: 999px; padding: 3px 10px; font-size: .8rem; cursor: pointer; }
.radio-genres button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.radio-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; scrollbar-width: none; max-height: 420px; }
.radio-list::-webkit-scrollbar { display: none; }
.side-col.right .radio-list { max-height: none; flex: 1; min-height: 0; }
.radio-row { display: flex; align-items: center; gap: 4px; border-radius: 12px; }
.radio-row:hover, .radio-row.on { background: var(--surface-2); }
.radio-row.on .radio-txt b { color: var(--accent); }
.radio-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.radio-ico { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff; flex: none; }
.radio-ico.radio-art-ph { font-size: 1.1rem; }
.radio-txt { display: flex; flex-direction: column; min-width: 0; }
.radio-txt b, .radio-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.radio-txt span { font-size: .76rem; }
.radio-star { border: 0; background: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 6px 8px; }
.radio-star.on { color: #f5b301; }
.radio-empty { margin: 8px 4px; }

/* Proxmox */
.pve-host { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.pve-row-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.pve-sub { margin: 18px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.pve-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 16px; }
.pve-m { display: grid; gap: 4px; min-width: 0; }
.pve-m-h { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
.pve-m-h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pve-m-h b { white-space: nowrap; flex: none; }
.pve-m-s { font-size: .76rem; }
.pve-bar { display: block; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text-muted) 22%, transparent); overflow: hidden; }
.pve-bar i { display: block; height: 100%; border-radius: inherit; background: var(--good); transition: width .4s; }
.pve-bar.warn i { background: #e0a030; }
.pve-bar.crit i { background: var(--bad); }
.pve-bar.off { opacity: .4; }
.pve-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--text-muted); }
.pve-dot.up { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.pve-dot.down { background: var(--bad); }
.pve-list { display: grid; gap: 2px; }
.pve-row { display: grid; grid-template-columns: 12px minmax(150px, 1.5fr) repeat(3, minmax(96px, 1fr)) minmax(92px, .8fr) 72px; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 12px; font-size: .86rem; }
.pve-head { padding-top: 0; padding-bottom: 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.pve-click { cursor: pointer; }
.pve-row.pve-click:hover, .pve-row[aria-expanded="true"] { background: var(--surface-2); }
.pve-row.off { opacity: .6; }
.pve-name { display: flex; flex-direction: column; min-width: 0; }
.pve-name b, .pve-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pve-type { font-size: .68rem; font-weight: 700; padding: 0 5px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); }
.pve-type.qemu { background: color-mix(in srgb, #4c8dff 18%, transparent); color: #4c8dff; }
.pve-cell { display: grid; gap: 3px; min-width: 0; white-space: nowrap; }
.pve-cell > span { overflow: hidden; text-overflow: ellipsis; }
.pve-net { font-size: .8rem; gap: 0; }
.pve-detail { padding: 6px 10px 14px; }
.pve-host .pve-detail { padding: 12px 0 0; }
.pve-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; }
.c-cpu { color: var(--accent); } .c-mem { color: #4c8dff; }
.pve-chartbox { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.pve-y { display: flex; flex-direction: column; justify-content: space-between; font-size: .68rem; text-align: right; }
.pve-x { display: flex; justify-content: space-between; font-size: .68rem; margin: 2px 0 0 42px; }
.pve-chart { width: 100%; height: 110px; display: block; }
.pve-chart .l-cpu { stroke: var(--accent); } .pve-chart .l-mem { stroke: #4c8dff; }
.pve-chart .gridline { stroke: var(--border); stroke-width: 1; }
.pop .pve-row { grid-template-columns: 12px minmax(0, 1fr) 90px 90px; }
.pop .pve-row > :nth-child(5), .pop .pve-row > :nth-child(6), .pop .pve-row > :nth-child(7) { display: none; }
@media (max-width: 900px) {
  .pve-head { display: none; }
  .pve-row { grid-template-columns: 12px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); row-gap: 6px; }
  .pve-name { grid-column: 2 / -1; }
  .pve-cell[data-l="CPU"] { grid-column: 2; }
  .pve-cell::before { content: attr(data-l); font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
  .pve-row .pve-cell[data-l="Réseau"], .pve-row .pve-cell[data-l="Uptime"] { display: none; }
}

/* Proxmox en colonne latérale : version compacte (une machine = nom + CPU / mémoire / disque) */
.side-col .pve-card { padding: 16px 14px; }
.side-col .pve-card .card-head { flex-wrap: wrap; gap: 4px 10px; }
.side-col .pve-host { padding: 10px 12px; }
.side-col .pve-metrics { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.side-col .pve-host .pve-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.side-col .pve-head { display: none; }
.side-col .pve-row { grid-template-columns: 10px repeat(3, minmax(0, 1fr)); gap: 5px 10px; padding: 8px 6px; font-size: .8rem; }
.side-col .pve-name { grid-column: 2 / -1; }
.side-col .pve-cell[data-l="CPU"] { grid-column: 2; }
.side-col .pve-cell::before { content: attr(data-l); font-size: .64rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.side-col .pve-cell[data-l="Réseau"], .side-col .pve-cell[data-l="Uptime"] { display: none; }
.side-col .pve-cell > span > .muted { display: none; }
.side-col .pve-detail { padding: 4px 6px 12px; }
.side-col .pve-legend { font-size: .72rem; }

/* homelab : listes, chiffres, badges */
.hl-summary { margin-bottom: 8px; }
.hl-note { font-size: .85rem; color: var(--text-secondary); margin-bottom: 6px; }
.hl-alert { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-weight: 600; font-size: .88rem; }
.hl-list { display: grid; gap: 2px; margin-top: 8px; }
.hl-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 10px; font-size: .88rem; }
.hl-row:hover { background: var(--surface-2); }
.hl-row.off { opacity: .6; }
.hl-main { display: flex; flex-direction: column; min-width: 0; }
.hl-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-side { text-align: right; white-space: nowrap; }
.hl-err { color: var(--bad); }
.pve-dot.warn { background: #e0a030; }
.hl-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.hl-badge.warn { background: color-mix(in srgb, #e0a030 20%, transparent); color: #c98a1a; }
.hl-badge.down { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.hl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.hl-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.hl-stats b { font-family: var(--font-display); font-size: 1.25rem; }
.hl-bars { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.hl-bars > span { flex: 1; min-height: 2px; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 2px 2px 0 0; display: flex; flex-direction: column-reverse; overflow: hidden; }
.hl-bars i { display: block; background: var(--bad); }
.hl-axis { display: flex; justify-content: space-between; font-size: .68rem; margin: 2px 0 10px; }
.hl-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 20px; }
.hl-kv { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; padding: 4px 0; border-bottom: 1px solid var(--border); }
.hl-kv span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 28px; }
/* Jellyfin */
.jf-now { display: flex; gap: 12px; padding: 10px; border-radius: 14px; background: var(--surface-2); margin-bottom: 10px; }
.jf-now img { width: 64px; height: 96px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-1); }
.jf-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.jf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.jf-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: .82rem; }
.jf-item img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--surface-2); box-shadow: var(--shadow); }
.jf-item b, .jf-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Immich */
.im-main { position: relative; display: block; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.im-main img { width: 100%; max-height: 380px; object-fit: cover; display: block; }
.im-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 10px; color: #fff; font-size: .88rem; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.im-thumbs { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.im-thumbs button { flex: none; width: 58px; height: 58px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.im-thumbs button.on { border-color: var(--accent); }
.im-thumbs img { width: 100%; height: 100%; object-fit: cover; }
/* Frigate */
.fr-cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.fr-cams figure { margin: 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.fr-cams img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #000; }
.fr-cams figcaption { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: .82rem; font-weight: 600; text-transform: capitalize; }
.fr-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.fr-ev { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 12px; background: var(--surface-2); font-size: .85rem; min-width: 0; }
.fr-ev img, .fr-ph { width: 72px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; background: #000; display: grid; place-items: center; }
.fr-ev > span { display: flex; flex-direction: column; min-width: 0; }
/* Marées */
.td-now { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); margin-bottom: 12px; }
.td-gauge { width: 14px; height: 64px; border-radius: 999px; background: color-mix(in srgb, #4c8dff 15%, transparent); display: flex; align-items: flex-end; overflow: hidden; flex: none; }
.td-gauge i { width: 100%; background: linear-gradient(#7fb0ff, #3f7be0); border-radius: inherit; }
.td-big { font-size: 1.1rem; margin: 2px 0; }
.td-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 20px; }
.td-days .sub { margin-top: 4px; text-transform: capitalize; }
.td-coefs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; height: 92px; align-items: end; }
.td-coefs > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; height: 100%; font-size: .75rem; }
.td-coefs span { width: 70%; max-width: 26px; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, #4c8dff 45%, transparent); }
.td-coefs .big span { background: #3f7be0; }
.td-coefs small { color: var(--text-muted); text-transform: capitalize; }

/* panneau « Apparence » (bouton ◐) */
.theme-panel { position: fixed; z-index: 60; top: calc(var(--top-h, 59px) + 6px); right: 12px; width: min(340px, calc(100vw - 24px)); padding: 16px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.theme-panel h3 { margin: 0 0 10px; font-size: 1rem; }
.theme-panel .seg { display: flex; width: 100%; margin-bottom: 14px; }
.theme-panel .seg button { flex: 1; }
.pal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pal { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 14px; border: 2px solid var(--border);
  background: var(--surface-2); cursor: pointer; font: inherit; font-size: .8rem; font-weight: 600; color: var(--text-primary); }
.pal.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pal-sw { display: flex; width: 100%; height: 34px; border-radius: 9px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .08); }
.pal-sw i { flex: 1; }
.pal-sw i:last-child { flex: .55; }

/* notifications : bulles en haut à droite, et cloche */
.bell-btn { position: relative; }
.bell-n { position: absolute; top: 1px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff;
  font-size: .66rem; font-weight: 800; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
#notifs { position: fixed; z-index: 70; top: calc(var(--top-h, 59px) + 10px); right: 16px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.notif { display: flex; gap: 10px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 16px; background: var(--surface-1); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); box-shadow: 0 10px 34px rgba(0, 0, 0, .22); font-size: .86rem; }
#notifs .notif { pointer-events: auto; opacity: 0; transform: translateX(24px); transition: opacity .25s, transform .25s; }
#notifs .notif.in { opacity: 1; transform: none; }
.notif.high { border-left-color: var(--bad); }
.notif[data-link] { cursor: pointer; }
.notif img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; flex: none; background: #000; }
.notif-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.notif-txt span { color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notif-txt small { color: var(--text-muted); font-size: .74rem; }
.notif-x { border: 0; background: none; color: var(--text-muted); cursor: pointer; font-size: .9rem; padding: 2px 4px; }
.bell-panel { position: fixed; z-index: 60; top: calc(var(--top-h, 59px) + 6px); right: 12px; width: min(400px, calc(100vw - 24px)); max-height: min(70vh, 640px); overflow-y: auto;
  padding: 14px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.bell-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.bell-head h3 { margin: 0; font-size: 1rem; }
.bell-list { display: flex; flex-direction: column; gap: 6px; }
.bell-list .notif { box-shadow: none; border-left-width: 3px; padding: 9px 10px; }
.bell-list .notif:not(.unread) { border-left-color: var(--border); }
.bell-list .notif.unread { background: color-mix(in srgb, var(--accent) 7%, var(--surface-1)); }
@media (max-width: 640px) { #notifs { right: 12px; left: 12px; width: auto; } }
@media (max-width: 640px) {
  .topbar .bell-btn { margin-left: auto; }
  .topbar .bell-btn ~ .theme-btn { margin-left: 0; }
  .topbar:has(.bell-btn) .nav-actions { right: 172px; }
}

/* sonnette Ring */
.ring-shot { display: block; width: 100%; margin: 8px 0 4px; border-radius: 14px; overflow: hidden; background: #000; }
.ring-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.ring-head .btn { margin-left: auto; }
.ring-shot img { width: 100%; max-height: 360px; object-fit: contain; display: block; }
.ring-shot figcaption { padding: 6px 12px; font-size: .82rem; color: #fff; background: rgba(0, 0, 0, .55); }
.ring-thumb { padding: 0; border: 0; background: none; cursor: pointer; vertical-align: middle; }
.ring-thumb img { width: 54px; height: 36px; object-fit: cover; border-radius: 6px; }

/* sonnette dans la carte Caméras : photo à gauche, événements à droite */
.ring-sec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.ring-sec > .sub { margin-top: 0; }
.ring-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 20px; align-items: start; }
.ring-grid .sub { margin-top: 8px; }
