:root {
  color-scheme: light dark;
  --bg: #f4eee2;
  --surface: #ffffff;
  --border: #e3d9c6;
  --text: #2e3440;
  --text-muted: #6b7280;
  --accent: #5e81ac;
  --accent-text: #eceff4;
  --danger: #bf616a;
  --ok: #a3be8c;
  --warn: #d08770;
  --track: #e3d9c6;
  --shadow: 0 1px 2px rgba(46,52,64,.04), 0 8px 20px -12px rgba(46,52,64,.18);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2e3440;
    --surface: #3b4252;
    --border: #4c566a;
    --text: #eceff4;
    --text-muted: #d8dee9;
    --accent: #88c0d0;
    --accent-text: #2e3440;
    --track: #4c566a;
    --shadow: 0 1px 2px rgba(0,0,0,.2), 0 10px 24px -12px rgba(0,0,0,.45);
  }
}

:root[data-theme="dark"] {
  --bg: #2e3440; --surface: #3b4252; --border: #4c566a; --text: #eceff4;
  --text-muted: #d8dee9; --accent: #88c0d0; --accent-text: #2e3440;
  --track: #4c566a; --shadow: 0 1px 2px rgba(0,0,0,.2), 0 10px 24px -12px rgba(0,0,0,.45);
}

:root[data-theme="light"] {
  --bg: #f4eee2; --surface: #ffffff; --border: #e3d9c6; --text: #2e3440;
  --text-muted: #6b7280; --accent: #5e81ac; --accent-text: #eceff4;
  --track: #e3d9c6; --shadow: 0 1px 2px rgba(46,52,64,.04), 0 8px 20px -12px rgba(46,52,64,.18);
}

.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.app-header-left { position: relative; display: flex; align-items: center; }
.app-header-center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: .6rem; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--border); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }
.app-menu {
  position: absolute; top: calc(100% + .4rem); left: 0; min-width: 12rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: .75rem;
  box-shadow: var(--shadow); padding: .35rem; display: flex; flex-direction: column; gap: .15rem;
}
.app-menu a, .app-menu button {
  display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border-radius: .5rem;
  color: var(--text); text-decoration: none; font-size: .85rem; font-family: inherit;
  border: none; background: none; text-align: left; cursor: pointer; width: 100%;
}
.app-menu a:hover, .app-menu button:hover { background: var(--bg); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, system-ui, sans-serif; }
.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }

.gallery-header { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; padding: .75rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.header-side { display: flex; }
.header-side-right { justify-content: flex-end; }
.header-center { justify-self: center; }
.running-badge { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); padding: .35rem .65rem; border-radius: 999px; }
.running-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.toolbar { max-width: 1120px; margin: 0 auto; padding: 1rem 1rem 0; display: flex; flex-direction: column; gap: .65rem; }


.explore-wrap { max-width: 1120px; margin: 0 auto; padding: 1rem 1rem 3rem; display: flex; flex-direction: column; gap: 1rem; }
.explore-toolbar { display: flex; gap: .6rem; }
.explore-toolbar .search-field { flex: 1; }
.add-toggle-btn { flex: 0 0 auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; }
.add-toggle-btn:hover { color: var(--accent); border-color: var(--accent); }
.add-toggle-btn svg { width: 16px; height: 16px; }
.candidate-form { display: flex; flex-wrap: wrap; gap: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1rem; box-shadow: var(--shadow); }
.candidate-form input { flex: 1 1 160px; min-width: 0; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 10px; padding: .6rem .75rem; font: inherit; font-size: .88rem; }
.candidate-form input::placeholder { color: var(--text-muted); }
.candidate-form button { flex: 0 0 auto; width: auto; padding: .6rem 1.2rem; }

