/* PrivaHost — administration du statut v3 : même langage visuel que la page publique (status3.css). */
:root, [data-theme='light'] {
  --bg: #ffffff; --page: #f7f8fa; --surface: #ffffff; --soft: #f3f4f7; --soft-2: #eceef2; --line: #e6e8ec; --line-2: #d6d9df;
  --text: #0f1729; --muted: #5b6474; --faint: #8a93a3;
  --accent: #2563eb; --accent-soft: #eaf0fe; --accent-text: #1d4fd7; --on-accent: #ffffff;
  --up: #0f9d6e; --up-soft: #e7f6f0; --deg: #d97706; --deg-soft: #fdf3e3; --down: #dc3545; --down-soft: #fdecee;
  --info: #2f6fe4; --info-soft: #eaf1fd; --none: #e5e7eb;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.06);
  --shadow-lg: 0 24px 60px -20px rgb(16 24 40 / 0.35), 0 2px 6px rgb(16 24 40 / 0.06);
  --brand: #2563eb;
  color-scheme: light;
}
[data-theme='dark'] {
  --bg: #0f131a; --page: #0b0e14; --surface: #131820; --soft: #1a1f29; --soft-2: #212734; --line: #242a36; --line-2: #313848;
  --text: #e8ecf3; --muted: #a0a9b8; --faint: #6e7889;
  --accent: #5b8fff; --accent-soft: rgb(91 143 255 / 0.14); --accent-text: #8cb0ff; --on-accent: #0b0e14;
  --up: #20c997; --up-soft: rgb(32 201 151 / 0.12); --deg: #f2a33a; --deg-soft: rgb(242 163 58 / 0.13); --down: #f0525e; --down-soft: rgb(240 82 94 / 0.13);
  --info: #5b8fff; --info-soft: rgb(91 143 255 / 0.14); --none: #2a303c;
  --shadow: none;
  --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--page); color: var(--text); font-family: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14.5px; line-height: 1.5; }
