:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #18253c;
  --muted: #65748b;
  --border: #e0e5ee;
  --primary: #285de5;
  --primary-hover: #1c49bd;
  --primary-contrast: #ffffff;
  --primary-soft: #edf2ff;
  --success: #087b58;
  --success-soft: #e4f7ed;
  --warn: #a75c0a;
  --warn-soft: #fff3dc;
  --danger: #bd3447;
  --danger-soft: #fff0f2;
  --info: #136693;
  --info-soft: #eaf5fb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(22, 37, 60, 0.03);
  --shadow-lg: 0 6px 24px rgba(22, 37, 60, 0.07);
  --table-head: #f9fafc;
  --input: #ffffff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--primary-hover); text-decoration: none; }

h1, h2 { line-height: 1.2; margin: 0 0 0.75rem; font-weight: 700; letter-spacing: -0.035em; }
h1 { font-size: clamp(1.6rem, 2.6vw, 1.9rem); font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0 0 0.75rem; }
.eyebrow { color: var(--muted); font-size: 0.65rem; font-weight: 650; letter-spacing: 0.09em; margin: 0 0 8px; }

code, .mono { font-family: var(--mono); font-size: 0.9em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.offscreen { position: fixed; left: -9999px; top: 0; }

.wrap { width: 100%; max-width: 690px; margin: 0 auto; padding: 0 24px; }
.is-admin .wrap { max-width: 1120px; }

main.wrap { padding-top: 38px; padding-bottom: 48px; min-height: calc(100vh - 190px); }

.testnet-banner {
  background: #eaf0fc;
  color: #42577c;
  text-align: center;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.025em;
  padding: 7px 12px;
}
.testnet-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #c79435; vertical-align: 1px; margin-right: 5px; }
.testnet-divider { opacity: 0.5; padding: 0 7px; }

.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 78px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; flex: none; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-copy strong { font-size: 1rem; letter-spacing: -0.035em; font-weight: 760; }
.brand-copy small { color: var(--muted); font-size: 0.68rem; font-weight: 400; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav a, .admin-nav .link-button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  color: #a7b5cc;
  padding: 11px 12px;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 500;
}
.admin-nav a:hover, .admin-nav .link-button:hover { color: #ffffff; background: #1f304e; text-decoration: none; transform: none; }
.admin-nav a.active { color: #ffffff; background: #253f6f; font-weight: 600; }
.admin-nav svg { width: 18px; height: 18px; flex: none; }
.admin-nav form { margin-top: 24px; }
.count {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 0.75rem; text-align: center; font-weight: 700;
}

.site-footer { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 0.77rem; padding-top: 12px; padding-bottom: 32px; border-top: 1px solid var(--border); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 18px;
}
.card.narrow { max-width: 600px; }
.card.highlight { border-color: var(--success); }
.card.empty { text-align: center; padding: 52px 24px; border-style: dashed; }
.empty-icon { display: grid; place-items: center; width: 50px; height: 50px; margin: 0 auto 15px; border-radius: 15px; background: var(--primary-soft); color: var(--primary); font-size: 1.7rem; font-weight: 700; }
.auth-panel { padding: 48px 44px; align-self: center; min-width: 0; }
.auth-panel h2 { font-size: 1.45rem; margin-bottom: 10px; }
.auth-panel > .muted { margin-bottom: 28px; font-size: 0.85rem; }
.auth-panel .primary { width: 100%; margin-top: 8px; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { margin-bottom: 4px; }
.page-heading .muted { margin-bottom: 0; }

.invoice-summary .amount-fiat { margin: 4px 0 4px; }
.amount-fiat { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.amount-fiat .currency { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.description { font-size: 1.05rem; margin-bottom: 4px; overflow-wrap: anywhere; }

.label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 750; margin: 0 0 7px; }

/* buttons */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 0.9rem; font-weight: 700;
  padding: 9px 15px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  cursor: pointer; text-decoration: none; min-height: 42px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
button:hover, .button:hover { border-color: var(--primary); text-decoration: none; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
button[data-submitting] { cursor: progress; }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
button.primary:hover, .button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-contrast); }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
button.copy { font-size: 0.85rem; padding: 6px 10px; min-height: 34px; }
button.copied { border-color: var(--success); color: var(--success); }
.link-button { background: none; border: 0; min-height: 0; font-weight: 400; cursor: pointer; }
form.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 17px; }
label { display: flex; flex-direction: column; gap: 7px; font-weight: 650; font-size: 0.88rem; }
label .muted { font-weight: 400; }
input, select {
  font: inherit; font-weight: 400;
  padding: 10px 12px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--input); color: var(--text);
  width: 100%; min-height: 44px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input:focus, select:focus, button:focus-visible, .button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); outline: none; }
input::placeholder { color: var(--muted); opacity: 0.75; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > label { flex: 1 1 160px; }
.field-row > label.grow { flex: 3 1 220px; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { width: 80px; min-height: 36px; padding: 6px 8px; }
.inline-form button { min-height: 36px; padding: 6px 10px; }

/* badges & notices */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
}
.badge-open, .badge-pending, .badge-t-pending { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-processing, .badge-confirming, .badge-partial, .badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-paid, .badge-t-confirmed { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-t-dropped { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.notice { border-radius: 11px; padding: 12px 15px; margin: 0 0 16px; font-size: 0.91rem; border-left: 3px solid currentColor; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.notice-info { background: var(--info-soft); color: var(--info); }
.notice-success { background: var(--success-soft); color: var(--success); }

/* payment method picker */
.methods { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.method-group { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--card); }
.method-coin { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.method-networks { display: flex; flex-wrap: wrap; gap: 8px; }
.method-networks form { margin: 0; }
.network-button { font-weight: 700; }

.coin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: #fff; font-size: 0.8rem; font-weight: 800; background: #6b7280; flex: none;
}
.coin-btc { background: #f7931a; }
.coin-ltc { background: #345d9d; }
.coin-usdt { background: #26a17b; }
.coin-usdc { background: #2775ca; }
.coin-eth { background: #627eea; }
.coin-sol { background: linear-gradient(135deg, #9945ff, #14f195); }
.coin-bnb { background: #f0b90b; }
.coin-pol { background: #8247e5; }

/* payment instructions */
.back { display: inline-block; font-size: 0.86rem; font-weight: 700; margin-bottom: 16px; }
.countdown {
  font-family: var(--mono); font-weight: 700; font-size: 0.9rem;
  padding: 4px 10px; border-radius: 999px; background: var(--info-soft); color: var(--info);
}
.countdown.urgent { background: var(--danger-soft); color: var(--danger); }
.pay-card .label { margin-top: 14px; }
.send-amount { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.send-amount .big { font-family: var(--mono); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.send-amount .symbol { font-size: 1.2rem; font-weight: 700; color: var(--muted); }

.pay-grid { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center; margin: 22px 0; }
.qr { background: #fff; border-radius: 14px; padding: 10px; border: 1px solid var(--border); line-height: 0; box-shadow: var(--shadow); }
.qr svg { width: 100%; height: auto; display: block; }
.qr-small { width: 140px; margin-top: 12px; }
.address {
  display: block; font-family: var(--mono); font-size: 0.95rem;
  background: var(--input); border: 1px solid var(--border); border-radius: 11px;
  padding: 12px 14px; overflow-wrap: anywhere; user-select: all;
}

.warnings { margin: 0 0 16px; padding: 12px 14px 12px 32px; background: var(--warn-soft); color: var(--text); border-radius: 10px; font-size: 0.9rem; }
.warnings li + li { margin-top: 6px; }

.status {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 10px; margin-bottom: 10px;
  background: var(--info-soft); color: var(--info); font-weight: 600;
}
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; margin-top: 7px; animation: pulse 1.6s ease-in-out infinite; }
.status-confirming, .status-partial { background: var(--warn-soft); color: var(--warn); }
.status-paid { background: var(--success-soft); color: var(--success); }
.status-paid .dot, .status-expired .dot { animation: none; }
.status-expired { background: var(--danger-soft); color: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .status .dot { animation: none; } }

.receipt { text-align: center; padding: 32px 20px; }
.receipt .check {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--success-soft); color: var(--success); font-size: 2rem; font-weight: 800;
}
.receipt .facts { text-align: left; max-width: 420px; margin: 16px auto; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 0; font-size: 0.95rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* admin */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 30px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.stat { overflow: hidden; padding: 24px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat-label { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 650; letter-spacing: 0.015em; }
.stat-value { display: block; font-size: 1.8rem; font-weight: 600; letter-spacing: -0.035em; line-height: 1.25; margin-top: 10px; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; border-bottom: 1px solid var(--border); }
.tabs a { padding: 10px 8px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 0.8rem; font-weight: 500; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { border-bottom-color: var(--primary); color: var(--primary); font-weight: 600; }
.tabs .tab-right { margin-left: auto; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.action-grid button { align-self: flex-start; }
.pager { display: flex; justify-content: space-between; margin-top: 12px; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.list th { text-align: left; font-size: 0.75rem; color: var(--muted); font-weight: 600; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--table-head); }
table.list td { padding: 16px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; }
table.list tbody tr:hover { background: var(--primary-soft); }
table.list td a { font-weight: 700; }

.help { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; }
.settings-empty { border-top: 1px solid var(--border); padding: 22px 0 4px; }
.settings-empty strong { font-weight: 550; font-size: 0.85rem; }
.settings-empty p { margin: 5px 0 0; }
.security-confirmation { border-top: 1px solid var(--border); padding-top: 16px; }
.security-confirmation > p { margin: 0; }
.wallet-section-heading h2 { margin-bottom: 5px; }
.wallet-section-heading p { margin: 0; }
.wallet-editor .help { font-weight: 400; }
.wallet-key-note { margin: 0; }
.wallet-verification { padding: 18px 20px; background: var(--table-head); border: 1px solid var(--border); border-radius: 6px; }
.wallet-verification h2 { margin-bottom: 6px; font-size: 0.9rem; }
.wallet-verification > p { margin: 0; }
.wallet-verification .security-confirmation { padding-top: 8px; border-top: 0; }
.wallet-actions { margin-top: 4px; }
.wallet-actions .danger { margin-left: auto; }
.action-buttons { display: flex; gap: 12px; margin-top: 24px; }
.action-buttons .button { flex: 0 0 auto; }

.header-context { color: var(--muted); font-size: 0.75rem; }
.is-admin { --workspace-offset: 0px; }
.is-admin.is-testnet { --workspace-offset: 32px; }
.is-admin > .testnet-banner { position: sticky; top: 0; z-index: 20; height: 32px; line-height: 18px; }
.workspace-shell { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: calc(100dvh - var(--workspace-offset)); }
.workspace-sidebar { background: #14223a; color: #fff; padding: 28px 16px 20px; display: flex; flex-direction: column; position: sticky; top: var(--workspace-offset); height: calc(100dvh - var(--workspace-offset)); align-self: start; overflow-y: auto; }
.workspace-sidebar > * { flex-shrink: 0; }
.workspace-sidebar .brand { padding: 0 8px; color: #fff; margin-bottom: 38px; }
.workspace-sidebar .brand-copy small { color: #8e9fba; }
.nav-caption { color: #8e9fba; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; padding-left: 12px; margin-bottom: 12px; }
.sidebar-note { margin-top: auto; padding: 20px 8px 0; border-top: 1px solid #293750; display: flex; gap: 10px; align-items: center; }
.sidebar-note > div { min-width: 0; }
.sidebar-note strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-avatar { width: 30px; height: 30px; display: grid; place-items: center; background: #2b3b59; border-radius: 5px; color: #c4d3ec; flex: none; font-size: 0.75rem; }
.sidebar-note div { min-width: 0; }
.sidebar-note strong { display: block; font-size: 0.75rem; font-weight: 500; overflow-wrap: anywhere; }
.sidebar-note small { display: block; color: #8e9fba; font-size: 0.65rem; }
.workspace-content { min-width: 0; display: flex; flex-direction: column; }
.workspace-topbar { height: 62px; padding: 0 32px; display: flex; justify-content: space-between; align-items: center; background: #fff; border-bottom: 1px solid var(--border); font-size: 0.8rem; font-weight: 500; }
.environment-label { padding: 3px 9px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-size: 0.7rem; }
.is-admin main.wrap { min-height: 0; flex: 1; padding: 34px 32px 48px; }
.is-admin .site-footer { margin-top: auto; padding: 16px 32px; }
.is-auth .wrap { max-width: 1080px; }
.is-auth main.wrap { min-height: calc(100vh - 182px); display: flex; align-items: center; padding-top: 40px; padding-bottom: 40px; }
.auth-layout { display: grid; grid-template-columns: 1fr 1fr; width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-lg); }
.auth-intro { padding: 48px 42px 28px; background: #14223a; color: #fff; }
.auth-kicker { color: #94b6fc; font-size: 0.65rem; letter-spacing: 0.1em; font-weight: 600; }
.auth-intro h1 { font-size: clamp(1.9rem, 3.5vw, 2.65rem); font-weight: 550; line-height: 1.15; margin: 20px 0; letter-spacing: -0.045em; }
.auth-intro > p { color: #a4b4ce; font-size: 0.87rem; max-width: 330px; }
.auth-workflow { margin-top: 36px; }
.auth-workflow > div { display: flex; gap: 16px; align-items: flex-start; padding: 15px 0; border-top: 1px solid #2b3a54; }
.auth-workflow > div > span { font: 11px/1.6 var(--mono); color: #91b1ef; padding-top: 2px; }
.auth-workflow p { margin: 0; }
.auth-workflow strong { display: block; font-size: 0.83rem; font-weight: 500; }
.auth-workflow small { display: block; color: #9aaecb; font-size: 0.73rem; margin-top: 3px; }
.auth-intro-footer { display: flex; gap: 22px; margin-top: 34px; padding-top: 20px; border-top: 1px solid #2b3a54; color: #8e9fba; font-size: 0.58rem; letter-spacing: 0.08em; }
.auth-lock { width: 40px; height: 40px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); border-radius: 8px; margin-bottom: 24px; }
.auth-lock svg { width: 21px; height: 21px; }
.auth-help { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 28px; font-size: 0.73rem; line-height: 1.8; color: var(--muted); }
.auth-help code { color: #435775; }

@media (max-width: 900px) {
  .workspace-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .auth-intro { padding: 36px 28px 24px; }
  .auth-panel { padding: 36px 28px; }
}
@media (max-width: 760px) {
  .workspace-shell { display: block; }
  .workspace-sidebar { padding: 18px 18px 8px; position: static; height: auto; overflow: visible; }
  .workspace-sidebar .brand { margin-bottom: 18px; padding: 0; }
  .nav-caption, .sidebar-note, .workspace-topbar { display: none; }
  .admin-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .admin-nav a, .admin-nav .link-button { width: 100%; padding: 9px 10px; min-width: 0; }
  .admin-nav a span, .admin-nav .link-button span { min-width: 0; }
  .admin-nav form { margin-top: 0; }
  .admin-nav svg { width: 16px; height: 16px; }
  .is-admin main.wrap { padding: 26px 18px 40px; min-height: calc(100vh - 230px); }
  .is-admin .site-footer { padding: 16px 18px; }
  .auth-layout { grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; }
  .auth-intro { padding: 24px 28px; }
  .auth-intro h1 { font-size: 1.7rem; margin: 12px 0; }
  .auth-intro h1 br { display: none; }
  .auth-intro > p { margin: 0; font-size: 0.8rem; max-width: none; }
  .auth-workflow, .auth-intro-footer { display: none; }
  .auth-panel { padding: 28px; }
  .auth-lock { display: none; }
  .is-auth main.wrap { padding-top: 24px; padding-bottom: 24px; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 18px; padding-right: 18px; }
  main.wrap { padding-top: 26px; }
  h1 { font-size: 1.65rem; }
  .amount-fiat { font-size: 1.7rem; }
  .send-amount .big { font-size: 1.5rem; }
  .pay-grid { grid-template-columns: 1fr; justify-items: center; }
  .pay-grid .qr { width: 220px; }
  .address-block { width: 100%; }
  .grid-2, .action-grid { grid-template-columns: 1fr; }
  .stats { gap: 0; }
  .stat { padding: 14px; }
  .stat-label { font-size: 0.72rem; }
  .stat-value { font-size: 1.25rem; }
  .card { padding: 20px; }
  .site-footer { flex-wrap: wrap; }
  table.list th, table.list td { padding: 12px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .facts dt:not(:first-child) { margin-top: 10px; }
}
@media (max-width: 470px) {
  .admin-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: 1fr; }
  .stat { padding: 16px 18px; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--border); }
  .page-heading .button { width: 100%; }
  .tabs .tab-right { margin-left: 0; }
  .auth-panel { padding: 24px; }
}

/* documentation (admin → Docs) */
.docs-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: start; }
.docs-layout > .card { margin-bottom: 0; }
.docs-toc { position: sticky; top: 20px; padding: 18px 18px 12px; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-toc a { display: block; padding: 5px 0; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.docs-toc a:hover { color: var(--primary); }
.docs-toc .toc-3 a { padding-left: 12px; font-size: 0.78rem; }

.prose { padding: 34px 38px; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { font-size: 1.28rem; margin: 2.4rem 0 0.9rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { font-size: 1.02rem; margin: 1.7rem 0 0.6rem; letter-spacing: -0.02em; }
.prose h2, .prose h3 { scroll-margin-top: 20px; }
.prose p, .prose li { line-height: 1.7; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.5rem; }
.prose li { margin: 0.3rem 0; }
.prose li > p { margin: 0 0 0.5rem; }
.prose li > p:last-child { margin-bottom: 0; }
.prose li > ul, .prose li > ol { margin: 0.4rem 0; }
.prose li > .code-block { margin: 0.6rem 0 0.4rem; }
.prose code { background: var(--primary-soft); color: #243a6e; padding: 0.1em 0.38em; border-radius: 4px; font-size: 0.86em; overflow-wrap: anywhere; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.6rem 0; }
.prose blockquote { margin: 0 0 1.1rem; padding: 12px 16px; background: var(--info-soft); border-left: 3px solid var(--info); border-radius: 0 var(--radius) var(--radius) 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose .table-wrap { margin: 0 0 1.3rem; }
.prose table.list th, .prose table.list td { padding: 10px 14px; font-size: 0.85rem; }
.prose table.list td { line-height: 1.55; }
.prose table.list tbody tr:hover { background: none; }
.prose table.list td:first-child { font-weight: 550; }
.code-block { position: relative; margin: 0 0 1.1rem; }
.code-block pre { margin: 0; padding: 15px 16px; background: #14223a; color: #dbe5f8; border-radius: var(--radius); overflow-x: auto; font: 0.82rem/1.6 var(--mono); tab-size: 2; }
.prose .code-block code { background: none; color: inherit; padding: 0; font-size: inherit; overflow-wrap: normal; }
.code-block button.copy { position: absolute; top: 8px; right: 8px; min-height: 28px; padding: 3px 9px; font-size: 0.75rem; background: #20314e; border-color: #344b72; color: #c6d4ee; }
.code-block button.copy:hover { border-color: #5d82c9; background: #284063; }
.code-block button.copied { border-color: #3d9d7a; color: #8fe0bd; }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-toc { position: static; order: -1; }
  .prose { padding: 24px 22px; }
}
@media (max-width: 640px) {
  .prose { padding: 20px 16px; }
  .prose ul, .prose ol { padding-left: 1.2rem; }
}

/* notifications (admin → Settings → Notifications) */
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
label.check input { width: auto; min-height: 0; flex: none; }
textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 5px; width: 100%; resize: vertical;
  border: 1px solid var(--border); background: var(--input); color: var(--text);
}
textarea.mono { font-family: var(--mono); font-size: 0.85rem; }
table.list td.actions-cell { text-align: right; min-width: 210px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 6px 18px; }
.row-actions form { display: contents; }
.row-actions a, button.link-action { font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--primary); background: none; border: 0; padding: 0; min-height: 0; cursor: pointer; }
.row-actions a:hover, button.link-action:hover { color: var(--primary-hover); border: 0; background: none; }
button.link-action:disabled { color: var(--muted); }
.node-actions-cell { text-align: right; vertical-align: middle !important; }
.node-actions { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; white-space: nowrap; overflow: hidden; }
.node-actions form { margin: 0; }
.node-actions button, table.list .node-actions a { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 6px 10px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 0.78rem; font-weight: 550; line-height: 20px; }
.node-actions a { border-left: 1px solid var(--border) !important; }
.node-actions button:hover, table.list .node-actions a:hover { color: var(--text); background: var(--surface-alt, #f5f7fb); text-decoration: none; }
.node-actions button:focus-visible, .node-actions a:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; box-shadow: none; }
.node-test-panel { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-alt, #f8fafc); font-size: 0.85rem; }
.node-test-panel[hidden] { display: none; }
.node-test-panel h3 { margin: 0 0 10px; font-size: 0.85rem; }
.node-probe-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--border); }
.node-probe-line:first-child { border-top: 0; padding-top: 0; }
.node-probe-line:last-child { padding-bottom: 0; }
.node-probe-detail { grid-column: 1 / -1; overflow-wrap: anywhere; }
.node-test-caption { margin: 14px 0 0; }
.node-test-ok { color: #18714e; }
.node-test-failed { color: #b42318; }
textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); outline: none; }
.tg-preview { background: #14223a; color: #e8eefb; border-radius: 12px 12px 12px 3px; padding: 10px 14px; max-width: 320px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; line-height: 1.5; }