.candidates-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.candidate-row { display: flex; align-items: flex-start; gap: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .85rem 1rem; box-shadow: var(--shadow); }
.candidate-row.interested { border-color: var(--accent); }
.candidate-check { display: flex; align-items: center; padding-top: .15rem; }
.candidate-check input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.candidate-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.candidate-title-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.candidate-name { font-weight: 700; color: var(--text); text-decoration: none; }
.candidate-name:hover { color: var(--accent); }
.candidate-demo { font-size: .75rem; color: var(--accent); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: .1rem .55rem; }
.candidate-demo:hover { border-color: var(--accent); }
.candidate-desc { margin: 0; color: var(--text-muted); font-size: .85rem; }
.candidate-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.candidate-tag { font-size: .68rem; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: .12rem .55rem; }
.candidate-empty { color: var(--text-muted); font-size: .85rem; text-align: center; padding: 2rem 0; }
.candidate-delete { background: transparent; border: none; color: var(--text-muted); cursor: pointer; width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.candidate-delete:hover { background: var(--bg); color: var(--danger); }
.candidate-delete svg { width: 14px; height: 14px; }
.search-field { display: flex; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .65rem .9rem; box-shadow: var(--shadow); }
.search-field:focus-within { border-color: var(--accent); }
.search-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-field input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: .92rem; }
.search-field input::placeholder { color: var(--text-muted); }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }

.ring-wrap { position: relative; width: 54px; height: 54px; flex-shrink: 0; }
.ring-wrap svg { width: 54px; height: 54px; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--track); stroke-width: 6; }
.ring-value { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .6s ease, stroke .3s ease; }
.ring-value.ok { stroke: var(--ok); }
.ring-value.warn { stroke: var(--warn); }
.ring-value.crit { stroke: var(--danger); }
.ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; }

.load-cols { display: flex; gap: 1rem; width: 100%; }
.load-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.load-col .val { font-size: 1.05rem; font-weight: 600; }
.load-col .win { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }


.groups { max-width: 1120px; margin: 0 auto; padding: .5rem 1rem 1.2rem; display: flex; flex-direction: column; gap: 2.1rem; }
.service-group { margin-top: .5rem; }
.group-head { display: flex; align-items: baseline; gap: .55rem; padding: 0 .1rem .85rem; }
.group-head svg { width: 13px; height: 13px; color: var(--text-muted); }
.group-count { font-size: .74rem; color: var(--text-muted); }
.group-count::before { content: "\00b7 "; }
.section-label { font-size: .7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .12em; padding: 0 .25rem .6rem; }
.service-group .section-label { padding: 0; }

