/* Kaj: a quiet, purposeful home for your hosting. */
:root {
    --bg: #f5f6f3;
    --panel: #fff;
    --text: #203537;
    --text-2: #3c5051;
    --text-3: #536564;
    --muted: #62716e;
    --faint: #687570;
    --border: #e0e6e1;
    --border-strong: #cbd5ce;
    --row-border: #edf0eb;
    --subtle: #fafbf9;
    --hover: #eff3ee;
    --primary: #177365;
    --primary-hover: #105b50;
    --primary-soft: #eaf4ee;
    --sidebar: #192e30;
    --sidebar-text: #becdca;
    --sidebar-muted: #91aaa5;
    --sidebar-line: #314648;
    --mint: #c7eed5;
    --danger: #b42318;
    --danger-hover: #912018;
    --danger-line: #f04438;
    --ok-bg: #eaf4ec;
    --ok-fg: #287044;
    --err-bg: #fdecec;
    --err-fg: #9b1c1c;
    --warn-bg: #fff4d6;
    --warn-fg: #5c4400;
    --warn-line: #f3e2a9;
    --mute-bg: #f0f3ef;
    --radius: 8px;
    --radius-card: 12px;
    --shadow-card: 0 2px 3px rgba(25, 46, 30, .025);
    --shadow-pop: 0 20px 60px rgba(16, 35, 30, .18);
    --scrim: rgba(15, 32, 30, .4);
    --mono: ui-monospace, "SF Mono", Menlo, monospace;
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, pre { font-family: var(--mono); font-size: 12.5px; }
input, select, textarea, button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 600; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.sidebar :focus-visible { outline-color: var(--mint); }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 60; padding: 10px 16px; background: var(--panel); border-radius: var(--radius); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
::selection { background: #c7eed5; color: #192e30; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.break-all { word-break: break-all; }
.anywhere { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 244px;
    flex: none;
    background: var(--sidebar);
    color: var(--sidebar-text);
    border-right: 1px solid var(--sidebar-line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 15;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 32px 24px 26px; }
.brand-link { display: flex; align-items: center; gap: 12px; color: #f0f5ef; }
.brand-link:hover { text-decoration: none; }
.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px 12px 12px 3px;
    background: var(--mint);
    color: var(--sidebar);
    display: inline-grid;
    place-items: center;
    font-weight: 700;
    font-size: 29px;
    letter-spacing: -.08em;
    padding-right: 3px;
    line-height: 1;
    flex: none;
}
.brand-name { display: block; font-weight: 650; font-size: 25px; letter-spacing: -.05em; line-height: 1.1; }
.brand-caption { display: block; margin-top: 5px; font-size: 10px; color: var(--sidebar-muted); letter-spacing: .02em; }
.brand-host { margin-left: auto; font-size: 11px; color: var(--muted); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-context { display: flex; align-items: center; gap: 10px; margin: 0 18px 14px; padding: 12px; border: 1px solid var(--sidebar-line); border-radius: var(--radius); color: var(--sidebar-muted); font-size: 12px; }
.server-context .icon { width: 17px; height: 17px; }
.server-context span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 4px; padding: 0 14px 20px; flex: 1; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--sidebar-line) transparent; }
.nav-group { font-size: 10px; font-weight: 600; color: var(--sidebar-muted); text-transform: uppercase; letter-spacing: .12em; padding: 20px 12px 8px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    min-height: 42px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-weight: 450;
    font-size: 13px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: #263f40; color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--mint); color: var(--sidebar); font-weight: 650; }
.nav-item .icon { width: 18px; height: 18px; opacity: .85; }
.nav-label { flex: 1; min-width: 0; }
.nav-count { font-size: 11px; color: var(--sidebar-text); background: #2a4142; min-width: 22px; text-align: center; border-radius: 5px; padding: 1px 5px; font-variant-numeric: tabular-nums; font-weight: 500; }
.is-active .nav-count { background: #afd8be; color: var(--sidebar); }

.sidebar-foot { border-top: 1px solid var(--sidebar-line); padding: 20px; display: flex; align-items: center; gap: 10px; margin: 0; }
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: #314a49;
    color: var(--mint);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 13px;
    flex: none;
}
.avatar:hover { text-decoration: none; }
.me { flex: 1; min-width: 0; color: #eff5ef; display: flex; flex-direction: column; }
.me:hover { text-decoration: none; }
.me:hover .me-name { color: var(--mint); }
.me-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 11px; color: var(--sidebar-muted); margin-top: 2px; }
.sidebar .logout { color: var(--sidebar-muted); padding: 10px; border-radius: var(--radius); }
.sidebar .logout:hover { color: #fff; background: #263f40; }
.logout .icon { width: 18px; height: 18px; }

.topbar, .nav-scrim { display: none; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.impersonating {
    margin: 0;
    background: var(--warn-bg);
    color: var(--warn-fg);
    padding: 8px 24px;
    font-size: 13px;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--warn-line);
}
.impersonating .btn-link { color: var(--warn-fg); text-decoration: underline; }
.imp-who { color: #7a6420; }
.main { padding: 42px 40px 64px; max-width: 1400px; width: 100%; margin: 0 auto; }
.main:focus { outline: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.page-title { flex: 1; min-width: 240px; }
.crumb { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.crumb-separator { color: #a4b0a9; }
.crumb a { color: var(--muted); }
.page-head h1 { font-size: 32px; font-weight: 600; letter-spacing: -.04em; line-height: 1.25; overflow-wrap: anywhere; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 code { font-size: 20px; }
.sub { margin: 10px 0 0; color: var(--muted); max-width: 680px; text-wrap: pretty; font-size: 13px; }
.account-email { display: inline-block; padding-left: 12px; margin-left: 8px; border-left: 1px solid var(--border-strong); overflow-wrap: anywhere; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-actions form { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid var(--border-strong);
    background: var(--panel);
    color: var(--text);
    border-radius: var(--radius);
    font-weight: 550;
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(25, 46, 30, .04);
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--hover); border-color: #aebdb4; text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn.is-danger { color: var(--danger); }
.btn .plus { font-size: 16px; line-height: 1; }
.btn-add { padding: 5px 12px; font-size: 13px; }
.btn-sm {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text-2);
    border-radius: var(--radius);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.45;
}
.btn-sm:hover { background: var(--hover); border-color: var(--border-strong); text-decoration: none; }
.btn-sm.is-danger { color: var(--danger); }
.btn-link { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; font-weight: 400; }
.btn-link:hover { text-decoration: underline; }
.btn-link.is-danger { color: var(--danger); }
button:disabled { opacity: .55; cursor: default; }
form.inline { display: inline; margin: 0; }

/* ---------- Cards ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); min-width: 0; }
.card-pad { padding: 20px; }
.card-pad-lg { padding: 24px; }
.card.tcard { overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; min-height: 64px; }
.card-head form { margin: 0; }
.card-title { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.015em; }
.card-title > .icon { width: 18px; height: 18px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-note { font-size: 12px; color: var(--muted); }
.count-pill { font-size: 11px; color: var(--muted); background: var(--mute-bg); border: 1px solid var(--border); border-radius: 6px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.text-action { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 550; }
.text-action .icon { width: 16px; height: 16px; }
.filter {
    width: 220px;
    max-width: 100%;
    padding: 5px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--panel);
}
.filter:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.card-body { padding: 22px; }
.card-body > * + * { margin-top: 14px; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--subtle); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-label { font-size: 12px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }

.stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cols-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tile { padding: 14px 16px; }
.tile-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.tile-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.tile-action { margin-top: 8px; font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tile-action form { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tile-action select { width: auto; margin: 0; padding: 3px 6px; font-size: 13px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: 12px 22px;
    font-size: 11px;
    font-weight: 550;
    color: var(--muted);
    background: var(--subtle);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 15px 22px; font-size: 13px; white-space: normal; border-bottom: 1px solid var(--row-border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--subtle); }
.table tbody tr.empty-row:hover, .table tbody tr.nomatch:hover { background: none; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.actions { text-align: right; }
.table td.top { vertical-align: top; }
.table tr.is-dim, .table tr.is-deleting { opacity: .55; }
.table tr.is-editing td { background: var(--primary-soft); }
.empty-row td, .nomatch td { padding: 36px 16px; text-align: center; color: var(--muted); }
.cell-link { font-weight: 500; }
.account-link { display: inline-flex; gap: 12px; align-items: center; color: var(--text); }
.account-link:hover { color: var(--primary); text-decoration: none; }
.account-monogram { display: grid; place-items: center; width: 34px; height: 34px; background: var(--primary-soft); border: 1px solid #dcebe0; border-radius: 10px; font-weight: 600; color: var(--primary); flex: none; }
.table tr:nth-child(3n + 2) .account-monogram { background: #f3eee5; border-color: #ece3d3; color: #8a6b34; }
.table tr:nth-child(3n) .account-monogram { background: #ebeff7; border-color: #e0e6ef; color: #566b8c; }
.cell-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cell-mono { display: block; min-width: 200px; word-break: break-all; color: var(--text-2); }
.cell-mono + .cell-mono { margin-top: 2px; }
.code-strong { color: var(--text); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; align-items: center; }
.locked { font-size: 12px; color: var(--faint); padding: 4px 0; }
.tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    font-family: var(--mono);
}
.table.kv-table th { width: 160px; background: none; vertical-align: top; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 550;
    letter-spacing: normal;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.45;
    max-width: 100%;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.b-ok { background: var(--ok-bg); color: var(--ok-fg); }
.b-err { background: var(--err-bg); color: var(--err-fg); }
.b-run { background: var(--primary-soft); color: var(--primary); }
.b-mute { background: var(--mute-bg); color: var(--muted); }
.badge.job-failed { white-space: normal; border-radius: 10px; align-items: baseline; overflow-wrap: anywhere; }
.badge-sub { font-size: 12px; color: var(--muted); margin-left: 6px; }
.error-text {
    margin: 0;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--err-bg);
    color: var(--err-fg);
    font-family: var(--mono);
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ---------- Switch ---------- */
.switch {
    width: 34px;
    height: 20px;
    border-radius: 999px;
    border: 0;
    padding: 2px;
    background: var(--border-strong);
    cursor: pointer;
    display: flex;
    justify-content: flex-start;
    flex: none;
}
.switch::after { content: ""; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .2); }
.switch.is-on { background: var(--primary); justify-content: flex-end; }
.switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: 16px; margin: 0; min-width: 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; align-items: start; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.form-inline > label { flex: 1 1 220px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not(.filter), select, textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    font-size: 14px;
    font-weight: 400;
}
input.filter { display: inline-block; width: 220px; margin: 0; padding: 7px 12px; font-size: 12px; color: var(--text); font-weight: 400; background: var(--subtle); }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
input.mono, textarea.mono { font-family: var(--mono); font-size: 13px; }
label:has(.field-error) input, label:has(.field-error) select, label:has(.field-error) textarea { border-color: var(--danger-line); }
.help { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); font-weight: 400; }
.field-error { display: block; margin-top: 5px; font-size: 12px; color: var(--danger); font-weight: 400; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 400; color: var(--text); }
label.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); flex: none; }
.affix { display: flex; align-items: center; margin-top: 6px; }
.affix input:not([type="checkbox"]) { margin-top: 0; border-radius: 0; min-width: 0; }
.affix input:first-child { border-top-left-radius: var(--radius); border-bottom-left-radius: var(--radius); }
.affix input:last-child { border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.affix-text {
    padding: 8px 10px;
    background: var(--subtle);
    border: 1px solid var(--border-strong);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 400;
    white-space: nowrap;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.affix-text:first-child { border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.affix-text:last-child { border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; }
fieldset { margin: 0; padding: 14px 16px 16px; border: 1px solid var(--border); border-radius: var(--radius-card); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
details.hints { font-size: 13px; color: var(--muted); }
details.hints summary { cursor: pointer; color: var(--primary); width: max-content; }
details.hints dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 10px 0 0; }
details.hints dt { font-weight: 600; color: var(--text-2); }
details.hints dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Flash ---------- */
.flash { padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius); overflow-wrap: anywhere; }
.flash-ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash-error { background: var(--err-bg); color: var(--err-fg); }
.flash-warn { background: var(--warn-bg); color: var(--warn-fg); }
.card .flash:last-child, .drawer-body .flash { margin-bottom: 0; }

/* ---------- Key / value ---------- */
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.kv code { word-break: break-all; }

/* ---------- Empty state ---------- */
.empty-box { border: 1px dashed var(--border-strong); border-radius: var(--radius-card); padding: 36px 24px; text-align: center; background: var(--panel); }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -.02em; }
.empty-text { color: var(--muted); font-size: 13px; margin: 6px 0 18px; }
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 38px 20px; text-align: center; }
.empty-row .empty-state { padding: 8px 0; }
.empty-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px; border: 1px solid #dcebe0; border-radius: 14px; background: var(--primary-soft); color: var(--primary); flex: none; }
.empty-icon .icon { width: 22px; height: 22px; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat { display: flex; flex-direction: column; text-align: left; padding: 19px 20px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); color: var(--text); min-width: 0; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: #9fc4b0; box-shadow: 0 4px 16px rgba(25, 46, 30, .06); text-decoration: none; }
.stat-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.stat-top .icon { width: 17px; height: 17px; color: #789186; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-value { display: flex; align-items: center; gap: 8px; min-height: 52px; font-size: 34px; line-height: 1.2; font-weight: 550; letter-spacing: -.045em; margin: 10px 0 9px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-value.is-text { font-size: 20px; letter-spacing: -.025em; }
.stat-value.is-unavailable { color: #9aa79f; font-weight: 400; }
.service-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); flex: none; }
.stat-note { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--muted); margin-top: auto; overflow-wrap: anywhere; }
.stat-note .icon { width: 14px; height: 14px; color: #91a397; }
a.stat:hover .stat-note .icon { color: var(--primary); }
.dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.job-row { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--row-border); }
.activity-empty { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 32px 22px; }
.activity-empty .empty-icon, .activity-empty .empty-text { margin-bottom: 0; }
.job-row:last-child { border-bottom: 0; }
.job-label { flex: 1 1 140px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row .badge { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.job-row .badge span { overflow: hidden; text-overflow: ellipsis; }
.job-when { font-size: 12px; color: var(--faint); flex: none; white-space: nowrap; }
.attention { padding: 22px; display: flex; flex-direction: column; gap: 22px; }
.attn-clear { padding: 18px 16px; background: #f1f7f0; border: 1px solid #e0ecdf; border-radius: 9px; }
.health-icon { display: grid; place-items: center; width: 28px; height: 28px; color: var(--ok-fg); flex: none; }
.attn-clear .attn-title { color: var(--ok-fg); margin-bottom: 5px; }
.attn-clear .attn-body { font-size: 12px; line-height: 1.65; }
.attn { display: flex; gap: 10px; align-items: flex-start; }
.attn-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--faint); }
.attn-dot.is-red { background: #d92d20; }
.attn-dot.is-orange { background: #f79009; }
.attn-main { flex: 1; min-width: 0; }
.attn-title { font-weight: 500; overflow-wrap: anywhere; }
.attn-body { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.attn a.attn-go { font-size: 13px; flex: none; }

/* ---------- DNS ---------- */
.zone-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: -4px 0 20px; }
.zone-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-btn {
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--panel);
    color: var(--text-2);
    font-weight: 600;
    font-size: 13px;
}
.pill-btn:hover { text-decoration: none; background: #f9fafb; }
.pill-btn.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.ns-list { display: flex; gap: 6px 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -6px 0 20px; overflow-x: auto; overflow-y: hidden; }
.tab { padding: 8px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Drawer ---------- */
.drawer { display: none; position: fixed; inset: 0; z-index: 20; }
.drawer.is-open, html:not(.js) .drawer:target { display: block; }
.drawer-overlay { position: absolute; inset: 0; background: var(--scrim); }
.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 460px;
    max-width: 100vw;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 32px rgba(16, 24, 40, .12);
    margin: 0;
}
.drawer.is-open .drawer-panel { animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(32px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 26px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.drawer-heading { flex: 1; min-width: 0; }
.drawer-title { font-weight: 600; font-size: 22px; letter-spacing: -.03em; }
.drawer-hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.drawer-x { font-size: 20px; line-height: 1; color: var(--muted); padding: 4px 8px; border-radius: var(--radius); }
.drawer-x:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.drawer-body { flex: 1; overflow: auto; padding: 26px; display: flex; flex-direction: column; gap: 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--subtle); }
body.has-overlay { overflow: hidden; }

/* ---------- Confirm modal ---------- */
.modal { position: fixed; inset: 0; background: var(--scrim); z-index: 30; display: grid; grid-template-columns: minmax(0, 420px); justify-content: center; align-content: center; padding: 20px; }
.modal-box { width: 100%; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow-pop); overflow: hidden; }
.modal-main { padding: 20px 22px; }
.modal-title { font-weight: 650; font-size: 16px; overflow-wrap: anywhere; }
.modal-body { margin: 8px 0 0; color: var(--text-3); text-wrap: pretty; overflow-wrap: anywhere; }
.modal-foot { padding: 14px 22px; display: flex; gap: 8px; justify-content: flex-end; background: var(--subtle); border-top: 1px solid var(--border); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; max-width: calc(100vw - 40px); }
.toast {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 8px 10px 14px;
    background: var(--text);
    color: #fff;
    border-radius: var(--radius-card);
    box-shadow: 0 8px 24px rgba(16, 24, 40, .2);
    font-size: 13px;
    max-width: 480px;
    transition: opacity .3s, transform .3s;
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); }
.toast-text { min-width: 0; overflow-wrap: anywhere; }
.toast .badge { flex: 0 1 auto; }
.toast-x { border: 0; background: none; color: #98a2b3; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; }
.toast-x:hover { color: #fff; }

/* ---------- Auth pages ---------- */
body.bare { background: var(--sidebar); }
body.bare .auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; background-image: radial-gradient(ellipse at 50% 0, #304d46 0, transparent 65%); }
body.bare .auth-wrap > .flash { width: 420px; max-width: 100%; }
.auth-card { width: 420px; max-width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 36px; box-shadow: 0 24px 60px rgba(0, 15, 10, .2); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 38px; }
.auth-brand .brand-name { font-size: 29px; }
.auth-brand .brand-host { padding: 4px 8px; background: var(--subtle); border: 1px solid var(--border); border-radius: 5px; }
.auth-eyebrow { font-size: 12px; color: var(--primary); font-weight: 500; margin-bottom: 8px; }
.auth-title { font-size: 30px; font-weight: 600; letter-spacing: -.04em; line-height: 1.25; margin-bottom: 8px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 28px; }
.auth-card .form-stack { gap: 20px; }
.auth-card .btn { width: 100%; margin-top: 4px; justify-content: space-between; padding: 12px 16px; }
.auth-foot { margin-top: 24px; font-size: 12px; text-align: center; color: var(--sidebar-muted); }
.error-code { font-size: 44px; font-weight: 700; letter-spacing: -.02em; color: var(--faint); line-height: 1; margin-bottom: 8px; }

/* ---------- Misc ---------- */
.qr { width: 220px; height: 220px; max-width: 100%; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.qr svg { display: block; width: 100%; height: 100%; }
ul.codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 28px; padding: 0; margin: 0; list-style: none; }
ul.codes code { font-size: 16px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 3px 0; }
ul.bullets { margin: 0; padding-left: 20px; }
ul.bullets li + li { margin-top: 6px; }
pre.example { margin: 0; padding: 12px 14px; overflow-x: auto; background: var(--subtle); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12.5px; }
.method { display: inline-block; min-width: 56px; font-weight: 600; color: var(--primary); }
.secret { font-size: 15px; padding: 2px 6px; background: var(--warn-bg); border-radius: 4px; word-break: break-all; }
.link-list { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }

/* ---------- Narrow screens ---------- */
@media (min-width: 801px) and (max-width: 1200px) {
    .main { padding: 32px 26px 56px; }
    .sidebar { width: 224px; }
    .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .stat { grid-column: span 2; }
    .stat:nth-last-child(-n + 2) { grid-column: span 3; }
}
@media (max-width: 1000px) {
    .cols, .cols-main, .dash { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 800px) {
    .shell { flex-direction: column; }
    .topbar {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 16px;
        background: var(--sidebar);
        border-bottom: 1px solid var(--sidebar-line);
        position: sticky;
        top: 0;
        z-index: 14;
    }
    .brand-mini { display: flex; align-items: center; gap: 10px; color: #eff5ef; font-weight: 650; font-size: 23px; letter-spacing: -.04em; }
    .brand-mini .brand-mark { width: 30px; height: 30px; font-size: 23px; border-radius: 9px 9px 9px 3px; }
    .brand-mini:hover { text-decoration: none; }
    .topbar .brand-host { margin-left: auto; color: var(--sidebar-text); }
    .nav-toggle { display: none; width: 40px; height: 40px; border: 1px solid var(--sidebar-line); border-radius: var(--radius); background: transparent; cursor: pointer; padding: 0; position: relative; }
    .nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
        position: absolute;
        left: 12px;
        width: 14px;
        height: 2px;
        border-radius: 1px;
        background: var(--sidebar-text);
        content: "";
    }
    .nav-toggle span { top: 18px; }
    .nav-toggle span::before { left: 0; top: -5px; }
    .nav-toggle span::after { left: 0; top: 5px; }
    /* Without JavaScript the sidebar simply sits above the content. */
    .sidebar { position: static; width: auto; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar .brand { display: none; }
    html.js .nav-toggle { display: block; }
    html.js .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 260px;
        max-width: 85vw;
        height: auto;
        border-right: 1px solid var(--sidebar-line);
        transform: translateX(-100%);
        transition: transform .2s ease-out;
        z-index: 25;
    }
    html.js .sidebar .brand { display: flex; }
    html.js body.nav-open .sidebar { transform: none; box-shadow: 12px 0 32px rgba(16, 24, 40, .12); }
    html.js body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 24; }
    .main { padding: 28px 22px 48px; }
    .impersonating { padding: 8px 16px; }
    .page-head { margin-bottom: 24px; gap: 18px; }
    .page-title { min-width: 0; flex-basis: 100%; }
    .page-head h1 { font-size: 28px; }
    .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .stat { grid-column: span 2; }
    .stat:nth-last-child(-n + 2) { grid-column: span 3; }
    .drawer-panel { width: 100vw; }
    .filter, input.filter { width: 100%; flex: 1 1 160px; }
    .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; align-items: stretch; }
    .toast { max-width: none; }
}

@media (max-width: 560px) {
    .main { padding: 26px 16px 40px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat, .stat:nth-last-child(-n + 2) { grid-column: span 1; padding: 16px; }
    .stat:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
    .stat:last-child .stat-top .icon { display: none; }
    .stat:last-child .stat-value { grid-column: 2; grid-row: 1 / 3; min-height: 0; margin: 0; }
    .stat:last-child .stat-note { grid-column: 1; }
    .stat:last-child .stat-note .icon { display: none; }
    .stat-value { font-size: 30px; min-height: 40px; }
    .stat-value.is-text { font-size: 18px; }
    .account-email { display: block; border-left: 0; margin: 3px 0 0; padding: 0; }
    .table { min-width: 560px; }
    .table.kv-table { min-width: 0; }
    .table.kv-table th { width: 110px; }
    .empty-row:only-child td { white-space: normal; }
    .table:has(.empty-row:only-child) { min-width: 0; }
    .job-row { gap: 8px; padding: 14px 16px; flex-wrap: wrap; }
    .job-label { flex-basis: 100%; }
    .job-when { margin-left: auto; }
    .auth-card { padding: 28px; }
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not(.filter), select, textarea, input.filter { font-size: 16px; }
    .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .kv dd + dt { margin-top: 8px; }
    .card-head { padding: 16px; }
    .table th, .table td { padding-left: 12px; padding-right: 12px; }
    ul.codes { grid-template-columns: max-content; }
}

@media (prefers-reduced-motion: reduce) {
    .drawer.is-open .drawer-panel { animation: none; }
    html.js .sidebar, .toast, .nav-item, .btn, .stat { transition: none; }
}
.card-split { border-top: 1px solid var(--border); }
.kv dt { overflow-wrap: anywhere; }
.valkey { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.valkey-main > * + * { margin-top: 6px; }
.valkey-sock { display: inline-block; color: var(--text-2); word-break: break-all; }
.valkey form { margin: 0; }
@media (max-width: 560px) { .valkey { grid-template-columns: minmax(0, 1fr); } }
.attn-dot.is-green { background: #12b76a; }

/* ---------- Account context (sidebar) ---------- */
.nav-back { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.nav-back:hover { color: var(--primary); text-decoration: none; }
.nav-account { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; padding: 12px; border: 1px solid var(--sidebar-line); border-radius: var(--radius); background: #20383a; color: #e6eee7; }
.nav-account:hover { text-decoration: none; border-color: #638178; }
.nav-account-avatar { width: 30px; height: 30px; border-radius: 8px; background: #314a49; color: var(--mint); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.nav-account-main { display: flex; flex-direction: column; min-width: 0; }
.nav-account-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-account-role { font-size: 11px; color: var(--sidebar-muted); }

/* ---------- Site and domain sections ---------- */
.tabs.section-tabs { margin-top: -8px; }
.mini-list { margin: 0; padding: 0; list-style: none; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--row-border); flex-wrap: wrap; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.php-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; }
.locked-note { font-size: 12px; color: var(--warn-fg); background: var(--warn-bg); border-radius: 4px; padding: 1px 6px; margin-left: 6px; font-weight: 500; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pick { display: block; padding: 14px 16px; color: var(--text); }
.pick:hover { text-decoration: none; border-color: var(--border-strong); background: var(--subtle); }
.pick-title { font-weight: 600; overflow-wrap: anywhere; }
.pick-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
