/* Adelli Panel: control-room UI on the Adelli Group dark palette (see vault Brand-Colours). */
:root {
    --paper: #14151a;
    --panel: #1c1e25;
    --panel-2: #22242d;
    --ink: #f1efe9;
    --ink-soft: #b4b0a6;
    --line: #2b2e37;
    --accent: #2dd4bf;      /* Adelli Green, brightened for dark */
    --accent-deep: #5eead4;
    --green: #0f6e5c;       /* Adelli Green, true */
    --ok: #34d399;
    --err: #f87171;
    --warn: #fbbf24;
    --radius: 12px;
}
* { box-sizing: border-box; margin: 0; }
/* The hidden attribute must always win, because author display values (e.g. .grid) otherwise override it. */
[hidden] { display: none !important; }
body {
    background: var(--paper);
    color: var(--ink);
    font: 15px/1.55 Inter, -apple-system, "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .86em; }
.muted { color: var(--ink-soft); }

/* wordmark: "Adelli." with the signature green dot */
.wordmark { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; color: var(--ink); }
.wordmark .dot { color: var(--accent); }
.wordmark .sub { font-weight: 500; color: var(--ink-soft); margin-left: .45em; font-size: .82em; letter-spacing: .08em; text-transform: uppercase; }
.wordmark--lg { font-size: 1.7rem; }

.top {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.top__left { display: flex; align-items: center; gap: 26px; }
.top__right { display: flex; align-items: center; gap: 14px; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 6px 12px; border-radius: 8px; color: var(--ink-soft); font-weight: 600; font-size: .88rem; }
.topnav a:hover { color: var(--accent-deep); background: var(--panel-2); }
.topnav a.on { color: var(--accent); background: var(--panel-2); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 30px 24px 60px; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 1.5rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.page-head h2 { font-size: 1.15rem; }
.page-head--row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.backlink { display: block; margin-bottom: 12px; font-size: .88rem; }

/* live-feed pulse badge */
.pulse {
    font-size: .7rem; font-weight: 700; letter-spacing: .12em; color: var(--ok);
    border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); border-radius: 999px;
    padding: 3px 10px; background: color-mix(in srgb, var(--ok) 8%, transparent);
    display: inline-flex; align-items: center; gap: 6px;
}
.pulse::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pulse--beat::before { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.pulse--stale { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); background: color-mix(in srgb, var(--err) 8%, transparent); }
.pulse--stale::before { background: var(--err); }

/* vitals strip */
.vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 13px 16px 14px; display: flex; flex-direction: column; gap: 3px;
}
.tile--alert { border-color: color-mix(in srgb, var(--err) 45%, transparent); }
.tile__label { font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft); }
.tile__value { font-size: 1.45rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.tile__hint { font-size: .74rem; }
.meter { height: 5px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--accent); transition: width .5s ease, background .5s; }
.meter .is-ok { background: var(--ok); }
.meter .is-warn { background: var(--warn); }
.meter .is-err { background: var(--err); }

/* status dots */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot--ok { background: var(--ok); box-shadow: 0 0 6px color-mix(in srgb, var(--ok) 60%, transparent); }
.dot--err { background: var(--err); box-shadow: 0 0 6px color-mix(in srgb, var(--err) 60%, transparent); }
.dot--wait { background: var(--ink-soft); opacity: .5; animation: dotwait 1.2s ease-in-out infinite; }
/* Unknown because the probe itself is broken, not because the tenant is quiet: a still, amber dot
   rather than the waiting one, so "we cannot tell" never reads as "checking". */
.dot--fault { background: var(--warn); box-shadow: 0 0 6px color-mix(in srgb, var(--warn) 60%, transparent); }
@keyframes dotwait { 50% { opacity: .2; } }

