/* ============================================================
   CrowStatus Admin
   Se charge APRÈS https://crowstudios.eu/style.css et en réutilise
   les variables, l'en-tête capsule, le pied de page et les pastilles.
   Ne contient que ce qui est propre au panneau d'administration.
   ============================================================ */

:root {
  --a-bad: #f87171;
  --a-bad-soft: rgba(248, 113, 113, .1);
  --a-ok-soft: var(--success-bg);
  --a-warn-soft: var(--warning-bg);
}

body::after { content: none; }
[hidden] { display: none !important; }
code { padding: .1em .45em; font-size: .85em; background: var(--surface-3); border-radius: 6px; }
.muted { color: var(--text-3); font-weight: 300; }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.25rem; }

/* ── En-tête (capsule du site) ───────────────────────────── */
.site-header-top { gap: .7rem; }
.brand-sub { padding: .15rem .6rem; color: var(--text-3); font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--border-md); border-radius: var(--radius-full); }
.tabs { display: contents; }
.site-nav a { font-weight: 500; white-space: nowrap; }
.site-nav a:hover { opacity: 1; }
.nav-link { display: inline-flex; align-items: center; justify-content: center; padding: .5rem .95rem; color: var(--text-3); font: inherit; font-size: .92rem; font-weight: 500; white-space: nowrap; background: none; border: 0; border-radius: var(--radius-full); cursor: pointer; transition: color var(--transition), background var(--transition); }
.nav-link:hover { color: var(--text-1); background: var(--surface-3); }
.nav-sep { width: 1px; height: 22px; margin: 0 .3rem; background: var(--border-md); }
.tab-count { display: inline-block; min-width: 1.25rem; margin-left: .45rem; padding: 0 .35rem; color: var(--black); font-size: .68rem; font-weight: 700; line-height: 1.25rem; text-align: center; background: var(--white); border-radius: var(--radius-full); }
.site-nav a.active .tab-count { color: var(--white); background: var(--black); }
@media (max-width: 1080px) and (min-width: 769px) {
  .site-nav a, .nav-link { padding: .5rem .7rem; font-size: .86rem; }
}
@media (max-width: 768px) {
  .nav-sep { display: none; }
}

/* ── Structure ───────────────────────────────────────────── */
.shell { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 1.25rem; }
.panel-view { display: grid; gap: 1.5rem; animation: siteFadeUp .35s cubic-bezier(.22,1,.36,1) both; }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.view-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.view-head .muted { margin-top: .5rem; max-width: 56ch; font-size: .95rem; line-height: 1.6; }
.view-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.site-footer .muted { font-size: .8rem; }
.link-quiet { color: var(--text-3); font-size: .85rem; font-weight: 400; }
.link-quiet:hover { color: var(--text-1); opacity: 1; }

/* ── Cartes ──────────────────────────────────────────────── */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 1.1rem; font-weight: 600; }
.card-head .count { margin-left: .5rem; color: var(--text-3); font-size: .82rem; font-weight: 300; }
.card-tools { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.card > .list { padding: .6rem; }
.cat-name { display: flex; align-items: baseline; }
.cat-empty { padding: 1.2rem; color: var(--text-3); font-size: .9rem; font-weight: 300; text-align: center; }

/* ── Bandeau d'état ──────────────────────────────────────── */
.banner { --c: var(--text-3); display: flex; align-items: center; gap: 1.1rem; padding: 1.5rem 2rem; background: var(--surface-1); border: 1px solid color-mix(in srgb, var(--c) 30%, var(--border)); border-radius: var(--radius-xl); }
.banner[data-state="ok"] { --c: var(--success); }
.banner[data-state="maintenance"] { --c: var(--warning); }
.banner[data-state="down"] { --c: var(--a-bad); }
.banner-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 20%, transparent); }
.banner-text { display: grid; flex: 1; min-width: 0; }
.banner-text strong { font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-weight: 500; }
.banner-text .muted { font-size: .85rem; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat { padding: 1.3rem 1.5rem; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-xl); }
.stat-label { color: var(--text-3); font-size: .8rem; font-weight: 300; }
.stat-value { margin-top: .3rem; font-size: 2rem; font-weight: 700; letter-spacing: -1px; line-height: 1.1; }
.stat-value small { color: var(--text-3); font-size: 1rem; font-weight: 300; letter-spacing: 0; }
.stat-note { margin-top: .3rem; color: var(--text-3); font-size: .78rem; font-weight: 300; }
.quick { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ── Listes & lignes ─────────────────────────────────────── */
.list { display: grid; gap: .5rem; }
.list-tight { gap: 0; padding: 0 !important; }
.row { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.4rem; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color var(--transition), background var(--transition); }
.card .row { background: transparent; border-color: transparent; }
.row:hover { background: var(--surface-2); border-color: var(--border-md); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: 1.02rem; font-weight: 600; overflow-wrap: anywhere; }
.row-sub { margin-top: .2rem; color: var(--text-3); font-size: .86rem; font-weight: 300; line-height: 1.55; overflow-wrap: anywhere; }
.row-sub a { color: var(--text-2); font-weight: 400; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-md); }
.row-sub a:hover { color: var(--text-1); opacity: 1; }
.row-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.row-side { display: flex; align-items: center; gap: .4rem; flex: none; }
.row.is-done { opacity: .6; }
.empty { padding: 1.6rem 1rem; color: var(--text-3); font-size: .92rem; font-weight: 300; text-align: center; border: 1px dashed var(--border-md); border-radius: var(--radius-lg); }
.log-row { display: grid; grid-template-columns: 9.5rem 1fr; gap: .75rem; padding: .7rem 1.5rem; font-size: .86rem; border-bottom: 1px solid var(--border); }
.log-row:last-child { border-bottom: 0; }
.log-row time { color: var(--text-3); font-weight: 300; }
.log-row b { font-weight: 600; }
.log-row span { color: var(--text-2); font-weight: 300; overflow-wrap: anywhere; }
.backup-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 1.5rem; font-size: .88rem; border-bottom: 1px solid var(--border); }
.backup-row:last-child { border-bottom: 0; }
.backup-row small { color: var(--text-3); font-weight: 300; }

