/* Site factory panel: one hand-written stylesheet (contract C-14). Pages compose these
   classes; they do not restyle them. Right-to-left, Vazirmatn, no network loads. */

@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Variable.woff2") format("woff2-variations"),
       url("fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F6F5F2;
  --surface: #FFFFFF;
  --ink: #1B1F23;
  --muted: #667085;
  --line: #E4E2DD;
  --accent: #0E6B5C;
  --accent-ink: #FFFFFF;
  --ok: #067647;
  --warn: #B54708;
  --danger: #B42318;
  --radius: 12px;

  /* derived, not part of the contract's palette */
  --accent-hover: #0B574B;
  --danger-hover: #912018;
  --ok-tint: #ECFDF3;
  --warn-tint: #FFFAEB;
  --danger-tint: #FEF3F2;
  --muted-tint: #F2F4F7;
  --focus: 0 0 0 3px var(--surface), 0 0 0 6px var(--accent);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --page-pad: 24px;
  --control-h: 44px;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { font-weight: 600; line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

img, svg { max-width: 100%; height: auto; }

:focus { outline: none; }
:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus); border-radius: 6px; }
/* The shadow ring is dropped in forced-colours mode; the transparent outline above then shows in the system colour. */
@media (forced-colors: active) {
  :focus-visible { outline-color: Highlight; }
}

.container {
  width: 100%;
  max-width: calc(1120px + 2 * var(--page-pad));
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

.page { padding-block: var(--page-pad) calc(var(--page-pad) * 2); }
.page:focus-visible { box-shadow: none; outline: none; }

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -100px;
  z-index: 10;
  padding: 8px 16px;
  background: var(--surface);
  border-radius: var(--radius);
}
.skip-link:focus-visible { top: 12px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Every Latin value (URL, slug, username, password, colour code). */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--mono);
  font-size: .9375em;
  overflow-wrap: anywhere;
}
input.ltr, textarea.ltr { text-align: left; }

/* ---------- header ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 64px;
  padding-block: 10px;
}
.site-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.site-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  padding-inline: 12px;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius);
}
.site-nav-link:hover { background: var(--muted-tint); color: var(--ink); }
.site-nav-link[aria-current="page"] { color: var(--accent); font-weight: 600; }
.site-nav-logout { margin: 0; }
.site-menu { display: none; }
.site-menu summary { cursor: pointer; list-style: none; }
.site-menu summary::-webkit-details-marker { display: none; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-h);
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--muted-tint); color: var(--ink); }
.btn:focus-visible { box-shadow: var(--focus); border-radius: var(--radius); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: #FFFFFF; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--muted-tint); }

.btn-danger-outline { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }

.btn[disabled], .btn[aria-disabled="true"], .btn.htmx-request {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- form fields ---------- */

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
  min-width: 0;
}
.field > label, .field > .field-label { font-weight: 500; }

.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.field select,
.field textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input[type="file"] { padding: 9px 12px; }
.field input[type="color"] {
  width: 64px;
  height: var(--control-h);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.field input[type="checkbox"], .field input[type="radio"] {
  width: 22px; height: 22px;
  accent-color: var(--accent);
  margin: 0;
}
.field-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-h);
  cursor: pointer;
}

.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 107, 92, .25);
  border-radius: var(--radius);
}
.field ::placeholder { color: var(--muted); opacity: 1; }

/* error message under a field, linked to its input with aria-describedby */
.field-error {
  color: var(--danger);
  font-size: .9375rem;
  font-weight: 500;
}
.field:has(.field-error) input,
.field:has(.field-error) select,
.field:has(.field-error) textarea,
.field [aria-invalid="true"] {
  border-color: var(--danger);
}
.field:has(.field-error) input:focus-visible,
.field:has(.field-error) textarea:focus-visible,
.field [aria-invalid="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .2);
}