/* view toggle */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.vt { padding: 6px 13px; font: inherit; font-size: .82rem; font-weight: 600; background: transparent; color: var(--ink-soft); border: 0; cursor: pointer; }
.vt + .vt { border-left: 1px solid var(--line); }
.vt--on { background: var(--panel-2); color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.grid--two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid--actions { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; color: var(--ink);
}
.card h3 { font-size: .95rem; margin-bottom: 8px; letter-spacing: .01em; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* instance cards */
.inst { display: block; transition: border-color .15s, transform .15s; }
.inst:hover { border-color: var(--accent); transform: translateY(-1px); color: var(--ink); }
.inst__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.inst__ident { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
/* Logos keep their aspect ratio and use the width they need (wordmarks aren't squeezed
   into a square), capped so a wide mark can't crowd the card text. */
.inst__logo { width: auto; min-width: 44px; max-width: 116px; height: 44px; border-radius: 9px; object-fit: contain; background: #fff; padding: 4px 8px; flex: none; }
.inst__logo--sm { min-width: 26px; max-width: 76px; height: 26px; border-radius: 6px; padding: 2px 5px; }
/* Logo contrast guard: white-ish artwork vanishes on the default white chip, so flip it dark.
   (Dark artwork keeps the white chip; the layout script tags each img by measured luminance.) */
.inst__logo.logo-adapt--light { background: #12141a; border: 1px solid var(--line); }
.inst__mono {
    width: 40px; height: 40px; border-radius: 9px; flex: none; display: inline-flex;
    align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 1.15rem;
}
.inst__mono--sm { width: 26px; height: 26px; border-radius: 6px; font-size: .8rem; }
.inst__flags { display: inline-flex; align-items: center; gap: 8px; padding-top: 4px; }
.inst__name { font-weight: 700; font-size: 1.05rem; display: block; line-height: 1.25; }
.inst__slug { font-size: .82rem; display: block; }
.inst__stats { display: flex; gap: 22px; margin: 14px 0 10px; }
.inst__stats .num { display: block; font-weight: 700; font-size: 1.15rem; }
.inst__stats .muted { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.inst__url { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inst__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.packrow { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 5px; }
.chip--pack { font-size: .68rem; padding: 1px 8px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); }

/* list view table */
.card--table { padding: 6px 14px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .89rem; }
.tbl th {
    text-align: left; font-size: .72rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
    color: var(--ink-soft); padding: 10px 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .shrink { width: 1%; }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: var(--panel-2); }

.chip {
    display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem;
    font-weight: 600; letter-spacing: .04em; border: 1px solid var(--line); color: var(--ink-soft);
    background: var(--panel-2);
}
.chip--live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.chip--dev { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.chip--off { color: var(--ink-soft); }
.chip--preview { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.chip--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); margin-top: 8px; }

/* forms */
.lbl { display: block; font-size: .78rem; font-weight: 600; letter-spacing: .04em; color: var(--ink-soft); margin: 10px 0 4px; text-transform: uppercase; }
.in {
    width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--panel-2); color: var(--ink); font: inherit;
}
.in:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); border-color: var(--accent); }

.btn {
    display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
    background: var(--panel-2); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn--primary { background: var(--green); border-color: var(--green); color: #f1fdf9; }
.btn--primary:hover { background: #0c5a4b; color: #fff; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); padding: 6px 12px; }
.btn--sm { padding: 5px 12px; font-size: .82rem; }
.btn--danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.btn--danger:hover { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); border-color: var(--err); }

/* backups */
.dlink { font-weight: 600; }
.restoreform { display: inline-flex; gap: 7px; align-items: center; margin: 0; }
.in--slim { width: 130px; padding: 5px 9px; font-size: .82rem; }

.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-size: .92rem; }
.alert--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.alert--err { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); background: color-mix(in srgb, var(--err) 8%, transparent); }
/* Amber: not broken now, but something is failing quietly (a partial backup, a dead collector). */
.alert--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }

.out {
    background: #0e0f13; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
    color: var(--ink-soft); font-family: ui-monospace, Consolas, monospace; font-size: .8rem;
    white-space: pre-wrap; word-break: break-word; margin-bottom: 16px; max-height: 320px; overflow: auto;
}

/* tables */
.facts { width: 100%; border-collapse: collapse; font-size: .9rem; }
.facts td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.facts tr:last-child td { border-bottom: 0; }
.mods { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mods td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); }
.mods tr:last-child td { border-bottom: 0; }
.mods__state { text-align: right; }
.mods__act { text-align: right; width: 90px; }
.mods form { margin: 0; display: inline; }

/* pack matrix */
.packlist { display: flex; flex-direction: column; gap: 9px; }
.pack {
    padding: 11px 13px; border: 1px solid var(--line);
    border-radius: 10px; transition: border-color .15s; background: var(--panel-2);
}
.pack:hover { border-color: var(--accent); }
.pack--locked { opacity: .75; }
.pack__head { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.pack--locked .pack__head { cursor: default; }
.pack__head > input { margin-top: 4px; accent-color: var(--green); width: 15px; height: 15px; flex: none; }
.pack__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pack__name { font-weight: 700; font-size: .93rem; display: flex; align-items: center; gap: 8px; }
.pack__desc { font-size: .82rem; line-height: 1.45; }
.pack__mods { font-size: .72rem; }
.pack__rec { font-size: .78rem; color: var(--warn); }
.pack:has(input[name="packs[]"]:checked):not(.pack--locked) { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* per-module sub-items inside a pack */
.pack__subs {
    display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px 27px;
    padding-top: 10px; border-top: 1px dashed var(--line); transition: opacity .15s;
}
.pack:has(input[name="packs[]"]:not(:checked)) .pack__subs { opacity: .45; }
.sub {
    display: inline-flex; gap: 6px; align-items: center; font-size: .8rem; font-weight: 600;
    padding: 3px 10px 3px 8px; border: 1px solid var(--line); border-radius: 999px;
    cursor: pointer; color: var(--ink-soft); background: var(--panel);
}
.sub input { accent-color: var(--green); margin: 0; width: 13px; height: 13px; }
.sub:has(input:checked) { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.sub--locked { opacity: .65; cursor: default; padding-left: 10px; }
.pack__excluded { font-size: .78rem; color: var(--warn); }

/* sparklines */
.sparkrow { margin-bottom: 14px; }
.sparkrow:last-child { margin-bottom: 0; }
.sparkhead { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; margin-bottom: 4px; }
.spark { width: 100%; height: 56px; color: var(--accent); display: block; }

/* side-by-side fields */
.fieldrow { display: flex; gap: 12px; }
.fieldrow > span { flex: 1; min-width: 0; }
textarea.in { resize: vertical; }

/* audit table */
.tbl--audit td { white-space: normal; word-break: break-word; }

/* onboarding wizard */
.card--wizard { max-width: 640px; }
.steps { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.stepdot {
    font-size: .74rem; font-weight: 600; letter-spacing: .03em; padding: 4px 11px;
    border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: var(--panel);
}
.stepdot--on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.stepdot--done { color: var(--ok); }
.step { border: 0; padding: 0; margin: 0; }
.step h3 { margin-bottom: 10px; }
.wizanav { display: flex; justify-content: space-between; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.dnsline { font-size: .84rem; margin-top: 6px; }
.dnsline--ok { color: var(--ok); }
.dnsline--bad { color: var(--err); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login__card { width: 360px; padding: 30px 28px; }

@media (max-width: 640px) {
    .wrap { padding: 20px 14px 50px; }
    .top { padding: 12px 16px; }
}

/* Restore log tail on the backups page: a restore runs detached, so this is the only outcome. */
.restorelog { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.restorelog summary { cursor: pointer; font-size: .84rem; font-weight: 600; }
.restorelog .out { margin-top: 8px; max-height: 260px; }

/* A module's sub-features sit under it in the override table, indented and quieter. */
.mods__feature td { padding-top: 4px; padding-bottom: 4px; font-size: .92em; }
.mods__feature td:first-child .mono { padding-left: 16px; }

/*
 * A module's per-tenant SETTINGS sit under its features, one row and one small form each: the
 * value is a decision somebody made for this customer, so it is saved on its own and audited on
 * its own. The feature rows' "hide its records" tick sits beside their Disable button for the
 * same reason the platform's own Module Manager puts it there: it is part of what disabling means.
 */
.mods__setting td { padding-top: 4px; padding-bottom: 4px; font-size: .92em; }
.mods__setting td:first-child .mono { padding-left: 16px; }
/* Scoped under .mods on purpose: `.mods form { display: inline }` is more specific than a bare
   .setform and would quietly beat it, collapsing the row back into a run of inline controls. */
.mods .setform { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin: 0; }
.mods__setting .in--slim { width: 118px; }
.mods__setting select.in--slim { width: auto; max-width: 180px; }
/* A number fits in 118px; free text does not. The only text setting declared today is a privacy
   notice URL, and at 118px an operator can neither read back what is stored nor see the end of
   what they are pasting. Wider, and allowed to shrink on a narrow screen. */
.mods__setting input[type="text"].in--slim { width: 240px; max-width: 100%; }
/* A feature's Disable form carries a tick as well as a button now, so the cell lays them out
   instead of leaving them jammed together by `.mods form { display: inline }`. */
.mods__feature .mods__act form { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.hidechk {
    display: inline-flex; gap: 5px; align-items: center; font-size: .8rem;
    color: var(--ink-soft); cursor: pointer; white-space: nowrap;
}
.hidechk input { accent-color: var(--green); margin: 0; width: 13px; height: 13px; }
