/* dhtml.net panel: one stylesheet, no build step, no external requests.
   1 tokens   2 base   3 layout   4 components   5 pages   6 small screens and preferences
   Colours are tokens; dark mode only swaps the tokens. */

/* ---------------------------------------------------------------- 1 tokens */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #14181f;
  --muted: #566070;
  --border: #dde1e7;
  --border-strong: #c3c9d2;
  --accent: #2851d8;
  --accent-hover: #1d3fb3;
  --accent-soft: #e8eefe;
  --on-accent: #ffffff;
  --ok: #17692e;       --ok-soft: #e3f5e8;
  --warn: #8a5a00;     --warn-soft: #fff3d6;
  --bad: #b3261e;      --bad-soft: #fdeceb;
  --info: #1d4ed8;     --info-soft: #e8eefe;
  --code-bg: #101319;  --code-text: #e6eaf0;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.08);
  --shadow-lg: 0 8px 24px rgb(16 24 40 / 0.10);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --radius: 10px; --radius-sm: 6px;
  --text-sm: 0.875rem; --text-base: 1rem; --text-lg: 1.125rem; --text-xl: 1.375rem; --text-2xl: 1.75rem; --text-3xl: clamp(2rem, 5vw, 3.1rem);
  --measure: 66rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1014; --surface: #161a21; --surface-2: #1d222b;
    --text: #e9edf3; --muted: #a0a9b8; --border: #2a303b; --border-strong: #3a4250;
    --accent: #7c9bff; --accent-hover: #9db3ff; --accent-soft: #1b2440; --on-accent: #0b1020;
    --ok: #66d38a;   --ok-soft: #13291b;
    --warn: #f0b94d; --warn-soft: #2d2410;
    --bad: #ff8a80;  --bad-soft: #321614;
    --info: #8fb0ff; --info-soft: #1b2440;
    --code-bg: #07090c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4); --shadow-lg: 0 8px 24px rgb(0 0 0 / 0.5);
  }
}

/* ---------------------------------------------------------------- 2 base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: var(--text-base)/1.6 var(--font); color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--s3); letter-spacing: -0.01em; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p { margin: 0 0 var(--s4); }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }
code, pre { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
ul { padding-left: 1.2rem; margin: 0 0 var(--s4); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s3); top: -4rem; background: var(--surface); color: var(--text); padding: var(--s2) var(--s4); border-radius: var(--radius-sm); border: 2px solid var(--accent); z-index: 100; }
.skip-link:focus { top: var(--s3); }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- 3 layout */
.container { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 var(--s4); }
.page { padding-top: var(--s6); padding-bottom: var(--s7); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--s3); margin-bottom: var(--s5); }
.page-head h1 { margin: 0; }
.page-head p { margin: var(--s1) 0 0; }
.stack > * + * { margin-top: var(--s4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.grid-3 { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.section { margin-top: var(--s7); }
.section > h2 { margin-bottom: var(--s2); }
.section-lead { color: var(--muted); max-width: 40rem; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); padding-top: var(--s3); padding-bottom: var(--s3); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: var(--text-lg); color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand svg { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s4); }
.nav a { color: var(--muted); text-decoration: none; padding: var(--s1) 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.nav form { margin: 0; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: var(--s7); }
.site-footer .container { padding-top: var(--s5); padding-bottom: var(--s5); display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); justify-content: space-between; color: var(--muted); font-size: var(--text-sm); }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; gap: var(--s4); flex-wrap: wrap; }

/* ---------------------------------------------------------------- 4 components */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 2.5rem; padding: 0.5rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); filter: brightness(0.92); color: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; color: var(--accent-hover); }
.btn-lg { min-height: 3rem; padding: 0.7rem 1.4rem; font-size: var(--text-lg); }
.btn-sm { min-height: 2rem; padding: 0.25rem 0.7rem; font-size: var(--text-sm); }
.btn-block { width: 100%; }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s5); box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card h2, .card h3 { margin-bottom: var(--s2); }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); color: inherit; }
.card-flat { box-shadow: none; }
.card-accent { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }

.field { margin-bottom: var(--s4); }
.field label, .label { display: block; font-weight: 600; margin-bottom: var(--s1); }
.input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea { width: 100%; min-height: 2.6rem; padding: 0.5rem 0.75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; color: var(--text); background: var(--surface); }
input::placeholder { color: var(--muted); opacity: 0.8; }
.help { color: var(--muted); font-size: var(--text-sm); margin: var(--s1) 0 0; }
.error-text { color: var(--bad); font-size: var(--text-sm); margin: var(--s1) 0 0; font-weight: 600; }
.input-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: stretch; }
.input-row .input, .input-row input[type="text"], .input-row input[type="email"] { flex: 1 1 12rem; width: auto; }
.input-suffix { display: flex; align-items: center; padding: 0 var(--s3); color: var(--muted); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.divider { display: flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: var(--text-sm); margin: var(--s5) 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.alert { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius-sm); border: 1px solid; margin-bottom: var(--s4); }
.alert > :last-child { margin-bottom: 0; }
.alert p { margin: 0; }
.alert-success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.alert-error { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.alert-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert-info { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.alert strong { color: inherit; }
.flash-bar { padding-top: var(--s4); }

.badge { text-transform: capitalize; display: inline-flex; align-items: center; gap: 0.4em; padding: 0.1rem 0.65rem; border-radius: 999px; font-size: var(--text-sm); font-weight: 600; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: currentColor; }
.badge-running, .badge-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.badge-failed, .badge-off { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.badge-stopped, .badge-new, .badge-queued { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.badge-deploying, .badge-working { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.badge-deploying::before, .badge-working::before { animation: pulse 1.4s ease-in-out infinite; }
.badge-plain::before { display: none; }
@keyframes pulse { 50% { opacity: 0.25; } }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
th, td { text-align: left; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.empty { text-align: center; color: var(--muted); padding: var(--s6); }

.progress-row { display: grid; gap: var(--s1); margin-bottom: var(--s4); }
.progress-row .top { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--text-sm); }
progress { width: 100%; height: 0.7rem; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-2); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.empty-state { text-align: center; padding: var(--s7) var(--s4); border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.empty-state h2, .empty-state h3 { margin-bottom: var(--s2); }
.empty-state p { color: var(--muted); max-width: 30rem; margin-left: auto; margin-right: auto; }

.dropzone { position: relative; display: block; text-align: center; padding: var(--s6) var(--s4); border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone svg { width: 2.2rem; height: 2.2rem; color: var(--accent); }
.dropzone strong { display: block; }
.dropzone .file-name { display: block; margin-top: var(--s2); font-weight: 600; color: var(--accent); word-break: break-all; }
.dropzone .file-name:empty { display: none; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--s5) var(--s6); }
.timeline li::before { content: ""; position: absolute; left: 0.45rem; top: 0.5rem; bottom: -0.2rem; border-left: 2px solid var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 0.4rem; width: 0.95rem; height: 0.95rem; border-radius: 50%; background: var(--muted); border: 3px solid var(--bg); box-sizing: content-box; margin: -3px; }
.timeline li.t-ok::after { background: var(--ok); }
.timeline li.t-failed::after { background: var(--bad); }
.timeline li.t-queued::after, .timeline li.t-running::after { background: var(--info); }
.timeline .when { color: var(--muted); font-size: var(--text-sm); }
.timeline .what { font-weight: 600; }
.timeline .msg { margin: var(--s1) 0 0; padding: var(--s2) var(--s3); background: var(--surface-2); border-radius: var(--radius-sm); font-size: var(--text-sm); word-break: break-word; white-space: pre-wrap; }

.steps { list-style: none; counter-reset: step; margin: 0 0 var(--s4); padding: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 var(--s4) 2.6rem; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; }
.steps li > strong { display: block; }

pre.log { background: var(--code-bg); color: var(--code-text); padding: var(--s4); border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 22rem; margin: 0; }
pre.secret { background: var(--code-bg); color: var(--code-text); padding: var(--s4); border-radius: var(--radius-sm); overflow-x: auto; word-break: break-all; white-space: pre-wrap; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.stat { text-align: left; }
.stat .num { display: block; font-size: var(--text-2xl); font-weight: 700; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: var(--text-sm); }

/* ---------------------------------------------------------------- 5 pages */
.hero { padding: var(--s8) 0 var(--s7); text-align: center; }
.hero h1 { font-size: var(--text-3xl); max-width: 18ch; margin: 0 auto var(--s4); letter-spacing: -0.02em; }
.hero .lead { font-size: var(--text-lg); color: var(--muted); max-width: 38rem; margin: 0 auto var(--s5); }
.hero .cluster { justify-content: center; }
.hero .fine { margin-top: var(--s3); color: var(--muted); font-size: var(--text-sm); }
.url-demo { display: inline-block; font-family: var(--mono); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0.35rem 1rem; box-shadow: var(--shadow); margin-bottom: var(--s5); }
.url-demo b { color: var(--accent); }
.feature h3 { display: flex; gap: var(--s2); align-items: center; }
.feature svg { width: 1.4rem; height: 1.4rem; color: var(--accent); flex: none; }
.cta-band { margin-top: var(--s7); text-align: center; background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s7) var(--s4); }
.cta-band h2 { font-size: var(--text-2xl); }

.plan { display: flex; flex-direction: column; }
.plan .price { font-size: var(--text-2xl); font-weight: 700; margin: 0; }
.plan .price small { font-size: var(--text-base); color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; padding: 0; margin: var(--s4) 0; flex: 1; }
.plan li { padding: var(--s1) 0 var(--s1) 1.5rem; position: relative; }
.plan li::before { content: ""; position: absolute; left: 0; top: 0.75em; width: 0.7rem; height: 0.4rem; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.plan .tag { align-self: flex-start; margin-bottom: var(--s2); }
.plan:has(.tag) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }

.auth-wrap { min-height: 60vh; display: grid; place-items: start center; padding: var(--s6) var(--s4) var(--s7); }
.auth-card { width: 100%; max-width: 27rem; }
.auth-card h1 { font-size: var(--text-2xl); }

.site-card { display: flex; flex-direction: column; gap: var(--s3); height: 100%; }
.site-card .name { font-size: var(--text-lg); font-weight: 700; margin: 0; word-break: break-all; }
.site-card .addr { color: var(--muted); font-size: var(--text-sm); word-break: break-all; margin: 0; }
.site-card .meta { margin-top: auto; display: flex; justify-content: space-between; gap: var(--s2); color: var(--muted); font-size: var(--text-sm); }

.site-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.site-title h1 { word-break: break-all; }
.panel-grid { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 62rem) { .panel-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.danger-zone { border-color: var(--bad); }

/* ---------------------------------------------------------------- 6 small screens and preferences */
@media (max-width: 40rem) {
  .page { padding-top: var(--s5); }
  .hero { padding: var(--s6) 0 var(--s6); }
  .card { padding: var(--s4); }
  .nav { gap: var(--s1) var(--s3); font-size: var(--text-sm); }
  .btn-lg { width: 100%; }
  .hero .cluster .btn { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: var(--s2); }
  th, td { padding: var(--s2) var(--s3); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .site-header, .site-footer, .btn { display: none; } body { background: #fff; color: #000; } }
.mt { margin-top: var(--s4); }
.badge-stopping, .badge-deleting { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.badge-stopping::before, .badge-deleting::before { animation: pulse 1.4s ease-in-out infinite; }
.nav a.btn { color: var(--on-accent); border-bottom: 1px solid var(--accent); padding: 0.25rem 0.7rem; }
.nav a.btn:hover { color: var(--on-accent); }
.nav .btn-secondary { color: var(--text); }
.badge-live { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.badge-preview { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.mail { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); margin-top: var(--s3); background: var(--surface-2); }
.mail .hd { font-size: var(--text-sm); color: var(--muted); margin: 0; }
.mail .subject { font-weight: 700; margin: 0 0 var(--s2); }
.mail .body { white-space: pre-wrap; word-break: break-word; margin: 0; font-size: var(--text-sm); }