.hint { color: var(--muted); font-size: .9375rem; }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 0;
}
.card + .card { margin-top: 16px; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--muted-tint);
  color: var(--muted);
}
.badge-ok { background: var(--ok-tint); color: var(--ok); }
.badge-warn { background: var(--warn-tint); color: var(--warn); }
.badge-danger { background: var(--danger-tint); color: var(--danger); }
.badge-muted { background: var(--muted-tint); color: #475467; }   /* about 7:1 on the tint; --muted gives 4.5:1 */

/* ---------- alerts ---------- */

.alert {
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--muted);
  border-radius: var(--radius);
  background: var(--surface);
}
.alert-ok { border-color: #ABEFC6; border-inline-start-color: var(--ok); background: var(--ok-tint); }
.alert-warn { border-color: #FEDF89; border-inline-start-color: var(--warn); background: var(--warn-tint); }
.alert-danger { border-color: #FECDCA; border-inline-start-color: var(--danger); background: var(--danger-tint); }

/* ---------- table ---------- */

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}
.table th, .table td {
  padding: 12px 14px;
  text-align: start;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.table th {
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFAF8; }

/* ---------- step list (put aria-live="polite" on the list) ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.step {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: start;
  column-gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--muted);
}
.step::before {
  content: "";
  grid-row: 1 / span 2;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}
.step[data-status="pending"]::before { border-style: dashed; }

.step[data-status="running"] {
  color: var(--ink);
  font-weight: 600;
  background: #E7F2EF;
}
.step[data-status="running"]::before {
  border-color: rgba(14, 107, 92, .25);
  border-top-color: var(--accent);
  animation: step-spin .9s linear infinite;
}

.step[data-status="done"] { color: var(--ink); }
.step[data-status="done"]::before {
  content: "✓";
  border-color: var(--ok);
  background: var(--ok);
  color: #FFFFFF;
}

.step[data-status="failed"] {
  color: var(--danger);
  font-weight: 600;
  background: var(--danger-tint);
}
.step[data-status="failed"]::before {
  content: "✕";
  border-color: var(--danger);
  background: var(--danger);
  color: #FFFFFF;
}

@keyframes step-spin { to { transform: rotate(360deg); } }

/* ---------- error pages ---------- */

.error-page { max-width: 640px; margin: 48px auto 0; text-align: center; }
.error-page h1 { font-size: 1.375rem; margin-bottom: 1em; }

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  :root { --page-pad: 16px; }
  h1 { font-size: 1.5rem; }
  .card { padding: 16px; }
  .site-brand { font-size: 1.125rem; }
  .site-header-inner { position: relative; flex-wrap: nowrap; }
  .site-nav { display: none; }
  .site-menu { display: block; }
  .site-menu-links {
    position: absolute;
    inset-inline: var(--page-pad);
    top: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
  .site-menu-links .site-nav-logout .btn { width: 100%; }
  .table th, .table td { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .step[data-status="running"]::before {
    animation: none;
    border-color: var(--accent);
    background: radial-gradient(circle, var(--accent) 0 5px, var(--surface) 6px);
  }
}

/* ---------- login page ---------- */
.login { max-width: 400px; margin: 8vh auto 0; }
.login-brand { margin: 0 0 16px; text-align: center; font-size: 1.5rem; font-weight: 600; color: var(--accent); }
.login-card h1 { margin: 0 0 16px; font-size: 1.25rem; }
.login-card .alert { margin-bottom: 16px; }
.login-card .alert p { margin: 0; }
.login-submit { width: 100%; }

/* ---------- new-site page ---------- */
.new-site-hint { margin-bottom: 16px; }
.new-site .form-group > h2 { font-size: 1.125rem; margin-bottom: 16px; }
.new-site details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  min-height: var(--control-h);
  font-weight: 600;
  font-size: 1.125rem;
  cursor: pointer;
}
.new-site details > summary::-webkit-details-marker { display: none; }
.new-site details > summary::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  margin-inline-end: 6px;
  border-inline-end: 2px solid var(--muted);
  border-block-end: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.new-site details[open] > summary::after { transform: rotate(-135deg); }
.new-site details > summary:focus-visible { box-shadow: var(--focus); border-radius: var(--radius); }
.new-site details[open] > summary { margin-bottom: 12px; }
.new-site .field-required > label::after { content: " *"; color: var(--danger); }
.new-site .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
}
.new-site .form-wide { grid-column: 1 / -1; min-width: 0; }
.new-site .slug-row { display: flex; direction: ltr; align-items: center; gap: 8px; }
.new-site .slug-row input { flex: 1 1 0; min-width: 0; }
.new-site .slug-suffix { flex: 0 1 auto; color: var(--muted); }
.new-site .slug-status { min-height: 1.7em; }
.new-site .slug-status p { margin: 0; }
.new-site .slug-ok { color: var(--ok); font-weight: 500; }
.new-site .color-row { display: flex; align-items: center; gap: 12px; }
.new-site .new-site-actions { margin-top: 20px; }
.new-site .new-site-actions .btn { min-width: 200px; }

@media (max-width: 720px) {
  .new-site .form-grid { grid-template-columns: minmax(0, 1fr); }
  .new-site .new-site-actions .btn { width: 100%; min-width: 0; }
}

/* ---------- build progress page ---------- */
.progress { max-width: 760px; margin-inline: auto; min-width: 0; }
.progress-title { font-size: 2.25rem; line-height: 1.3; margin-bottom: .25em; overflow-wrap: anywhere; }
.progress-title-failed { font-size: 1.75rem; color: var(--danger); }
.progress-brand { font-size: 1.25rem; color: var(--muted); }
.progress-head { margin-bottom: 20px; }
.progress-timer { font-size: 1.5rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; margin: 0; }
.progress-steps { gap: 6px; }
.progress-steps .step { font-size: 1.25rem; padding: 14px 16px; grid-template-columns: 36px 1fr; }
.progress-steps .step::before { width: 32px; height: 32px; font-size: 17px; }
.progress-steps .step[data-status="running"] {
  font-size: 1.625rem;
  padding-block: 20px;
  border: 2px solid var(--accent);
  box-shadow: 0 6px 18px rgba(14, 107, 92, .18);
}
.progress-steps .step[data-status="running"]::before { width: 36px; height: 36px; }
.progress-error { margin-bottom: 16px; }
.progress-error pre {
  margin: 0;
  font-family: inherit;
  font-size: .9375em;
  text-align: start;
  unicode-bidi: plaintext;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 16rem;
  overflow: auto;
}
.progress-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.progress-actions form { margin: 0; }
.progress-ready { text-align: center; padding-block: 32px; }
.progress-ready .progress-title { color: var(--ok); font-size: 2.5rem; }
.progress-ready .progress-brand { font-size: 1.75rem; color: var(--ink); font-weight: 600; margin-bottom: .25em; }
.progress-built { color: var(--muted); font-size: 1.125rem; }
.progress-qr { margin: 20px auto; width: min(100%, 300px); min-width: 240px; }
.progress-qr svg { display: block; width: 100%; height: auto; aspect-ratio: 1; border: 1px solid var(--line); }
.progress-url { margin: 0 0 20px; font-size: 1.125rem; }
.progress-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
/* The finished steps stay listed under the ready card. */
.progress-ready > .progress-steps { margin-top: 24px; text-align: start; }

@media (max-width: 720px) {
  .progress-title { font-size: 1.75rem; }
  .progress-ready .progress-title { font-size: 2rem; }
  .progress-steps .step { font-size: 1.0625rem; }
  .progress-steps .step[data-status="running"] { font-size: 1.25rem; padding-block: 16px; }
  .progress-actions .btn { width: 100%; }
  .progress-actions form { flex: 1 1 100%; }
}

/* ---------- dashboard page ---------- */
.dashboard-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dashboard-head h1 { margin: 0; }
.dashboard-search { margin-bottom: 16px; }
.capacity { margin-bottom: 16px; }
.capacity-text { margin: 0 0 6px; color: var(--muted); font-size: .9375rem; }
.capacity-bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
/* The fill is a <progress> (no style attribute under the content security policy); its value is drawn by the
   engine's own pseudo-elements, coloured here. */
.capacity-fill { display: block; width: 100%; height: 100%; border: 0; background: transparent; color: var(--accent);
                 -webkit-appearance: none; appearance: none; }
.capacity-fill::-webkit-progress-bar { background: transparent; }
.capacity-fill::-webkit-progress-value { border-radius: 999px; background: var(--accent); }
.capacity-fill::-moz-progress-bar { border-radius: 999px; background: var(--accent); }
.capacity-warn .capacity-fill::-webkit-progress-value { background: var(--warn); }
.capacity-warn .capacity-fill::-moz-progress-bar { background: var(--warn); }
.capacity-full .capacity-fill::-webkit-progress-value { background: var(--danger); }
.capacity-full .capacity-fill::-moz-progress-bar { background: var(--danger); }
.sites-wrap { border: 1px solid var(--line); border-radius: var(--radius); }
.site-name { display: grid; gap: 0; }
.site-name > a { font-weight: 600; }
.site-name-en { color: var(--muted); font-size: .8125rem; }
.sites-empty { text-align: center; padding-block: 40px; }
.sites-empty p { margin-bottom: 16px; color: var(--muted); }

@media (max-width: 720px) {
  .sites-table, .sites-table tbody, .sites-table tr, .sites-table td { display: block; width: 100%; }
  .sites-wrap { border: 0; overflow: visible; }
  .sites-table { background: transparent; }
  .sites-table thead {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  }
  .sites-table tr {
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px 0;
  }
  .sites-table tbody tr:hover { background: var(--surface); }
  .sites-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
  }
  .table.sites-table tbody tr td { border-bottom: 1px solid var(--line); }
  .table.sites-table tbody tr td:last-child { border-bottom: 0; }
  .sites-table td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: .875rem; }
  .sites-table td > * { min-width: 0; text-align: end; }
}