.card-flip { position: relative; width: 100%; height: 100%; min-height: 132px; transition: transform .5s cubic-bezier(.4,.1,.2,1); transform-style: preserve-3d; }
.service-card.flipped .card-flip { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; backface-visibility: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1rem 1rem .85rem; box-sizing: border-box; box-shadow: var(--shadow); }
.service-card.flipped .card-front { pointer-events: none; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .7rem; font-weight: 600; padding: .22rem .55rem .22rem .45rem; border-radius: 999px; color: var(--text-muted); background: var(--bg); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }
.service-card.running .status-pill { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.service-card.running .status-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.service-card.stopped .status-pill { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.service-card.stopped .status-dot { background: var(--danger); }
.service-card.unhealthy .status-pill { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.service-card.unhealthy .status-dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }

.flip-btn, .flip-back-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.flip-btn svg, .flip-back-btn svg { width: 15px; height: 15px; }
.flip-btn:hover, .flip-back-btn:hover { background: var(--bg); }
.card-back { transform: rotateY(180deg); display: flex; flex-direction: column; pointer-events: none; }
.service-card.flipped .card-back { pointer-events: auto; }
.card-back-top { display: flex; justify-content: space-between; align-items: center; padding-bottom: .5rem; }
.back-label { font-size: .7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-url { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: -.2rem 0 .45rem; }
.back-url:hover { text-decoration: underline; }
.card-back-actions { display: flex; gap: .5rem; flex: 1; align-items: flex-end; }
.card-back .btn-ghost { flex: 1; min-width: 0; width: auto; padding: .55rem .7rem; font-size: .82rem; display: flex; align-items: center; justify-content: center; gap: .4rem; border-radius: 10px; background: var(--bg); }
.card-back .btn-ghost svg { width: 13px; height: 13px; flex-shrink: 0; }
.card-back .btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.card-back .stop-btn:hover { border-color: var(--danger); color: var(--danger); }

.auth { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; gap: 1.25rem; text-align: center; }
.auth h1 { font-size: 1.4rem; font-weight: 600; margin: 0 0 .5rem; }
.auth-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 1rem; }
.btn { width: 100%; font-size: 1.1rem; padding: .9rem 1rem; border-radius: 12px; border: none; background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer; }
.btn-ghost { width: 100%; font-size: 1rem; padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.field { width: 100%; font-size: 1.1rem; padding: .9rem 1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.field::placeholder { color: var(--text-muted); }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--text-muted); font-size: .85rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-status { min-height: 1.2rem; color: var(--text-muted); font-size: .95rem; }
.auth-back { color: var(--text-muted); text-decoration: none; font-size: .95rem; display: inline-block; margin-top: .5rem; }

.menu-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }

.settings-page { max-width: 640px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.settings-header h1 { font-size: 1.7rem; font-weight: 800; margin: 0 0 .25rem; letter-spacing: -0.02em; }
.settings-sub { color: var(--text-muted); margin: 0 0 2rem; }
.settings-section { margin-bottom: 1.75rem; }
.settings-section .section-label { padding: 0 .25rem .6rem; }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.settings-row-link { display: flex; align-items: center; justify-content: space-between; gap: 1rem; text-decoration: none; color: inherit; }
.row-title { font-weight: 700; margin: 0 0 .15rem; }
.row-desc { color: var(--text-muted); font-size: .85rem; margin: 0; }
.chevron { color: var(--text-muted); font-size: 1.3rem; flex-shrink: 0; }
.btn-danger { width: 100%; padding: .8rem 1rem; border-radius: 14px; border: none; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-weight: 600; cursor: pointer; font-size: 1rem; }

.theme-switcher { display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; padding: .25rem; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.theme-switcher button { padding: .7rem .5rem; border-radius: 9px; border: none; background: transparent; color: var(--text-muted); font-size: .875rem; font-weight: 600; cursor: pointer; }
.theme-switcher button.active { background: var(--accent); color: var(--accent-text); }
/* Narrow cards: the two back-face buttons fall back to icons only. */
.card-back { container-type: inline-size; }
@container (max-width: 250px) { .card-back .btn-text { display: none; } .card-back .btn-ghost svg { width: 15px; height: 15px; } }

/* ── Barre d'onglets (même mécanisme que Santé) ── */
.app-nav { position: relative; display: grid; grid-template-columns: repeat(var(--tabs, 4), 1fr); gap: .2rem; padding: .3rem; margin: 1rem auto 0; width: calc(100% - 2rem); max-width: 1088px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.nav-tab { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-height: 60px; border: 0; background: none; font-family: inherit; border-radius: 16px; color: var(--text-muted); font-size: .7rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; -webkit-tap-highlight-color: transparent; padding: 0; }
.nav-tab svg { width: 1.45rem; height: 1.45rem; }
.nav-tab:active { transform: scale(.96); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.nav-tab.active:active { background: none; }
.nav-tab.active { color: var(--accent-text); }
.app-nav:not(.js) .nav-tab.active { background: var(--accent); }
.nav-ind { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 16px; background: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); opacity: 0; pointer-events: none; will-change: transform, width; }
.app-nav.ready .nav-ind { opacity: 1; }
.app-nav.glide .nav-ind { transition: transform .38s cubic-bezier(.3,1.25,.4,1), width .38s cubic-bezier(.3,1.25,.4,1); }

/* ── Tuiles : l'icône d'abord ── */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: 156px; gap: .9rem; padding: 0; }
.service-card, .gauge-tile { min-height: 0; }
.service-card { perspective: 1200px; }
.card-flip { height: 100%; min-height: 0; }
.gauge-tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .5rem; container-type: inline-size; }
.card-front { display: flex; flex-direction: column; gap: .5rem; cursor: pointer; pointer-events: auto; container-type: inline-size; }
.card-front .flip-btn { position: absolute; top: .55rem; right: .55rem; }
.front-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.svc-icon { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--cc-accent, var(--accent)); background: color-mix(in srgb, var(--cc-accent, var(--accent)) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--cc-accent, var(--accent)) 30%, transparent); box-shadow: 0 8px 18px -10px var(--cc-accent, var(--accent)); }
.svc-icon svg { width: 28px; height: 28px; }
.card-front > .svc-icon { margin-top: .1rem; }
.front-bottom { margin-top: auto; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.card-front .service-name { display: block; color: var(--text); font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container (min-width: 260px) { .svc-icon { width: 68px; height: 68px; border-radius: 20px; } .svc-icon svg { width: 36px; height: 36px; } .service-name, .gauge-figure { font-size: 1.15rem !important; } }
.gauge-label { font-size: .68rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; }
.gauge-figure { font-size: 1.1rem; font-weight: 700; }
.gauge-figure small { font-weight: 500; color: var(--text-muted); }
.gauge-sub { font-size: .72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-cols { display: flex; gap: .4rem; width: 100%; }
.load-col { flex: 1; align-items: flex-start; }
.load-col .val { font-size: 1rem; }
.front-bottom .status-pill { align-self: flex-start; }

/* ── Tuile service : titre centré en haut, grande icône au centre, point de statut ── */
.card-front { align-items: center; padding: .8rem .8rem .6rem; gap: 0; }
.card-front .service-name { width: 100%; text-align: center; padding: 0 1rem; font-size: .92rem; }
.card-front .svc-icon { margin: auto; width: 68px; height: 68px; border-radius: 22px; }
.card-front .svc-icon svg { width: 38px; height: 38px; }
.card-front .status-dot { position: absolute; top: .7rem; right: .7rem; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.service-card.running .status-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.service-card.unhealthy .status-dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }
.service-card.stopped .status-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.card-front .flip-btn { top: auto; bottom: .4rem; right: .4rem; }
@container (min-width: 260px) { .card-front .svc-icon { width: 96px; height: 96px; border-radius: 30px; } .card-front .svc-icon svg { width: 52px; height: 52px; } }

/* ── Gestion des catégories ── */
.service-grid:empty::after { content: "Aucun service ici — bouton étiquette pour en ajouter."; grid-column: 1 / -1; padding: 1.2rem; text-align: center; color: var(--text-muted); font-size: .85rem; border: 1px dashed var(--border); border-radius: 16px; }
.cat-back { position: fixed; inset: 0; z-index: 70; background: rgba(20,24,32,.5); opacity: 0; transition: opacity .2s; }
.cat-back.in { opacity: 1; }
.cat-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 71; max-width: 640px; margin: 0 auto; max-height: 85dvh; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom: 0; border-radius: 24px 24px 0 0; box-shadow: 0 -12px 40px -12px rgba(0,0,0,.5); transform: translateY(100%); transition: transform .25s ease; padding-bottom: env(safe-area-inset-bottom); }
.cat-sheet.in { transform: none; }
body.cat-open { overflow: hidden; }
.cat-grab { width: 42px; height: 5px; border-radius: 3px; background: var(--border); margin: .6rem auto .2rem; }
.cat-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .3rem 1rem .6rem; }
.cat-head h2 { margin: 0; font-size: 1.1rem; }
.cat-primary { min-height: 44px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-text); font: 600 .9rem inherit; font-family: inherit; padding: .35rem 1.2rem; cursor: pointer; }
.cat-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 .8rem 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.cat-body h3 { margin: .8rem .3rem .1rem; font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; }
.cat-err { margin: 0 .3rem; min-height: 1.1rem; color: var(--danger); font-size: .82rem; }
.cat-intro { margin: 0 .3rem; font-size: .88rem; line-height: 1.4; color: var(--text-muted); }
.cat-card { background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: .75rem .8rem; display: flex; flex-direction: column; gap: .6rem; }
.cat-field { display: flex; flex-direction: column; gap: .3rem; }
.cat-field-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); }
.cat-input { width: 100%; min-height: 46px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px; padding: 0 .8rem; font: inherit; font-weight: 600; font-size: 1rem; outline: none; }
.cat-input:focus { border-color: var(--accent); }
.cat-input:disabled { opacity: .5; }
.cat-input::placeholder { color: var(--text-muted); font-weight: 500; }
.cat-acts { display: flex; flex-wrap: wrap; gap: .4rem; }
.cat-act { min-height: 40px; padding: 0 .85rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 .85rem inherit; font-family: inherit; cursor: pointer; }
.cat-act:disabled { opacity: .3; cursor: default; }
.cat-act.danger { color: var(--danger); margin-left: auto; }
.cat-newbtn { min-height: 52px; border: 1.5px dashed var(--accent); background: none; color: var(--accent); border-radius: 16px; font: 700 .95rem inherit; font-family: inherit; cursor: pointer; }
.cat-svcrow { display: flex; align-items: center; gap: .6rem; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: .35rem .5rem .35rem .8rem; min-height: 52px; }
.cat-svc { flex: 1; min-width: 0; font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-select { flex-shrink: 0; max-width: 50%; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; padding: 0 .5rem; }

/* Mode édition : ✕ en haut à gauche (le point de statut reste visible), poignée seule en bas à droite. */
.service-card > .cc-x, .gauge-tile > .cc-x { right: auto; left: -10px; }
body.cc-wiggling .card-front .flip-btn { visibility: hidden; }

/* Tuiles système d'état (Fond, Arrêtés, Sauvegarde) : point de statut + teinte */
.gauge-tile .sys-dot { position: absolute; top: .7rem; right: .7rem; width: 10px; height: 10px; border-radius: 50%; }
.gauge-tile.ok .sys-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.gauge-tile.warn .sys-dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); }
.gauge-tile.bad .sys-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }

.group-edit { display: none; margin-left: auto; width: 32px; height: 32px; border: 0; background: none; color: var(--text-muted); border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; align-self: center; -webkit-tap-highlight-color: transparent; }
.group-edit svg { width: 15px; height: 15px; }
.group-edit:hover, .group-edit:active { background: var(--surface); color: var(--accent); }
.group-head { align-items: center; }
.cat-note { flex-shrink: 0; font-size: .75rem; color: var(--text-muted); padding-right: .6rem; }

.group-toggle { width: 32px; height: 32px; border: 0; background: none; color: var(--text-muted); border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; align-self: center; -webkit-tap-highlight-color: transparent; }
.group-toggle svg { width: 18px; height: 18px; transition: transform .2s; }
.group-toggle:active { background: var(--surface); }
.service-group.collapsed .group-toggle svg { transform: rotate(-90deg); }
.service-group.collapsed .service-grid { display: none; }
.service-group.collapsed .group-head { padding-bottom: 0; }
.groups-foot { max-width: 1120px; margin: 0 auto; padding: 0 1rem 3rem; }
.cat-new { width: 100%; min-height: 52px; border: 1.5px dashed var(--border); background: none; color: var(--text-muted); border-radius: 16px; font: 600 .9rem inherit; font-family: inherit; cursor: pointer; }
.cat-new:hover, .cat-new:active { border-color: var(--accent); color: var(--accent); }