body.modal-open, body.rail-open { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex-shrink: 0; }
code { font-family: 'JetBrains Mono', monospace; font-size: 0.88em; background: var(--soft); padding: 1px 6px; border-radius: 5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { letter-spacing: -0.015em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono, .input-mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }
.cell-mono { font-variant-numeric: tabular-nums; }
.text-ok { color: var(--up) !important; }
.text-warn { color: var(--deg) !important; }
.text-danger { color: var(--down) !important; }
.mt { margin-top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[data-theme='dark'] img.brand-invert, [data-theme='dark'] img.invert { filter: brightness(0) invert(1); }

/* ---------------------------------------------------------------- boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s; position: relative; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-xs svg { width: 14px; height: 14px; }
.btn-lg { height: 42px; padding: 0 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }
[data-theme='dark'] .btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn-outline { background: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--soft); }
.btn-danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--down) 88%, #000); }
.btn-danger-ghost { background: transparent; border-color: color-mix(in srgb, var(--down) 35%, transparent); color: var(--down); box-shadow: none; }
.btn-danger-ghost:hover { background: var(--down-soft); }
.btn[disabled], .btn[aria-busy='true'] { opacity: 0.6; pointer-events: none; }
.btn[aria-busy='true']::after { content: ''; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.danger:hover { background: var(--down-soft); color: var(--down); }
.icon-btn.spinning svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--muted); border: 1px solid transparent; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.tiny { height: 20px; padding: 0 7px; font-size: 11.5px; }
.badge.ok { background: var(--up-soft); color: var(--up); }
.badge.warn { background: var(--deg-soft); color: var(--deg); }
.badge.danger, .badge.error { background: var(--down-soft); color: var(--down); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--soft); color: var(--muted); border-color: var(--line); }
.badge.ok .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 22%, transparent); }
.masked-pill { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--soft); border: 1px solid var(--line); vertical-align: 1px; }

/* ---------------------------------------------------------------- formulaires */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.req { color: var(--down); }
.field-help { font-size: 12.5px; color: var(--faint); line-height: 1.45; }
p.field-help { margin: 0; }
.input, .select, .textarea { width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font-size: 14px; transition: border-color 0.15s, box-shadow 0.15s; }
.textarea { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.5; min-height: 70px; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--line-2) 60%, var(--faint)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input-mono { font-size: 13px; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; cursor: pointer; }
.input-group { position: relative; }
.input-group .input { padding-right: 44px; }
.input-group .icon-btn { position: absolute; right: 3px; top: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.color-row { display: flex; gap: 8px; }
.input-color { width: 46px; height: 38px; padding: 3px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); cursor: pointer; }
.input-color::-webkit-color-swatch-wrapper { padding: 0; }
.input-color::-webkit-color-swatch { border: 0; border-radius: 5px; }

.switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); transition: background 0.2s; position: relative; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-copy b { font-weight: 600; font-size: 14px; }
.switch-copy span { font-size: 12.5px; color: var(--muted); }
.inline-form { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.inline-field { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.inline-field label { font-weight: 500; color: var(--muted); }
.inline-field .input { width: 90px; text-align: center; }

/* ---------------------------------------------------------------- connexion */
.login-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; position: relative; overflow: hidden; }
.login-glow { position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px; opacity: 0.55;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 60% 55% at 50% 40%, #000 20%, transparent 75%); }
.login-shell { position: relative; width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; }
.login-top { display: flex; align-items: center; justify-content: space-between; }
.login-brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.login-brand img { height: 24px; }
.login-brand span { font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px 22px; box-shadow: var(--shadow-lg); animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.login-badge { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; }
.login-badge svg { width: 21px; height: 21px; }
.login-card h1 { margin: 0; font-size: 21px; font-weight: 800; }
.login-sub { margin: 6px 0 22px; color: var(--muted); font-size: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-error { padding: 9px 12px; border-radius: 8px; background: var(--down-soft); color: var(--down); font-size: 13.5px; font-weight: 500; }
.login-submit { height: 40px; margin-top: 4px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.login-submit:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.login-submit svg { transition: transform 0.2s; }
.login-submit:hover svg { transform: translateX(3px); }
.login-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.login-foot a { color: var(--muted); }
.login-foot a:hover { color: var(--text); }
.login-secure { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); }
.login-secure svg { width: 15px; height: 15px; color: var(--up); }
.login-note { margin: 0; text-align: center; font-size: 12.5px; color: var(--faint); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.99); } }

/* ---------------------------------------------------------------- structure */
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); padding: 14px 12px; z-index: 30; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 14px; }
.rail-brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.rail-brand img { width: 30px; height: 30px; border-radius: 8px; object-fit: contain; }
.rail-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.rail-brand-text b { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.rail-brand-text b span { color: var(--accent); }
.rail-brand-text small { font-size: 11.5px; color: var(--faint); font-weight: 600; }
.rail-theme { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.rail-theme:hover { color: var(--text); background: var(--soft); }
.rail-theme svg { width: 15px; height: 15px; }
.rail-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding-top: 6px; margin: 0 -4px; padding-inline: 4px; }
.rail-group { display: flex; flex-direction: column; gap: 2px; }
.rail-group-label { padding: 0 10px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; transition: background 0.15s, color 0.15s; }
.nav-item svg { width: 17px; height: 17px; stroke-width: 1.8; }
.nav-item:hover { background: var(--soft); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--soft); color: var(--text); }
.rail .nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.rail-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--down); color: #fff; font-size: 11px; font-weight: 700; }
.rail-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.rail-account { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.rail-account-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); }
.rail-account-main:hover { text-decoration: none; }
.rail-avatar { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; text-transform: uppercase; }
.rail-account-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rail-account-name { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-account-sub { font-size: 11.5px; color: var(--faint); }
.rail-account-out { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.rail-account-out:hover { background: var(--down-soft); color: var(--down); }
.rail-account-out svg { width: 16px; height: 16px; }
.rail-backdrop { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 28px; background: color-mix(in srgb, var(--page) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-menu { display: none; }
.topbar-crumb { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--faint); min-width: 0; }
.topbar-crumb svg { width: 14px; height: 14px; }
.topbar-crumb strong { color: var(--text); font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; margin-right: 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.topbar-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 50%, transparent); animation: ping 2.2s infinite; }
.topbar-pill.warn .dot { background: var(--deg); animation: none; }
.topbar-pill.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 35%, transparent); background: var(--down-soft); }
.topbar-pill.danger .dot { background: var(--down); --pc: var(--down); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }

.page { width: min(1180px, 100%); margin: 0 auto; padding: 28px 28px 64px; }
.view { animation: viewIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); margin-bottom: 4px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 620px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.last-sync { font-size: 12.5px; color: var(--faint); margin-right: 4px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.panel-card { overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-body { padding: 18px 20px; }
.card-body > .switch-row:first-child { padding-top: 0; }
.card-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--soft); }
.head-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.head-link svg { width: 14px; height: 14px; transition: transform 0.15s; }
.head-link:hover { text-decoration: none; }
.head-link:hover svg { transform: translateX(2px); }
.head-actions { display: flex; gap: 6px; }
.stack-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* aperçu : tableau des services pleine largeur, surveillance et activité côte à côte dessous */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.overview-grid > .stack-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 16px 18px; transition: border-color 0.15s, transform 0.15s; }
.kpi:hover { border-color: var(--line-2); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--soft); color: var(--muted); }
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-icon.ok { background: var(--up-soft); color: var(--up); }
.kpi-icon.warn { background: var(--deg-soft); color: var(--deg); }
.kpi-icon.danger { background: var(--down-soft); color: var(--down); }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value .unit { font-size: 14px; font-weight: 600; color: var(--faint); margin-left: 4px; letter-spacing: 0; }
.kpi-sub { margin-top: 6px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tableaux */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 16px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); background: var(--soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: color-mix(in srgb, var(--soft) 60%, transparent); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 16px; }
.cell-mono { font-size: 13px; color: var(--muted); white-space: nowrap; }
.cell-nowrap { white-space: nowrap; }
.cell-right { text-align: right; }
.cell-service { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); color: var(--muted); flex-shrink: 0; }
.cell-icon svg { width: 17px; height: 17px; }
.cell-title { font-weight: 700; font-size: 14px; line-height: 1.25; }
.cell-sub { font-size: 12px; color: var(--faint); font-family: 'JetBrains Mono', monospace; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 2px; justify-content: flex-end; }
.row-actions .icon-btn { width: 30px; height: 30px; }
.row-actions .icon-btn svg { width: 15px; height: 15px; }
.cell-bars { min-width: 150px; }
.mini-bars { display: flex; gap: 2px; height: 20px; align-items: stretch; }
.mini-bars i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--none); transition: transform 0.15s; transform-origin: 50% 100%; }
.mini-bars i.up { background: var(--up); }
.mini-bars i.deg { background: var(--deg); }
.mini-bars i.down { background: var(--down); }
.mini-bars i:hover { transform: scaleY(1.25); }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search-box { position: relative; flex: 1; max-width: 420px; }
.search-box svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box .input { padding-left: 36px; height: 36px; background: var(--soft); border-color: transparent; }
.search-box .input:focus { background: var(--bg); border-color: var(--accent); }
.toolbar-meta { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar-copy { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.toolbar-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); }