/* ---------- site page ---------- */
.site-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: 16px; }
.site-page-head h1 { margin-bottom: 0; }
.site-page-en { margin: 0; color: var(--muted); }
.site-page-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.site-page .kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 24px; margin: 0 0 12px; align-items: center; }
.site-page .kv dt { color: var(--muted); }
.site-page .kv dd { margin: 0; min-width: 0; }
.site-page .card h2 { font-size: 1.125rem; }
.site-subhead { margin-top: 16px; font-size: 1rem; }
.swatch { display: inline-block; width: 20px; height: 20px; vertical-align: middle; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.secret { user-select: all; -webkit-user-select: all; }

@media (max-width: 720px) {
  .site-page .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .site-page .kv dd { margin-bottom: 8px; }
  .site-page-links .btn { flex: 1 1 100%; }
}

/* ---------- handover sheet (standalone A4 page; the @page rule is in handover.html) ---------- */
.handover-body { background: #FFFFFF; color: #000000; }
.handover-tools { display: flex; gap: 8px; max-width: 210mm; margin: 0 auto; padding: 16px 15mm 0; }
.handover { max-width: 210mm; margin: 0 auto; padding: 8mm 15mm 15mm; text-align: center; }
.handover-title { font-size: 2rem; margin-bottom: 6mm; }
.handover-qr-block { margin-bottom: 6mm; break-inside: avoid; }
.handover-qr { width: 60mm; height: 60mm; margin: 0 auto 3mm; }
.handover-qr svg { display: block; width: 60mm; height: 60mm; max-width: none; }
.handover-scan { margin: 0; font-size: 1.0625rem; }
.handover-block { margin-bottom: 6mm; padding-top: 4mm; border-top: 1px solid #000000; break-inside: avoid; }
.handover-block h2 { font-size: 1.125rem; margin-bottom: 2mm; }
.handover-value { margin: 0; font-size: 1.375rem; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; word-break: break-all; }
.handover-cred { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2mm 6mm; align-items: baseline; margin: 4mm 0 0; text-align: start; }
.handover-cred dt { font-weight: 600; }
.handover-cred dd { margin: 0; min-width: 0; }
.handover-password { font-size: 1.5rem; letter-spacing: .04em; font-variant-ligatures: none; font-feature-settings: "zero" 1, "liga" 0; }
.handover-lost { font-weight: 600; }
.handover-notes { margin-bottom: 6mm; font-size: 1rem; }
.handover-notes p { margin: 0 0 1.5mm; }
.handover-foot { padding-top: 4mm; border-top: 1px solid #000000; font-size: .875rem; }

@media print {
  .handover-tools { display: none !important; }
  .handover-body { background: #FFFFFF; font-size: 12pt; }
  .handover { max-width: none; margin: 0; padding: 0; }
  .handover-title { font-size: 24pt; }
  .handover-value { font-size: 16pt; }
  .handover-password { font-size: 18pt; }
  .handover-block, .handover-qr-block { break-inside: avoid; }
}

/* ---------- site page: status section and activity strip ---------- */
.site-activity:empty { display: none; }
.site-activity:not(:empty) { margin-bottom: 16px; }
.site-activity-card { border-inline-start: 4px solid var(--accent); }
.site-activity-failed { border-inline-start-color: var(--danger); }
.site-activity-title { font-weight: 600; font-size: 1.125rem; margin-bottom: 12px; }
.site-activity-failed .site-activity-title { color: var(--danger); }
.site-activity form { margin: 0 0 16px; }
.site-status-note { font-weight: 600; color: var(--warn); }
.site-status-actions, .site-status-trial { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.site-status-actions:empty { display: none; }
.site-status-actions + .site-status-trial { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.site-status form { margin: 0; }
.site-extend { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.site-extend .field { margin: 0; width: 120px; }

@media (max-width: 720px) {
  .site-status-actions form, .site-status-trial > form { flex: 1 1 100%; }
  .site-status-actions .btn, .site-status-trial > form > .btn { width: 100%; }
  .site-extend .field { flex: 1 1 100%; width: auto; }
  .site-extend .btn { width: 100%; }
}

/* ---------- site page: backups section ---------- */
.site-backups form { margin: 0 0 16px; }
.site-backups-empty { margin: 0; color: var(--muted); }
.site-backups-table td:last-child { text-align: end; white-space: nowrap; }

@media (max-width: 720px) {
  .site-backups form .btn { width: 100%; }
  .site-backups-table td:last-child { display: block; }
  .site-backups-table td:last-child::before { display: none; }
  .site-backups-table td:last-child .btn { width: 100%; }
}

/* ---------- site page: logs and danger sections ---------- */
.site-logs form { margin: 0 0 16px; }
.site-logs-title { margin: 16px 0 8px; font-size: 1rem; }
.site-logs pre { margin: 0; max-height: 360px; overflow: auto; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); font-size: 0.8125rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.site-danger { margin-top: 32px; border-color: var(--danger); }
.site-danger h2 { color: var(--danger); }
.site-danger form { margin: 0; }
.site-danger .field input { max-width: 420px; }
.site-danger #delete-host { display: block; margin: 4px 0 8px; text-align: right; }

@media (max-width: 720px) {
  .site-logs form .btn, .site-danger form .btn { width: 100%; }
}

/* ---------- edit page, shop and password sections ---------- */
.site-password { margin: 12px 0 0; }
.site-shop form { margin: 0; }
.site-shop .field input[type="text"] { max-width: 420px; }

@media (max-width: 720px) {
  .site-password .btn, .site-shop form .btn { width: 100%; }
}

/* ---------- settings page ---------- */
.settings-form .field-check { margin-top: 8px; }
.settings-base { margin: 0; min-height: 44px; display: flex; align-items: center; color: var(--muted); }
.settings-secret .badge { margin-inline-start: 8px; }
.settings-push { margin-top: 24px; }
.settings-push .hint { margin: 0 0 16px; }

@media (max-width: 720px) {
  .settings-push .btn { width: 100%; }
}

/* ---------- site page: domains section ---------- */
.site-domains-list { list-style: none; margin: 0 0 16px; padding: 0; }
.site-domain { padding: 12px 0; border-bottom: 1px solid var(--line); }
.site-domain:first-child { padding-top: 0; }
.site-domain-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.site-domain-host { overflow-wrap: anywhere; min-width: 0; }
.site-domain .hint { margin: 6px 0 0; overflow-wrap: anywhere; }
.site-domain-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.site-domain-actions form, .site-domain-add { margin: 0; }
.site-domain-add .field input[type="text"] { max-width: 420px; }

@media (max-width: 720px) {
  .site-domain-actions form, .site-domain-actions .btn, .site-domain-add .btn { width: 100%; }
}

/* ---------- operators page ---------- */
.operators-result { margin-bottom: 24px; }
.operators-result .hint { margin: 12px 0 0; }
.operators-table .operators-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.operators-table .operators-actions form { margin: 0; }
.operators-form { margin-top: 24px; }

@media (max-width: 720px) {
  .operators-table .operators-actions .btn { width: 100%; }
  .operators-table .operators-actions form { flex: 1 1 100%; }
}
.operators-result .kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 24px; margin: 0; align-items: center; }
.operators-result .kv dt { color: var(--muted); }

/* ---------- system page ---------- */
.system-page > .card, .system-grid { margin-bottom: 24px; }
.system-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px; }
.system-grid > .card { margin: 0; }
.system-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 24px; margin: 0; }
.system-kv dt { color: var(--muted); }
.system-kv dd { margin: 0; min-width: 0; }
.system-sub { margin-top: 20px; }
.system-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.system-filter .field { margin: 0; min-width: 0; flex: 1 1 200px; }
.system-code { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.system-detail { list-style: none; margin: 4px 0 0; padding: 0; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.system-audit td { overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .system-filter .btn { width: 100%; }
  /* the audit trail stays a real table that scrolls sideways: one line per row instead of 100 stacked cards */
  .system-audit td { white-space: nowrap; overflow-wrap: normal; }
  .system-audit .system-detail { display: inline; margin: 0; }
  .system-audit .system-detail li { display: inline; margin-inline-start: 12px; }
}
.system-cell { min-width: 0; }