/* ── Pastilles ───────────────────────────────────────────── */
.dot { --c: var(--text-3); flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 20%, transparent); }
.dot[data-s="online"], .dot[data-s="up"] { --c: var(--success); }
.dot[data-s="maintenance"] { --c: var(--warning); }
.dot[data-s="offline"], .dot[data-s="down"] { --c: var(--a-bad); }
.dot[data-s="pending"] { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.tag { display: inline-flex; align-items: center; padding: .2rem .65rem; color: var(--text-2); font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; line-height: 1.3; background: rgba(255,255,255,.04); border: 1px solid var(--border-md); border-radius: var(--radius-full); white-space: nowrap; }
.tag-ok { color: var(--success); background: var(--success-bg); border-color: var(--success-border); }
.tag-warn { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.tag-bad { color: var(--a-bad); background: var(--a-bad-soft); border-color: rgba(248,113,113,.25); }
.tag-accent { color: var(--text-1); }
.latency { color: var(--text-3); font-size: .8rem; font-weight: 300; font-variant-numeric: tabular-nums; }

/* ── Formulaires ─────────────────────────────────────────── */
.field { display: grid; gap: .45rem; min-width: 0; }
.field > span:first-child, .field-label { color: var(--text-2); font-size: .85rem; font-weight: 500; }
.field-hint { color: var(--text-3); font-size: .78rem; font-weight: 300; }
.field-count { margin-left: auto; color: var(--text-3); font-size: .75rem; font-weight: 300; font-variant-numeric: tabular-nums; }
.field-top { display: flex; align-items: baseline; }
input, select, textarea { width: 100%; min-height: 44px; padding: .65rem .95rem; color: var(--text-1); font: inherit; font-size: .94rem; font-weight: 400; background: var(--black); border: 1px solid var(--border-md); border-radius: var(--radius-md); transition: border-color var(--transition), box-shadow var(--transition); }
textarea { min-height: 100px; resize: vertical; line-height: 1.55; }
select { appearance: none; padding-right: 2.2rem; cursor: pointer; background: var(--black) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .9rem center; }
select option { background: #111; color: var(--text-1); }
input::placeholder, textarea::placeholder { color: var(--text-4); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(255,255,255,.07); }
input[type="checkbox"] { width: 17px; min-height: 17px; height: 17px; padding: 0; accent-color: var(--white); cursor: pointer; }
input[type="datetime-local"] { color-scheme: dark; }
.search { width: 230px; }
.view-tools select, .card-tools select { width: auto; min-width: 8.5rem; min-height: 38px; padding-block: .35rem; font-size: .84rem; border-radius: var(--radius-full); padding-left: 1rem; }
.row-side select { width: 160px; min-height: 38px; padding-block: .35rem; font-size: .86rem; border-radius: var(--radius-full); padding-left: 1rem; }
.search { border-radius: var(--radius-full); min-height: 38px; padding-block: .35rem; }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 5.5rem; }
.input-btn { position: absolute; top: 50%; right: .5rem; transform: translateY(-50%); padding: .3rem .7rem; color: var(--text-3); font: inherit; font-size: .78rem; background: none; border: 0; border-radius: var(--radius-full); cursor: pointer; }
.input-btn:hover { color: var(--text-1); background: var(--surface-3); }
.form-error { padding: .7rem .95rem; color: var(--a-bad); font-size: .86rem; background: var(--a-bad-soft); border-radius: var(--radius-md); }
.form-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-cols .wide { grid-column: 1 / -1; }

.picker { display: grid; gap: .6rem; padding: .85rem; max-height: 280px; overflow: auto; background: var(--black); border: 1px solid var(--border-md); border-radius: var(--radius-md); }
.picker-group { display: grid; gap: .1rem; }
.picker-title { margin: .3rem 0 .2rem .4rem; color: var(--text-3); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.check { display: flex; align-items: center; gap: .65rem; padding: .45rem .55rem; font-size: .9rem; font-weight: 400; border-radius: 8px; cursor: pointer; }
.check:hover { background: var(--surface-3); }
.check-all { padding: .65rem .7rem; background: var(--surface-3); font-weight: 600; }

/* ── Boutons (pilules, comme le site) ────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1.4rem; color: var(--text-1); font: inherit; font-size: .9rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border-md); border-radius: var(--radius-full); cursor: pointer; transition: background var(--transition), border-color var(--transition), transform var(--transition), opacity var(--transition); }
.btn:hover { background: var(--surface-3); border-color: var(--border-focus); transform: translateY(-1px); opacity: 1; }
.btn:active { transform: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { color: var(--black); background: var(--white); border-color: var(--white); box-shadow: 0 6px 24px rgba(255,255,255,.1); }
.btn-primary:hover { background: var(--white); border-color: var(--white); opacity: .92; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); background: var(--surface-3); border-color: transparent; }
.btn-danger { color: var(--a-bad); background: var(--a-bad-soft); border-color: rgba(248,113,113,.25); }
.btn-danger:hover { background: rgba(248,113,113,.18); border-color: rgba(248,113,113,.4); }
.btn-sm { min-height: 36px; padding: .3rem 1rem; font-size: .82rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--text-3); font: inherit; font-size: .9rem; background: transparent; border: 0; border-radius: var(--radius-full); cursor: pointer; transition: color var(--transition), background var(--transition); }
.icon-btn:hover { color: var(--text-1); background: var(--surface-3); }
.icon-btn.danger:hover { color: var(--a-bad); background: var(--a-bad-soft); }
.icon-btn:disabled { opacity: .25; pointer-events: none; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-1); border: 1px solid var(--border-md); border-radius: var(--radius-full); }
.seg button { padding: .4rem 1rem; color: var(--text-3); font: inherit; font-size: .82rem; font-weight: 500; background: none; border: 0; border-radius: var(--radius-full); cursor: pointer; transition: color var(--transition), background var(--transition); }
.seg button:hover { color: var(--text-1); }
.seg button.on { color: var(--black); background: var(--white); }

/* ── Connexion ───────────────────────────────────────────── */
.login { display: grid; place-items: center; min-height: 50vh; }
.login-card { width: min(100%, 420px); padding: 2.5rem 2.25rem; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-2xl); box-shadow: var(--shadow-md); animation: siteFadeUp .6s cubic-bezier(.22,1,.36,1) both; }
.login-card h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.5px; }
.login-card > .muted { margin: .4rem 0 1.75rem; font-size: .95rem; }
.brand-mark { display: block; width: 38px; height: 38px; margin-bottom: 1.25rem; border-radius: 11px; background: var(--white); box-shadow: inset 0 0 0 11px var(--white), inset 0 0 0 19px var(--black); }

/* ── Dialogue ────────────────────────────────────────────── */
.dialog { width: min(100% - 2rem, 580px); max-height: calc(100vh - 2rem); margin: auto; padding: 0; color: var(--text-1); background: var(--surface-1); border: 1px solid var(--border-md); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(0, 0, 0, .75); backdrop-filter: blur(4px); }
.dialog[open] { animation: siteFadeUp .25s cubic-bezier(.22,1,.36,1) both; }
.dialog-card { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 1.15rem; font-weight: 600; }
.dialog-body { display: grid; gap: 1rem; padding: 1.5rem; overflow-y: auto; }
.dialog-body > p { color: var(--text-2); font-size: .95rem; font-weight: 300; line-height: 1.65; }
.dialog .form-error { margin: 0 1.5rem; }
.dialog-foot { display: flex; justify-content: flex-end; gap: .55rem; padding: 1rem 1.5rem 1.25rem; }

/* ── Notifications ───────────────────────────────────────── */
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 3000; display: grid; gap: .5rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast { padding: .85rem 1.1rem; font-size: .9rem; font-weight: 400; background: var(--surface-2); border: 1px solid var(--border-md); border-left: 3px solid var(--success); border-radius: var(--radius-md); box-shadow: var(--shadow-md); pointer-events: auto; animation: siteFadeUp .25s ease both; }
.toast.error { border-left-color: var(--a-bad); }
.toast.warn { border-left-color: var(--warning); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .page-main { padding-top: 110px; }
  .shell { padding-inline: 1rem; }
  .row { flex-wrap: wrap; align-items: flex-start; padding: 1.1rem; }
  .row-main { flex-basis: calc(100% - 2rem); }
  .row-side { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .row-side select { flex: 1 1 150px; width: auto; min-width: 150px; }
  .search { width: 100%; flex: 1 1 100%; }
  .view-tools { width: 100%; }
  .view-tools > select { flex: 1; }
  .card-tools { width: 100%; }
  .form-cols { grid-template-columns: minmax(0, 1fr); }
  .log-row { grid-template-columns: 1fr; gap: .1rem; padding-inline: 1.1rem; }
  .backup-row, .card-head { padding-inline: 1.1rem; }
  .banner { flex-wrap: wrap; padding: 1.25rem; }
  .stat { padding: 1.1rem; }
  .toasts { right: .75rem; left: .75rem; width: auto; }
  .dialog { width: calc(100% - 1rem); }
  .login-card { padding: 2rem 1.5rem; }
}