/* Crayon et « Nouvelle catégorie » : seulement en mode édition. */
body.cc-wiggling .group-edit { display: flex; }
.groups-foot { display: none; }
body.cc-wiggling .groups-foot { display: block; }
.group-toggle { margin-left: auto; }
body.cc-wiggling .group-toggle { margin-left: 0; }

/* ── Favoris : plus gros, en haut ── */
.fav-group .service-grid { grid-auto-rows: 176px; }
.fav-group .group-head svg { color: var(--warn); }
.fav-star { display: none; position: absolute; left: -8px; bottom: -8px; z-index: 5; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--surface); background: var(--surface); color: var(--text-muted); align-items: center; justify-content: center; padding: 0; box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.fav-star svg { width: 18px; height: 18px; fill: none; }
.fav-star.on { background: var(--warn); color: #2e3440; }
.fav-star.on svg { fill: currentColor; }
body.cc-wiggling .cc-card > .fav-star { display: flex; pointer-events: auto !important; }

/* En-tête de section : ˅ juste avant le titre, ✎ discret après le nombre. */
.group-head { gap: .35rem; }
.group-toggle { margin-left: -.3rem; width: 28px; height: 28px; }
body.cc-wiggling .group-toggle { margin-left: -.3rem; }
.group-edit { margin-left: .1rem; width: 26px; height: 26px; opacity: .4; }
.group-edit svg { width: 12px; height: 12px; }
.group-edit:hover, .group-edit:active { opacity: 1; }

/* ── Icônes personnalisées : même tuile, même couleur, même halo ── */
.svc-icon .svc-img { display: block; width: 28px; height: 28px; background: currentColor; -webkit-mask: var(--img) center / contain no-repeat; mask: var(--img) center / contain no-repeat; }
.card-front .svc-icon .svc-img { width: 38px; height: 38px; }
@container (min-width: 260px) { .card-front .svc-icon .svc-img { width: 52px; height: 52px; } }
.icon-edit { display: none; position: absolute; left: calc(50% - 18px); bottom: -8px; z-index: 5; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--surface); background: var(--surface); color: var(--accent); align-items: center; justify-content: center; padding: 0; box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.icon-edit svg { width: 18px; height: 18px; }
body.cc-wiggling .cc-card > .icon-edit { display: flex; pointer-events: auto !important; }
.icon-upload { display: flex; align-items: center; justify-content: center; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: .5rem; }
.icon-choice { aspect-ratio: 1; border-radius: 16px; border: 1px solid var(--border); background: var(--bg); color: var(--accent); display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.icon-choice svg { width: 28px; height: 28px; }
.icon-choice.on { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border-color: var(--accent); box-shadow: 0 8px 18px -10px var(--accent); }

/* Favoris adaptatifs : 2 par ligne sur mobile, davantage sur grand écran ; icône plus grosse que les tuiles normales. */
.fav-group .service-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 560px) { .fav-group .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fav-group .card-front .svc-icon { width: 80px; height: 80px; border-radius: 26px; }
.fav-group .card-front .svc-icon svg { width: 44px; height: 44px; }
.fav-group .card-front .svc-icon .svc-img { width: 44px; height: 44px; }

/* "À domicile": hosts outside the VPS (Surface at home), visibly set apart. */
.home-group .service-grid { padding: .9rem; border: 1.5px dashed var(--border); border-radius: 20px; }
.home-badge { margin-left: auto; font-size: .7rem; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 999px; padding: .1rem .6rem; white-space: nowrap; }
.home-card .card-front { border-style: dashed; }
.home-tag { font-size: .66rem; letter-spacing: .02em; color: var(--text-muted); text-align: center; }
.home-sub { font-size: .7rem; color: var(--text-muted); text-align: center; line-height: 1.2; }
.home-card .card-front .home-help { top: auto; bottom: .4rem; right: .4rem; }
.home-group .service-grid { grid-auto-rows: 200px; }
.home-back { overflow-y: auto; }
.home-notes { margin: 0; padding-left: 1rem; display: flex; flex-direction: column; gap: .3rem; font-size: .7rem; line-height: 1.35; color: var(--text-muted); }
.home-notes b { color: var(--text); }
.home-notes code { font-size: .95em; }

/* Fenêtre « Adresses » */
.addr-dialog { width: min(640px, 94vw); max-height: 86vh; overflow: auto; padding: 1rem 1.1rem; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.addr-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.addr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.addr-help { font-size: .78rem; color: var(--text-muted); margin: .4rem 0; }
.addr-help code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .74rem; }
.addr-list { list-style: none; margin: .5rem 0; padding: 0; display: grid; gap: .1rem; }
.addr-row { display: grid; grid-template-columns: 9rem 1fr; gap: 0 .6rem; align-items: baseline; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.addr-name { font-weight: 600; font-size: .85rem; }
.addr-copy { background: none; border: 0; padding: 0; text-align: left; color: var(--accent); font-size: .8rem; cursor: pointer; }
.addr-copy:hover { text-decoration: underline; }
.addr-old { grid-column: 2; font-size: .68rem; color: var(--text-muted); opacity: .75; overflow-wrap: anywhere; }
