/* Hébergement web : habillage des écrans du panel d'hébergement à la charte de DyneNAS.
   Les écrans arrivent avec le vocabulaire de classes du panel (.card, .tablewrap, .kv, .note, label.field…).
   Tout est borné à .hostx : le contenu de la fenêtre, et les fenêtres modales qu'il ouvre (dialog.hostx). */

.hostx {
  --panel-2: var(--track); --panel-3: var(--track); --text-2: var(--text);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent); --accent-ring: color-mix(in srgb, var(--accent) 22%, transparent);
  --ok-soft: color-mix(in srgb, var(--ok) 14%, transparent); --warn-soft: color-mix(in srgb, var(--warn) 15%, transparent); --bad-soft: color-mix(in srgb, var(--bad) 13%, transparent);
  --code: var(--track); --radius-s: 10px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* --- Coque : la colonne est celle du Panneau de configuration ---------------------------------- */
.host-cp .cp-side { padding-top: 6px; }
.host-cp .cp-group:first-child { margin-top: 8px; }
.host-foot { margin: auto 12px 0; padding-top: 16px; }
@container win (max-width: 700px) { .host-cp .cp-group:first-child { margin-top: 0; } }

/* --- Textes et utilitaires ---------------------------------------------------------------------- */
.hostx svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.hostx a { text-decoration: none; }
.hostx a:hover { text-decoration: underline; }
.hostx code, .hostx pre, .hostx .mono { font-family: var(--mono); font-size: 12.5px; }
.hostx code { background: var(--code); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); }
.hostx pre { background: color-mix(in srgb, var(--bg-solid) 80%, #000); padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-word; }
.hostx pre code { border: 0; padding: 0; background: none; }
.hostx .small { font-size: 12.5px; }
.hostx .right { margin-left: auto; }
.hostx .grow { flex: 1; min-width: 0; }
.hostx .hidden { display: none !important; }
.hostx .row { display: flex; align-items: center; justify-content: flex-start; gap: 10px; flex-wrap: wrap; padding: 0; }
.hostx .row + .row { border-top: 0; }
.hostx .row span:last-child { text-align: inherit; overflow-wrap: normal; }
.hostx .stack { display: grid; gap: 16px; }
.hostx .stack > * + * { margin-top: 0; }

/* --- En-tête de page, fil d'Ariane --------------------------------------------------------------- */
.hostx .head { display: flex; align-items: center; justify-content: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.hostx .head h1 { font-size: 21px; }
.hostx .crumb { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

/* --- Cartes, grilles, jauges -------------------------------------------------------------------- */
.hostx .card { padding: 18px 20px; }
.hostx .card.flush { padding: 0; overflow: hidden; }
.hostx .grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.hostx .grid.two { grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); }
.hostx .stat .label { color: var(--muted); font-size: 11px; font-weight: 660; text-transform: uppercase; letter-spacing: .07em; }
.hostx .stat .value { font-size: 26px; font-weight: 680; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.hostx .stat.meter { display: flex; align-items: center; gap: 16px; }
.hostx .ring { --p: 0; --c: var(--accent); width: 62px; height: 62px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--track) 0); }
.hostx .ring::before { content: ""; grid-area: 1 / 1; width: 48px; height: 48px; border-radius: 50%; background: var(--bg-solid); }
.hostx .ring > span { grid-area: 1 / 1; font-size: 12.5px; font-weight: 680; font-variant-numeric: tabular-nums; z-index: 1; }
.hostx .ring.warn { --c: #f59e0b; }
.hostx .ring.bad { --c: #ef4444; }
.hostx .bar { height: 8px; margin: 8px 0 0; }
.hostx .bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .7s var(--ease); }
.hostx .bar.warn > i { background: linear-gradient(90deg, #f59e0b, #f97316); }
.hostx .bar.bad > i { background: linear-gradient(90deg, #ef4444, #e11d48); }
.hostx .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.hostx .dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.hostx .dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.hostx .dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.hostx a.card.link { display: block; color: inherit; transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.hostx a.card.link:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 10px 26px rgba(10, 16, 34, .12); }
.hostx .glyph { width: 56px; height: 56px; flex: none; display: grid; place-items: center; border-radius: 16px; color: #fff; background: linear-gradient(150deg, #c084fc, #6d28d9); box-shadow: 0 4px 12px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .35); }
.hostx .glyph svg.i { width: 26px; height: 26px; stroke-width: 1.6; }
.hostx .tile { --h: 220; width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; font-weight: 700; font-size: 13px; text-transform: uppercase; color: #fff; background: linear-gradient(140deg, hsl(var(--h) 72% 58%), hsl(calc(var(--h) + 40) 70% 44%)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }

/* --- Boutons ------------------------------------------------------------------------------------ */
.hostx button, .hostx .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.hostx .btn { text-decoration: none; font-weight: 540; border-radius: 10px; border: 1px solid var(--line-strong); padding: 6px 14px; color: var(--text); background: var(--field); }
.hostx .btn:hover { text-decoration: none; }
.hostx button.small { padding: 3px 10px; font-size: 13px; border-radius: 8px; }
.hostx button.wide { width: 100%; }
.hostx button.icon { padding: 6px; }
.hostx button.ghost { border-color: transparent; background: transparent; padding: 6px 8px; box-shadow: none; }
.hostx button.ghost:hover { background: var(--hover); border-color: transparent; box-shadow: none; transform: none; }
.hostx .spin { display: inline-block; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }

/* --- Formulaires -------------------------------------------------------------------------------- */
.hostx label { margin: 0; font-size: inherit; font-weight: inherit; }
.hostx label.field { display: block; }
.hostx label.field > span { display: block; font-weight: 620; font-size: 13px; margin-bottom: 5px; }
.hostx label.field > small { display: block; color: var(--muted); margin-top: 5px; font-size: 12.5px; font-weight: 400; }
.hostx label.check { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; margin: 0; padding: 0; background: none; border-radius: 0; }
.hostx label.check > span { font-weight: 560; }
.hostx label.check small { display: block; color: var(--muted); font-weight: 400; font-size: 12.5px; margin-top: 1px; }
/* Une case « marche / arrêt » se présente en interrupteur, comme dans le reste du bureau. */
.hostx label.check > input[type=checkbox] { -webkit-appearance: none; appearance: none; width: 36px; height: 22px; flex: none; margin: 1px 0 0; padding: 0; border: 0; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .25s; }
.hostx label.check > input[type=checkbox]::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .28s var(--spring); }
.hostx label.check > input[type=checkbox]:checked { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.hostx label.check > input[type=checkbox]:checked::after { transform: translateX(14px); }
.hostx label.check > input[type=checkbox]:focus { box-shadow: none; }
.hostx label.check > input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hostx .form { display: grid; gap: 15px; max-width: none; }
.hostx .form.cols { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.hostx .form button { margin-top: 0; }
.hostx textarea { font-family: var(--mono); font-size: 12.5px; min-height: 120px; resize: vertical; line-height: 1.5; }
.hostx input[type=color] { padding: 3px; height: 36px; }
.hostx input.filter { width: min(240px, 100%); }

/* --- Tableaux, listes vides, pastilles, notes ---------------------------------------------------- */
.hostx .tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.hostx .card .tablewrap { border: 0; background: none; border-radius: 0; }
.hostx td.actions button + button { margin-left: 4px; }
.hostx td.actions button { margin-left: 0; }
.hostx .empty { display: grid; justify-items: center; gap: 10px; padding: 34px 18px; margin: 0; max-width: none; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); animation: none; }
.hostx .card .empty { border: 0; }
.hostx .empty svg.i { width: 30px; height: 30px; padding: 10px; box-sizing: content-box; border-radius: 50%; background: var(--track); color: var(--muted); stroke-width: 1.5; }
.hostx .badge:not(.ok):not(.warn):not(.bad):not(.info)::before { display: none; }
.hostx .note { border-radius: var(--radius); padding: 11px 15px 11px 17px; background: color-mix(in srgb, var(--accent) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); position: relative; overflow: hidden; line-height: 1.55; margin: 0; }
.hostx .note::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone, var(--accent)); }
.hostx .note.warn { --tone: var(--warn); background: color-mix(in srgb, var(--warn) 11%, var(--panel)); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.hostx .note.bad { --tone: var(--bad); background: color-mix(in srgb, var(--bad) 11%, var(--panel)); border-color: color-mix(in srgb, var(--bad) 38%, transparent); }
.hostx .kv { display: grid; grid-template-columns: minmax(110px, 170px) 1fr; gap: 9px 14px; margin: 0; }
.hostx .kv dt { color: var(--muted); }
.hostx .kv dd { margin: 0; min-width: 0; word-break: break-word; }
.hostx .kv + .note { margin-top: 14px; }

/* --- Onglets d'une page : pastilles, sur plusieurs lignes s'il le faut — aucun n'est jamais caché --- */
.hostx .tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; padding: 4px; background: var(--track); border-radius: 12px; width: fit-content; max-width: 100%; overflow: visible; border-bottom: 0; }
.hostx .tabs a { padding: 6px 14px; border-radius: 9px; color: var(--muted); font-weight: 540; white-space: nowrap; transition: background .2s, color .2s, box-shadow .2s; }
.hostx .tabs a:hover { color: var(--text); text-decoration: none; background: var(--hover); }
.hostx .tabs a.on { color: var(--text); font-weight: 640; background: var(--field); box-shadow: 0 1px 3px rgba(10, 16, 34, .16), inset 0 1px 0 rgba(255, 255, 255, .12); }
/* « Mon compte » du panel (mot de passe, clés d'accès) : sans objet ici, l'identité est celle du NAS. */
.hostx .tabs a[href="#/reglages/compte"] { display: none; }

/* --- Fenêtres modales ---------------------------------------------------------------------------- */
dialog.hostx { max-width: 560px; }
dialog.hostx.wide { max-width: 920px; }
dialog.hostx .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.hostx .diff { font-family: var(--mono); font-size: 12px; background: var(--code); border: 1px solid var(--line); border-radius: 10px; padding: 10px; overflow: auto; max-height: 45vh; white-space: pre; }
.hostx .diff .add { color: var(--ok); }
.hostx .diff .del { color: var(--bad); }
.hostx .log { max-height: 62vh; overflow: auto; }

/* --- Fichiers, terminal --------------------------------------------------------------------------- */
.hostx .path { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.hostx .path a { padding: 2px 5px; border-radius: 5px; }
.hostx .path a:hover { background: var(--hover); text-decoration: none; }
.hostx .file-name { display: flex; align-items: center; gap: 8px; }
.hostx .ico { width: 16px; text-align: center; opacity: .8; }
.hostx .editor { width: 100%; min-height: 55vh; }
.hostx .term { position: relative; background: #0b0e14; color: #d7dce5; font-family: var(--mono); font-size: 13px; line-height: 1.25; padding: 12px; border-radius: var(--radius); overflow: hidden; white-space: pre; outline: none; cursor: text; border: 1px solid #1c2330; }
.hostx .term:focus-within { box-shadow: 0 0 0 3px var(--accent-ring); border-color: var(--accent); }
.hostx .term-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; min-height: 0; opacity: 0; border: 0; padding: 0; resize: none; }
.hostx .term .cur { background: #d7dce5; color: #0b0e14; }

/* --- Audit de sécurité ----------------------------------------------------------------------------- */
.hostx .checks { display: grid; }
.hostx .checks > .check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px; margin: 0; border-top: 1px solid var(--line); background: none; border-radius: 0; font-size: inherit; }
.hostx .check .dot { margin-top: 6px; }
.hostx .check .t { font-weight: 600; }

/* --- Fenêtre étroite -------------------------------------------------------------------------------- */
@container pane (max-width: 520px) {
  .hostx .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .hostx .kv dd { margin-bottom: 8px; }
  .hostx .head .right { margin-left: 0; }
}