/* moteur de surveillance */
.monitor-state { display: flex; align-items: center; gap: 9px; padding: 10px 12px; margin-bottom: 12px; border-radius: 9px; background: var(--up-soft); color: var(--up); font-weight: 600; font-size: 13.5px; }
.monitor-state .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: ping 2.2s infinite; }
.monitor-state.warn { background: var(--deg-soft); color: var(--deg); }
.monitor-state.warn .dot { animation: none; }
.monitor-rows { display: flex; flex-direction: column; }
.monitor-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.monitor-row:last-child { border-bottom: 0; padding-bottom: 0; }
.monitor-row span { color: var(--muted); }
.monitor-row b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* fil d'activité */
.activity-feed { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.activity-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--soft); color: var(--muted); flex-shrink: 0; }
.activity-icon svg { width: 14px; height: 14px; }
.activity-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.activity-main b { font-weight: 600; font-size: 13.5px; }
.activity-main span { font-size: 12.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { font-size: 12px; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
#activity-list .activity-item { padding-inline: 20px; }

/* évènements (aperçu) */
.overview-events { display: flex; flex-direction: column; }
.event-row { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--info); flex-shrink: 0; box-shadow: 0 0 0 4px var(--info-soft); }
.event-dot.warn { background: var(--deg); box-shadow: 0 0 0 4px var(--deg-soft); }
.event-dot.danger { background: var(--down); box-shadow: 0 0 0 4px var(--down-soft); }
.event-main { flex: 1; min-width: 0; }
.event-main h4 { margin: 0; font-size: 14px; font-weight: 700; }
.event-main p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.event-meta { font-size: 12px; font-weight: 600; color: var(--faint); padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; }
.events-empty { padding: 26px 20px; text-align: center; color: var(--faint); font-size: 13.5px; }

/* listes incidents / maintenances */
.list-meta { font-size: 13px; color: var(--faint); margin-bottom: 10px; }
.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-list-loading { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.event-card { position: relative; padding: 18px 20px 16px 22px; overflow: hidden; transition: border-color 0.15s; }
.event-card:hover { border-color: var(--line-2); }
.event-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--info); }
.event-card.impact-major::before { background: var(--deg); }
.event-card.impact-critical::before { background: var(--down); }
.event-card.impact-maintenance::before, .event-card.is-maint::before { background: var(--info); }
.event-card.phase-in_progress::before { background: var(--deg); }
.event-card.phase-completed::before, .event-card.is-resolved::before { background: var(--up); }
.event-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.event-head .when { margin-left: auto; font-size: 12.5px; color: var(--faint); }
.event-title { margin: 10px 0 0; font-size: 16px; font-weight: 700; }
.updates-block summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.updates-block summary::-webkit-details-marker { display: none; }
.updates-block summary svg { width: 14px; height: 14px; transition: transform 0.2s; }
.updates-block[open] summary svg { transform: rotate(90deg); }
.event-card .event-meta { border: 0; padding: 0; font-weight: 500; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--faint); font-size: 12.5px; white-space: normal; }
.event-card .event-meta span { display: inline-flex; align-items: center; gap: 5px; }
.event-card .event-meta svg { width: 13px; height: 13px; }
.event-body { margin: 12px 0 0; font-size: 14px; color: var(--muted); white-space: pre-wrap; line-height: 1.55; }
.event-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.updates-block { margin-top: 14px; }
.admin-timeline { position: relative; display: flex; flex-direction: column; gap: 12px; padding-left: 18px; }
.admin-timeline::before { content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.admin-tl-item { position: relative; }
.admin-tl-item::before { content: ''; position: absolute; left: -18px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.admin-tl-item:first-child::before { border-color: var(--accent); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-time { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.admin-tl-item p { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); white-space: pre-wrap; }

/* segmenté */
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--soft); border: 1px solid var(--line); }
.segmented button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(16 24 40 / 0.1); }

/* états vides / erreurs / squelettes */
.empty-state { padding: 44px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-state.error .empty-icon { background: var(--down-soft); color: var(--down); }
.empty-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); color: var(--faint); margin-bottom: 8px; }
.empty-icon svg { width: 22px; height: 22px; }
.empty-state > b { font-size: 15px; font-weight: 700; }
.empty-state > span { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); max-width: 380px; }
.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--soft) 0%, var(--soft-2) 50%, var(--soft) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.table-skeleton { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.table-skeleton .skeleton { height: 40px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* sessions */
.session-device { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.session-sub { font-size: 12px; color: var(--faint); }
.session-ua { font-size: 13.5px; font-weight: 600; color: var(--text); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { white-space: nowrap; font-size: 13px; color: var(--muted); }
.tips-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.tips-list li { position: relative; padding-left: 24px; font-size: 13.5px; color: var(--muted); }
.tips-list li::before { content: ''; position: absolute; left: 0; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--up-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f9d6e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 9px no-repeat; }

/* marque / téléversements */
.upload-row { display: flex; align-items: center; gap: 16px; }
.upload-preview { display: grid; place-items: center; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--soft); flex-shrink: 0; overflow: hidden; }
.upload-logo { width: 170px; height: 64px; padding: 10px; }
.upload-icon { width: 64px; height: 64px; padding: 10px; }
.upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.upload-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.upload-actions .field-help { flex-basis: 100%; }
.brand-preview { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--bg); overflow: hidden; }
.brand-preview::after { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--brand); }
.brand-preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.brand-preview-head img { height: 22px; max-width: 160px; object-fit: contain; }
.brand-preview-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 4px var(--up-soft); }
.brand-preview-name { font-size: 18px; font-weight: 800; }
.brand-preview-tagline { font-size: 13px; color: var(--muted); }
.brand-preview-bar { height: 6px; border-radius: 999px; background: var(--soft); margin: 14px 0 10px; overflow: hidden; }
.brand-preview-bar span { display: block; width: 68%; height: 100%; border-radius: inherit; background: var(--brand); }
.brand-preview p { margin: 0; font-size: 12.5px; color: var(--faint); }
.preview-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.preview-note svg { width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }

/* sélecteur d'icône */
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.icon-pick { height: 40px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s; }
.icon-pick svg { width: 18px; height: 18px; }
.icon-pick:hover { border-color: var(--line-2); color: var(--text); }
.icon-pick.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.icon-pick:active { transform: scale(0.95); }

/* ---------------------------------------------------------------- modales */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; opacity: 0; visibility: hidden; transition: opacity 0.18s, visibility 0s linear 0.18s; }
.modal.open { opacity: 1; visibility: visible; transition: opacity 0.18s; }
.modal-backdrop { position: absolute; inset: 0; background: rgb(10 14 22 / 0.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-panel { position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); transform: translateY(12px) scale(0.98); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); overflow: hidden; }
.modal.open .modal-panel { transform: none; }
.modal-lg { width: min(720px, 100%); }
.modal-sm { width: min(440px, 100%); }
.modal-panel > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.modal-head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.modal-close { margin: -4px -6px 0 0; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--soft); }
.confirm-panel { padding: 26px 24px 20px; text-align: center; align-items: center; }
.confirm-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--down-soft); color: var(--down); margin-bottom: 14px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--down-soft) 50%, transparent); }
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-panel h2 { margin: 0; font-size: 17px; font-weight: 800; }
.confirm-panel p { margin: 6px 0 20px; color: var(--muted); font-size: 14px; }
.confirm-actions { display: flex; gap: 8px; justify-content: center; width: 100%; }
.confirm-actions .btn { flex: 1; }

/* ---------------------------------------------------------------- notifications */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 400px; padding: 11px 14px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.toast svg { width: 17px; height: 17px; }
.toast.ok svg { color: #34d399; }
.toast.warn svg { color: #fbbf24; }
.toast.error svg { color: #f87171; }
.toast.info svg { color: #93b4ff; }
[data-theme='dark'] .toast { background: var(--soft-2); color: var(--text); border: 1px solid var(--line-2); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } }

/* ---------------------------------------------------------------- barre mobile */
.mbar { display: none; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .overview-grid > .stack-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; height: auto; transform: translateX(-100%); opacity: 0; visibility: hidden; box-shadow: var(--shadow-lg); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s, visibility 0s linear 0.22s; }
  body.rail-open .rail { transform: none; opacity: 1; visibility: visible; transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s; }
  .rail-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(10 14 22 / 0.45); opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0s linear 0.2s; }
  body.rail-open .rail-backdrop { opacity: 1; visibility: visible; transition: opacity 0.2s; }
  .topbar { padding: 0 12px; gap: 6px; }
  .topbar-crumb > span, .topbar-crumb > svg { display: none; }
  .topbar-crumb strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-menu { display: inline-grid; }
  .topbar-pill #monitor-pill-text { display: none; }
  .topbar-pill { padding: 0 9px; }
  .page { padding: 20px 16px 96px; }
  .mbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .mbar .nav-item { flex-direction: column; justify-content: center; gap: 2px; height: 50px; padding: 0; font-size: 11px; text-align: center; }
  .mbar .nav-item.active, body.rail-open #rail-menu-btn { color: var(--accent); background: var(--accent-soft); }
  .toast-stack { left: 16px; right: 16px; bottom: 80px; }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 23px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 22px; }
  .page-actions { width: 100%; }
  .card-head, .card-body { padding-inline: 16px; }
  .data-table th:first-child, .data-table td:first-child { padding-left: 16px; }
  .upload-row { flex-direction: column; align-items: flex-start; }
  .modal { padding: 0; place-items: end center; }
  .modal-panel, .modal-lg, .modal-sm { width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; transform: translateY(30px); }
  .last-sync { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
