/* CN Host Panel — themes: cn-blue, terminal, neon, paper × light / dark / system */

:root, [data-theme="cn-blue"] {
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #f8fafc; --border: #e3e8ef; --border-strong: #cbd5e1;
  --text: #0f172a; --muted: #5b6b82; --accent: #2457d6; --accent-text: #ffffff; --accent-soft: #e8efff;
  --ok: #15803d; --ok-soft: #e7f6ec; --warn: #b45309; --warn-soft: #fdf3e2; --bad: #c0262d; --bad-soft: #fdecec;
  --sidebar: #0f1b33; --sidebar-text: #c7d2e5; --sidebar-muted: #7f8ea8; --sidebar-active: #1d2d4f; --sidebar-accent: #7aa2ff;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: var(--font); --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
}
[data-theme="cn-blue"][data-mode="dark"] {
  --bg: #0b1220; --surface: #111a2c; --surface-2: #0e1626; --border: #1f2b42; --border-strong: #2c3b58;
  --text: #e6ebf3; --muted: #93a1b8; --accent: #6d9bff; --accent-text: #0b1220; --accent-soft: #18264a;
  --ok: #4ade80; --ok-soft: #0f2a1b; --warn: #fbbf24; --warn-soft: #2d2410; --bad: #f87171; --bad-soft: #321417;
  --sidebar: #070d18; --sidebar-text: #c7d2e5; --sidebar-muted: #6f7f9a; --sidebar-active: #15213a; --sidebar-accent: #7aa2ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  [data-theme="cn-blue"][data-mode="system"] {
    --bg: #0b1220; --surface: #111a2c; --surface-2: #0e1626; --border: #1f2b42; --border-strong: #2c3b58;
    --text: #e6ebf3; --muted: #93a1b8; --accent: #6d9bff; --accent-text: #0b1220; --accent-soft: #18264a;
    --ok: #4ade80; --ok-soft: #0f2a1b; --warn: #fbbf24; --warn-soft: #2d2410; --bad: #f87171; --bad-soft: #321417;
    --sidebar: #070d18; --sidebar-active: #15213a; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

[data-theme="terminal"] {
  --bg: #eef3ec; --surface: #fbfdf9; --surface-2: #f3f8f1; --border: #d3dfcf; --border-strong: #b5c7af;
  --text: #102010; --muted: #4d6a4c; --accent: #16803c; --accent-text: #ffffff; --accent-soft: #dcefdf;
  --ok: #16803c; --ok-soft: #dcefdf; --warn: #946200; --warn-soft: #f6edd2; --bad: #b42318; --bad-soft: #f9e3e0;
  --sidebar: #0c140c; --sidebar-text: #b7e4b9; --sidebar-muted: #5f8a61; --sidebar-active: #142414; --sidebar-accent: #4ade80;
  --font: var(--mono); --font-head: var(--mono); --radius: 4px;
}
[data-theme="terminal"][data-mode="dark"] {
  --bg: #050a05; --surface: #0b130b; --surface-2: #081008; --border: #1a2e1a; --border-strong: #264526;
  --text: #c6f6c9; --muted: #6fa673; --accent: #39d353; --accent-text: #041004; --accent-soft: #0f2a12;
  --ok: #39d353; --ok-soft: #0f2a12; --warn: #e3b341; --warn-soft: #2a220c; --bad: #ff6b5e; --bad-soft: #2d0f0c;
  --sidebar: #020502; --sidebar-active: #0f1f0f; --shadow: none;
}
@media (prefers-color-scheme: dark) {
  [data-theme="terminal"][data-mode="system"] {
    --bg: #050a05; --surface: #0b130b; --surface-2: #081008; --border: #1a2e1a; --border-strong: #264526;
    --text: #c6f6c9; --muted: #6fa673; --accent: #39d353; --accent-text: #041004; --accent-soft: #0f2a12;
    --ok: #39d353; --ok-soft: #0f2a12; --warn: #e3b341; --warn-soft: #2a220c; --bad: #ff6b5e; --bad-soft: #2d0f0c;
    --sidebar: #020502; --sidebar-active: #0f1f0f; --shadow: none;
  }
}

[data-theme="neon"] {
  --bg: #f8f3ff; --surface: #ffffff; --surface-2: #fbf8ff; --border: #eadff9; --border-strong: #d5c2f2;
  --text: #1d0b3a; --muted: #6d5a8c; --accent: #c2189b; --accent-text: #ffffff; --accent-soft: #fbe3f4;
  --ok: #0f8a6a; --ok-soft: #defaf1; --warn: #b45309; --warn-soft: #fdf1df; --bad: #d01d4a; --bad-soft: #fde4ea;
  --sidebar: #12052b; --sidebar-text: #e2d4ff; --sidebar-muted: #9580c2; --sidebar-active: #241048; --sidebar-accent: #ff5fd2;
}
[data-theme="neon"][data-mode="dark"] {
  --bg: #0a0418; --surface: #140a2b; --surface-2: #10071f; --border: #2a1752; --border-strong: #3d2272;
  --text: #f1e9ff; --muted: #a894d4; --accent: #ff4fd8; --accent-text: #12001a; --accent-soft: #2e0f3f;
  --ok: #2ef2c0; --ok-soft: #0b2b29; --warn: #ffd166; --warn-soft: #2e2510; --bad: #ff5c8a; --bad-soft: #330d1d;
  --sidebar: #05010e; --sidebar-active: #1d0d3d; --shadow: 0 0 0 1px rgba(255, 79, 216, .06), 0 4px 18px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: dark) {
  [data-theme="neon"][data-mode="system"] {
    --bg: #0a0418; --surface: #140a2b; --surface-2: #10071f; --border: #2a1752; --border-strong: #3d2272;
    --text: #f1e9ff; --muted: #a894d4; --accent: #ff4fd8; --accent-text: #12001a; --accent-soft: #2e0f3f;
    --ok: #2ef2c0; --ok-soft: #0b2b29; --warn: #ffd166; --warn-soft: #2e2510; --bad: #ff5c8a; --bad-soft: #330d1d;
    --sidebar: #05010e; --sidebar-active: #1d0d3d;
  }
}

[data-theme="paper"] {
  --bg: #f5f0e6; --surface: #fffdf7; --surface-2: #faf6ec; --border: #e4dccb; --border-strong: #cfc3aa;
  --text: #2a241b; --muted: #74684f; --accent: #9a3b12; --accent-text: #fffdf7; --accent-soft: #f6e6d8;
  --ok: #3d6b21; --ok-soft: #e9f0dc; --warn: #94600a; --warn-soft: #f7ecd2; --bad: #a3231c; --bad-soft: #f6e1dc;
  --sidebar: #2a241b; --sidebar-text: #eadfc8; --sidebar-muted: #a8997b; --sidebar-active: #3a3226; --sidebar-accent: #f0a674;
  --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; --radius: 6px;
}
[data-theme="paper"][data-mode="dark"] {
  --bg: #181511; --surface: #221e18; --surface-2: #1d1a15; --border: #352e24; --border-strong: #4a4033;
  --text: #ece3d0; --muted: #a8997b; --accent: #f0a674; --accent-text: #1a140e; --accent-soft: #3a2a1d;
  --ok: #a3c97a; --ok-soft: #232c18; --warn: #e6b45c; --warn-soft: #30260f; --bad: #f08a7e; --bad-soft: #351a16;
  --sidebar: #100e0b; --sidebar-active: #2a241b;
}
@media (prefers-color-scheme: dark) {
  [data-theme="paper"][data-mode="system"] {
    --bg: #181511; --surface: #221e18; --surface-2: #1d1a15; --border: #352e24; --border-strong: #4a4033;
    --text: #ece3d0; --muted: #a8997b; --accent: #f0a674; --accent-text: #1a140e; --accent-soft: #3a2a1d;
    --ok: #a3c97a; --ok-soft: #232c18; --warn: #e6b45c; --warn-soft: #30260f; --bad: #f08a7e; --bad-soft: #351a16;
    --sidebar: #100e0b; --sidebar-active: #2a241b;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.25; margin: 0; }
h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 620; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 .3em; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.1rem 1rem; font-family: var(--font-head); font-weight: 700; font-size: 1.02rem; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--sidebar-accent); color: var(--sidebar); display: grid; place-items: center; font-weight: 800; font-size: .8rem; letter-spacing: .02em; }
.nav-group { padding: .4rem .6rem .6rem; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: .5rem .55rem .3rem; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .48rem .6rem; border-radius: 7px; color: var(--sidebar-text); font-weight: 500; }
.nav a:hover { background: var(--sidebar-active); text-decoration: none; color: #fff; }
.nav a[aria-current="page"] { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--sidebar-accent); }
.nav a .icon { opacity: .85; }
.sidebar-foot { margin-top: auto; padding: .75rem; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: 8px; color: var(--sidebar-text); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--sidebar-active); display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .8rem; flex: none; }
.user-chip .who { min-width: 0; }
.user-chip .who b { display: block; color: #fff; font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { display: block; color: var(--sidebar-muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .nav a { font-size: .88rem; }
.sidebar-foot form { margin: 0; }
.sidebar-foot button.link { width: 100%; display: flex; align-items: center; gap: .65rem; padding: .48rem .6rem; border-radius: 7px; color: var(--sidebar-text); background: none; border: 0; font: inherit; font-weight: 500; cursor: pointer; }
.sidebar-foot button.link:hover { background: var(--sidebar-active); color: #fff; }

.main { min-width: 0; }
.topbar { display: none; }
.page { max-width: 1240px; margin: 0 auto; padding: 1.6rem 1.75rem 3rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { margin: .3rem 0 0; color: var(--muted); max-width: 70ch; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .card + .section, .section + .card { margin-top: 1.1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head p { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }
.card-body { padding: 1.1rem; }
.section { margin-top: 1.6rem; }
.section > h2 { margin-bottom: .7rem; }
.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { padding: 1rem 1.1rem; }
.stat-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.stat-value { font-size: 1.55rem; font-weight: 680; letter-spacing: -.02em; margin: .3rem 0 .15rem; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: .65rem; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.big-count { font-size: 1.35rem; font-weight: 680; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem 1.1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
td .sub { display: block; color: var(--muted); font-size: .82rem; margin-top: .1rem; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn-row { justify-content: flex-end; }
.empty { padding: 2rem 1.1rem; text-align: center; color: var(--muted); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 99px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .48rem .85rem; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 560; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; border-radius: 7px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-row { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
form.inline { display: inline; margin: 0; }

/* ---------- forms ---------- */
.field { margin-bottom: 1rem; }
.field label, .label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .88rem; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 140px; font-family: var(--mono); font-size: .85rem; resize: vertical; }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: .82rem; margin: .3rem 0 0; }
.check { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: .75rem; cursor: pointer; }
.check input { margin-top: .2rem; accent-color: var(--accent); width: 16px; height: 16px; }
.check span small { display: block; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .5rem; flex-wrap: wrap; }
.filters { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.filters .check { margin: 0; }
.filters select { width: auto; }
.radio-cards { display: grid; gap: .5rem; }
.radio-card { display: flex; gap: .6rem; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin-top: .25rem; accent-color: var(--accent); }
.radio-card small { display: block; color: var(--muted); }

/* ---------- alerts ---------- */
.alert { display: flex; gap: .65rem; align-items: flex-start; padding: .75rem .95rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); margin-bottom: 1rem; }
.alert .icon { margin-top: .1rem; }
.alert.success { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert.warning { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert.error { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.alert.info { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.alert > div { color: var(--text); }
.alert b { color: inherit; }
.secret-box { border: 1px solid var(--accent); background: var(--surface); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: 0 0 0 4px var(--accent-soft); }
.secret-box h2 { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.secret-row { display: grid; grid-template-columns: 110px 1fr auto; gap: .6rem; align-items: center; padding: .35rem 0; border-top: 1px dashed var(--border); }
.secret-row:first-of-type { border-top: 0; }
.secret-row code { font-size: .95rem; padding: .25rem .5rem; overflow-wrap: anywhere; }

/* ---------- job banner ---------- */
.job { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); margin-bottom: 1rem; }
.job .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
.job.done { background: var(--ok-soft); color: var(--ok); }
.job.failed { background: var(--bad-soft); color: var(--bad); }
.job.done .spinner, .job.failed .spinner { display: none; }
.job .job-text { color: var(--text); flex: 1; min-width: 0; }
.job pre { margin: .4rem 0 0; max-height: 120px; overflow: auto; font-size: .78rem; color: var(--muted); white-space: pre-wrap; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .job .spinner { animation: none; } .bar > span { transition: none; } }

/* ---------- dialogs ---------- */
dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 2rem)); box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
dialog.wide { width: min(760px, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(10, 14, 25, .55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.dialog-body { padding: 1.2rem; max-height: calc(100vh - 12rem); overflow-y: auto; }
.dialog-foot { display: flex; gap: .5rem; justify-content: flex-end; padding: .9rem 1.2rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.dialog-body > form { margin: 0; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-card .card-body { padding: 1.6rem; }
.auth-brand { display: flex; align-items: center; gap: .6rem; justify-content: center; margin-bottom: 1.2rem; font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; }
.auth-brand .brand-mark { background: var(--accent); color: var(--accent-text); }
.auth h1 { font-size: 1.25rem; margin-bottom: .35rem; text-align: center; }
.auth .lead { text-align: center; color: var(--muted); margin-bottom: 1.3rem; }
.auth .btn.primary { width: 100%; padding: .65rem; }
.auth-foot { text-align: center; margin-top: 1rem; font-size: .88rem; }

/* ---------- misc ---------- */
.dns-table input, .dns-table select { padding: .38rem .5rem; font-size: .88rem; }
.dns-table td { padding: .4rem .5rem; vertical-align: top; }
.dns-table .col-type { width: 110px; }
.dns-table .col-name { width: 22%; }
.dns-table .col-ttl { width: 95px; }
.dns-table .col-prio { width: 90px; }
.dns-table .col-x { width: 44px; }
.qr { background: #fff; padding: .5rem; border-radius: 10px; display: inline-block; border: 1px solid var(--border); }
.qr svg { display: block; width: 200px; height: 200px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; font-family: var(--mono); padding: 0; list-style: none; margin: .5rem 0 1rem; }
.codes li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .35rem .6rem; text-align: center; }
.settings-nav { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.2rem; flex-wrap: wrap; }
.settings-nav a { padding: .55rem .85rem; color: var(--muted); font-weight: 560; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.settings-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.settings-nav a:hover { text-decoration: none; color: var(--text); }
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.theme-option { border: 1px solid var(--border); border-radius: 10px; padding: .7rem; cursor: pointer; display: block; }
.theme-option:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-option input { accent-color: var(--accent); }
.swatches { display: flex; gap: 4px; margin: .5rem 0 .35rem; }
.swatches span { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .08); }
.sw-cn1 { background: #0f1b33; } .sw-cn2 { background: #2457d6; } .sw-cn3 { background: #f4f6fa; }
.sw-t1 { background: #050a05; } .sw-t2 { background: #39d353; } .sw-t3 { background: #c6f6c9; }
.sw-n1 { background: #12052b; } .sw-n2 { background: #ff4fd8; } .sw-n3 { background: #2ef2c0; }
.sw-p1 { background: #2a241b; } .sw-p2 { background: #9a3b12; } .sw-p3 { background: #f5f0e6; }
.acting-banner { background: var(--warn); color: #1a1200; padding: .55rem 1rem; display: flex; align-items: center; justify-content: center; gap: 1rem; font-weight: 600; flex-wrap: wrap; }
.acting-banner form { margin: 0; }
.acting-banner .btn { background: rgba(255, 255, 255, .85); border-color: transparent; color: #1a1200; }
.spark { width: 100%; height: 40px; display: block; margin-top: .5rem; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .75rem; font-family: var(--mono); font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
details summary { cursor: pointer; font-weight: 600; }
.copy-btn { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; z-index: 50; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  .topbar { display: flex; align-items: center; gap: .6rem; padding: .65rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
  .topbar b { font-family: var(--font-head); }
  .page { padding: 1.1rem 1rem 2.5rem; }
  .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
  th, td { padding: .6rem .75rem; }
  .secret-row { grid-template-columns: 1fr auto; }
  .secret-row > span { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .grid-4 { grid-template-columns: 1fr; } .codes { grid-template-columns: 1fr; } }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
legend { padding: 0; }
.grow { flex: 1; }

/* ---- cron output and log viewer ---- */
code.wrap { overflow-wrap: anywhere; white-space: pre-wrap; }
pre.log { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .75rem;
  font-family: var(--mono); font-size: .8rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 340px; overflow: auto; margin: 0; }
pre.log.tall { max-height: 70vh; }
.log-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.log-toolbar select { width: auto; }
.page-actions form.inline select { width: auto; min-width: 10rem; }
