:root {
  color-scheme: dark;
  --bg: #0d1117;
  --side: #0b0f14;
  --panel: #151a22;
  --panel2: #10161d;
  --line: #29313b;
  --line2: #222a34;
  --text: #e6edf3;
  --muted: #8ea0b5;
  --accent: #4f8cff;
  --blue: #4f8cff;
  --green: #39d98a;
  --ok: #39d98a;
  --yellow: #f6c85f;
  --red: #ff647c;
  --danger: #ff647c;
  --info: #58a6ff;
  --focus: #8ab4ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, .18);
}
.hidden { display: none !important; }

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px -apple-system, "Segoe UI", Inter, Roboto, Arial, sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
a { color: #8ab4ff; }
a:hover { color: #b8d2ff; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip-link { position: fixed; left: 12px; top: 8px; z-index: 100; transform: translateY(-160%); background: var(--blue); color: #fff; padding: 9px 13px; border-radius: 8px; text-decoration: none; }
.skip-link:focus { transform: translateY(0); }

/* ---------- app shell: sidebar + topbar ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-width: 0; min-height: 100vh; }

.side {
  background: var(--side);
  border-right: 1px solid #202731;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 18px; border-bottom: 1px solid #202731; margin-bottom: 14px; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-icon, .logo { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 8px; object-fit: contain; }
.brand-icon { filter: drop-shadow(0 4px 10px rgba(141, 213, 19, .18)); }
.logo { flex: 0 0 auto; background: linear-gradient(135deg, #dfff52, #83a900); display: grid; place-items: center; color: #111; font-weight: 900; box-shadow: inset 0 1px rgba(255,255,255,.25); }
.brand b { display: block; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.side-group {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px 10px 7px;
  color: #70a8ee;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1.2;
  text-transform: uppercase;
}
.brand + .side-group { margin-top: 2px; }
.side-group::after { content: ""; height: 1px; min-width: 18px; flex: 1; background: #263343; }
.side-nav { display: grid; gap: 2px; }
.side-nav a, .side-nav button {
  border: 0; background: transparent; color: #c0ccd9; text-decoration: none;
  text-align: left; padding: 8px 11px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.side-nav a:hover, .side-nav button:hover { background: #141a22; }
.side-nav a.active { background: #192338; color: #fff; box-shadow: inset 3px 0 var(--blue); }
.side-nav .count { font-size: 10px; color: #8ea0b5; background: #151c25; border: 1px solid #27303b; padding: 2px 6px; border-radius: 999px; }
.side-nav form { margin: 0; }
.side-nav .nav-button { width: 100%; text-align: left; }

.side-account { margin-top: auto; border-top: 1px solid #202731; padding-top: 12px; }
.side-profile { display: grid; grid-template-columns: 34px 1fr; gap: 9px; align-items: center; padding: 8px 9px 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #252d38; border: 1px solid #333d49; font-weight: 700; }
.side-profile b { display: block; font-size: 11px; }
.side-profile small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; }
.top {
  height: 58px; border-bottom: 1px solid #202731; display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; background: #0d1117f2; backdrop-filter: blur(10px); z-index: 20;
}
.top-start, .breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.breadcrumb span:first-child { color: #b9c4d0; }
.breadcrumb b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-link { padding: 7px 8px; border-radius: 7px; color: var(--muted); font-size: 12px; text-decoration: none; }
.top-link:hover { background: #141a22; color: var(--text); }
.mobile-nav-toggle { display: none; width: 44px; height: 44px; padding: 11px; border-color: var(--line); background: var(--panel2); }
.mobile-nav-toggle span { display: block; height: 2px; margin: 3px 0; border-radius: 99px; background: #b8c5d4; }
.side-backdrop { display: none; }
.mobile-tabs { display: none; }
.top .muted { color: var(--muted); }
.content { min-width: 0; max-width: 1500px; margin: auto; padding: 26px; }
.content > * { min-width: 0; }

/* ---------- page header / cards ---------- */
.head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0 0 5px; font-size: 24px; }
.head p { margin: 0; color: var(--muted); font-size: 12px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn { background: var(--blue); color: #fff; border: 1px solid transparent; border-radius: 8px; padding: 9px 13px; font-weight: 600; cursor: pointer; transition: transform .12s ease, filter .12s ease, border-color .12s ease; }
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.alt { background: #111820; border: 1px solid #345987; color: var(--text); }
.btn.danger { background: #2a1419; border: 1px solid #6a2b36; color: #ff9aa5; }
.btn.sm { padding: 6px 9px; font-size: 11px; }
.btn.secondary { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn:disabled, .btn:disabled:hover, .btn:disabled:active {
  border-color: #303845;
  background: #1a2029;
  color: #758397;
  cursor: not-allowed;
  filter: none;
  opacity: .72;
  transform: none;
}
.btn-block { width: 100%; }
a.btn { display: inline-block; text-decoration: none; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px rgba(255,255,255,.015); }
.metric { padding: 17px; }
.metric .k { color: var(--muted); font-size: 12px; }
.metric .v { font-size: 28px; font-weight: 800; margin: 8px 0 3px; }
.metric .s { font-size: 11px; color: #7d8da2; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr); gap: 16px; }
.panel { padding: 18px; margin-bottom: 16px; }
.ph { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.ph h2 { margin: 0; font-size: 15px; }
.ph p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

/* ---------- status pills ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok, .badge.ok { color: var(--green); background: #39d98a12; }
.status.warn { color: var(--yellow); background: #f6c85f12; }
.status.err, .badge.danger { color: var(--red); background: #ff647c12; }
.status.off, .badge.off { color: #8a96a3; background: #8a96a312; }
.status.info, .badge.live { color: var(--info); background: #58a6ff12; }

.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }

/* ---------- health grid ---------- */
.health { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
.hitem { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.hitem label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 8px; }

/* ---------- tables ---------- */
.table-scroll, .table { max-width: 100%; overflow: auto; scrollbar-gutter: stable; }
.table-scroll > table, .table > table { min-width: 850px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #91a3b7; font-weight: 600; text-align: left; padding: 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-sort-button { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 2px 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; text-align: left; cursor: pointer; }
.table-sort-button::after { content: "↕"; color: #5f7188; font-size: 11px; line-height: 1; }
th[aria-sort="ascending"] .table-sort-button, th[aria-sort="descending"] .table-sort-button { color: var(--info); }
th[aria-sort="ascending"] .table-sort-button::after { content: "↑"; color: currentColor; }
th[aria-sort="descending"] .table-sort-button::after { content: "↓"; color: currentColor; }
.table-sort-button:hover { color: var(--text); }
.table-sort-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
.mobile-cell-value { display: contents; }
td { padding: 10px 9px; border-bottom: 1px solid var(--line2); }
tr:last-child td { border-bottom: 0; }
.servers-table :is(th, td):nth-child(n+5):nth-child(-n+7) { width: 1%; padding-left: 6px; padding-right: 6px; white-space: nowrap; }
.name { font-weight: 700; }
.mono { font-family: Consolas, monospace; }
.user-name-cell, .server-name-cell, .plan-name-cell { display: flex; align-items: center; justify-content: space-between; gap: 8px; white-space: nowrap; }
.table-menu { width: 27px; height: 25px; padding: 0 5px 5px; border-color: transparent; background: transparent; color: #718299; line-height: 1; letter-spacing: 1px; opacity: 0; }
.table-menu:focus-visible, tr:hover .table-menu { opacity: 1; }
.table-menu:hover { border-color: var(--line); background: var(--panel2); color: var(--text); }
.table-menu-danger:hover { border-color: #6a2b36; background: #2a1419; color: #ff9aa5; }
.users-tools { display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 10px; align-items: end; margin: 0 0 14px; }
.users-tools label { display: grid; gap: 6px; color: #a6b6c8; font-size: 11px; font-weight: 600; }
.users-tools input, .users-tools select { width: 100%; height: 36px; }
.users-clear { height: 36px; }
.table-result-footer { display: flex; justify-content: flex-end; min-height: 31px; padding: 10px 9px 0; border-top: 1px solid var(--line2); }
.users-result-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.users-table tr[hidden] { display: none !important; }
.users-empty-result { padding: 28px 12px; text-align: center; }

.bar { width: 86px; height: 7px; background: #252d38; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); }
.bar.warnbar i { background: var(--yellow); }

/* ---------- alerts ---------- */
.alerts { display: grid; gap: 9px; }
.alert { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.alert strong { display: block; font-size: 12px; }
.alert span, .alert time { color: var(--muted); font-size: 11px; }

/* ---------- forms ---------- */
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field label { display: block; color: #a9b7c7; font-size: 11px; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: #0f141b; border: 1px solid #303845; color: #fff; border-radius: 7px; padding: 9px; }
.help { font-size: 11px; color: var(--muted); margin-top: 5px; }
.ip { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px; margin-bottom: 8px; }

.detail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.box { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.box span { color: var(--muted); font-size: 11px; }
.box strong { display: block; margin-top: 5px; }
.status-text.ok { color: var(--green); }
.status-text.info { color: var(--info); }
.status-text.err { color: var(--red); }
.status-text.off { color: #8a96a3; }
.empty { text-align: center; padding: 35px; color: var(--muted); border: 1px dashed #35404d; border-radius: 9px; }

/* Generic labeled-field column (dialogs, simple forms) — kept from the
   previous design, still used inside <dialog>s. */
.form-fields { display: flex; flex-direction: column; align-items: stretch; gap: .75rem; max-width: 480px; }
.form-fields label { display: block; font-size: .9rem; color: var(--muted); }
.form-fields label input, .form-fields label select, .form-fields label textarea { display: block; width: 100%; margin-top: .35rem; color: var(--text); font-size: 1rem; }
.form-fields label.check { display: flex; align-items: center; gap: 10px; min-height: 38px; color: var(--muted); }
.form-fields label.check input[type="checkbox"] { display: inline-block; flex: 0 0 18px; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--blue); }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 9px; margin-top: 1.25rem; }
.modal-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 116px; min-height: 42px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.form-grid .wide { grid-column: 1 / -1; }
.marketing-section + .marketing-section { margin-top: 16px; }
.marketing-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.marketing-summary .box strong { font-size: 20px; }
.marketing-card-title { display: flex; align-items: center; gap: 9px; }
.referral-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: center; }
.referral-link-row input { width: 100%; }
.marketing-settings-form { min-width: 0; max-width: none; padding: 2px 0 18px; align-content: start; }
.marketing-settings-form label.check { display: flex; align-items: center; gap: 10px; min-height: 38px; color: var(--muted); }
.marketing-settings-form label.check input[type="checkbox"] { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.marketing-settings-form select[multiple], .form-fields select[multiple] { min-height: 88px; }
.referral-management-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.referral-global-help { margin: -8px 0 0; }
.referral-access-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(8,13,20,.35); }
.referral-access-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.referral-access-head h3, .subsection-heading h3 { margin: 0 0 4px; font-size: 14px; }
.referral-access-head p, .subsection-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.referral-access-head .status { flex: 0 0 auto; }
.referral-user-search { display: block; margin-bottom: 10px; }
.referral-user-search span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.referral-user-search input { width: 100%; }
.referral-users-table { max-height: 430px; overflow: auto; }
.referral-users-table table { min-width: 620px; }
.referral-users-table td:last-child { width: 112px; text-align: right; }
.referral-users-table form { display: inline-flex; }
.subsection-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line2); }
.plan-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.plan-picker legend { margin-bottom: 6px; padding: 0; color: var(--muted); font-size: .9rem; }
.plan-picker-options { display: grid; gap: 6px; max-height: 154px; overflow-y: auto; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: #0f141b; }
label.plan-picker-option { display: flex; align-items: center; gap: 10px; min-height: 38px; margin: 0; padding: 8px 10px; border: 1px solid transparent; border-radius: 7px; color: var(--text); cursor: pointer; transition: border-color .14s ease, background .14s ease; }
label.plan-picker-option:hover { border-color: var(--line); background: rgba(79, 140, 255, .07); }
label.plan-picker-option:focus-within { border-color: #527eb5; box-shadow: 0 0 0 3px rgba(79,140,255,.12); }
label.plan-picker-option input[type="checkbox"] { display: block; flex: 0 0 18px; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--blue); }
.plan-picker-all { margin-bottom: 6px !important; border-color: var(--line) !important; background: var(--panel2); font-weight: 700; }
.plan-picker > small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.plan-picker-empty { padding: 9px 10px; font-size: 12px; }
.referral-table { margin-top: 10px; }
.modal-danger-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line2); }

input, button, select, textarea { padding: .5rem .7rem; border-radius: 7px; border: 1px solid var(--line); background: #0f141b; color: var(--text); }
input, select, textarea { transition: border-color .14s ease, box-shadow .14s ease; }
input:focus, select:focus, textarea:focus { border-color: #527eb5; box-shadow: 0 0 0 3px rgba(79,140,255,.12); outline: none; }
input:disabled, select:disabled { opacity: 1; color: #c6ced8; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: #59687a; }
.recovery-codes { width: 100%; margin-top: 14px; resize: none; line-height: 1.55; letter-spacing: .04em; }
.monitor-node-list { display: grid; gap: 14px; }
.monitor-node { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: rgba(8,13,20,.38); padding: 13px; }
.monitor-node-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.monitor-node-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
.monitor-node-title > strong { font-size: 13px; }
.monitor-checked { color: var(--muted); font-size: 11px; white-space: nowrap; }
.monitor-warnings { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 10px; color: var(--red); font-size: 11px; }
.monitor-empty { padding: 24px; border: 1px dashed var(--line); border-radius: 9px; color: var(--muted); text-align: center; font-size: 12px; }
.monitor-trends { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.mini-chart { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(8,13,20,.45); padding: 9px 10px; }
.mini-chart > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-height: 18px; }
.mini-chart span, .mini-chart small { color: var(--muted); font-size: 11px; }
.mini-chart strong { font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.mini-chart > div:first-child strong { font-size: 12px; text-align: right; }
.mini-chart svg { display: block; width: 100%; height: 34px; margin-top: 6px; overflow: visible; }
.mini-chart polyline { fill: none; stroke: var(--blue); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-empty { height: 34px; margin-top: 6px; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.monitor-fact { display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.network-card { border-color: rgba(74, 222, 128, .28); background: rgba(16, 60, 42, .18); }
.network-value.ok { color: var(--green); }
.network-value.warn { color: var(--orange); }
.network-value.err { color: var(--red); }
.network-value.off { color: var(--muted); }
.server-edit-fields { max-width: none; }
.server-edit-actions { justify-content: flex-end; margin-top: 1.25rem; }
.server-remove-zone { margin-top: 18px; }
.server-row-actions { flex-wrap: nowrap; }
dialog.modal.services-modal { width: min(760px, calc(100vw - 28px)); overflow-x: auto; }
.service-control-list { display: grid; gap: 9px; margin-top: 16px; }
.service-control-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "service status" "actions actions"; gap: 10px 14px; align-items: center; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); }
.service-control-row > :first-child { grid-area: service; min-width: 0; }
.service-control-row > :nth-child(2) { grid-area: status; }
.service-control-row b, .service-control-row small { display: block; }
.service-control-row small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.service-control-actions { grid-area: actions; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.service-control-actions form { min-width: 0; margin: 0; }
.service-control-actions button { width: 100%; }
.btn.service-start { border: 1px solid #286448; background: #10281e; color: #69e4a7; }
.service-control-note { margin-top: 13px; }
.server-reboot-control { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 12px; border: 1px solid rgba(251,113,133,.38); border-radius: 9px; background: rgba(127,29,29,.10); }
.server-reboot-control b, .server-reboot-control span { display: block; }
.server-reboot-control span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.server-reboot-control form { flex: 0 0 auto; margin: 0; }
textarea { resize: vertical; }
button { cursor: pointer; }
form.inline { display: inline; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.admin-promote-form { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; min-width: 0; }
.admin-promote-form select { width: 100%; min-width: 0; max-width: 100%; }
.actions-stack { display: flex; flex-direction: row; flex-wrap: wrap; gap: .35rem; align-items: center; }
.actions-stack form { display: block; }
.actions-stack button { white-space: nowrap; }

details summary { cursor: pointer; color: var(--accent); }
details .devices-table { margin-top: .5rem; min-width: 32rem; }
.devices-table th, .devices-table td { padding: .4rem .5rem; font-size: .9rem; }

pre { background: #0b0d11; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; overflow-x: auto; font-size: .85rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.success { color: var(--ok); }
.flash { display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; margin: 0 0 16px; border: 1px solid; border-radius: 8px; font-size: 12px; }
.flash:before { content: ""; width: 8px; height: 8px; margin-top: 5px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.flash-error { color: #ff9baa; border-color: #61303a; background: #241319; }
.flash-success { color: #69e4a7; border-color: #285b46; background: #10241c; }
.flash-info { color: #91caff; border-color: #294d70; background: #101f2d; }
form[inert] { opacity: .72; }

a.button-link { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; padding: .5rem .9rem; border-radius: 6px; margin-right: .5rem; }

dialog.modal { background: var(--panel); color: var(--text); border: 1px solid #394554; border-radius: 12px; padding: 1.5rem; width: min(520px, calc(100vw - 28px)); max-height: 88vh; overflow-y: auto; box-shadow: 0 28px 90px rgba(0,0,0,.55); }
dialog.modal::backdrop { background: rgba(3, 7, 12, .76); backdrop-filter: blur(3px); }
dialog.modal h3 { margin-top: 0; margin-bottom: .5rem; }
dialog.modal p.muted { margin-top: 0; margin-bottom: 1.1rem; }
dialog.modal code { overflow-wrap: anywhere; }
.deploy-options { border-top: 1px solid var(--line2); padding-top: 10px; }
.deploy-options summary { font-size: 12px; font-weight: 700; }
.deploy-options[open] summary { margin-bottom: 11px; }
.deploy-options label + label { margin-top: 11px; }
.deploy-options p.muted { margin: 0 0 11px; font-size: 11px; }
.deployment-row td { vertical-align: middle; background: rgba(246, 183, 30, .035); }
.deployment-caption { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; line-height: 1.35; }
.deployment-progress { height: 5px; overflow: hidden; margin-bottom: 7px; border-radius: 999px; background: var(--line2); }
.deployment-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4f8cff, #f6b71e); transition: width .3s ease; }
.deployment-progress.large { height: 9px; margin: 4px 0 12px; }
.servers-panel-actions { justify-content: flex-end; }
.servers-panel-actions .badge { margin-left: 3px; padding: 2px 6px; }
dialog.modal.deployment-history-modal { width: min(1120px, calc(100vw - 28px)); overflow-x: auto; }
.deployment-history-head { margin-bottom: 14px; }
.deployment-history-head h3 { margin-bottom: 5px; }
.deployment-history-tools { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(160px, 210px) minmax(180px, 240px); gap: 11px; align-items: end; }
.deployment-history-tools label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 12px; }
.deployment-history-tools :is(input, select) { width: 100%; }
.deployment-history-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin: 10px 0; color: var(--muted); font-size: 12px; }
.deployment-history-table-wrap { max-height: min(58vh, 620px); border: 1px solid var(--line); border-radius: 9px; }
.deployment-history-table { min-width: 880px; }
.deployment-history-table th:nth-child(1) { width: 115px; }
.deployment-history-table th:nth-child(2) { width: 18%; }
.deployment-history-table th:nth-child(3) { width: 17%; }
.deployment-history-table th:nth-child(4) { width: 175px; }
.deployment-history-detail summary { width: max-content; max-width: 100%; color: var(--info); font-weight: 700; cursor: pointer; }
.deployment-history-detail[open] summary { margin-bottom: 9px; }
.deployment-history-detail p { margin: 0; }
.deployment-history-error { color: var(--red); overflow-wrap: anywhere; }
.deployment-history-detail pre { max-height: 270px; margin: 9px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.deployment-history-empty { padding: 24px 12px; }
.deployment-history-table tr[hidden], .deployment-history-empty[hidden] { display: none !important; }
.release-upload-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 920px; padding: 0 18px 14px; }
.release-upload-form label { min-width: 0; }
.release-upload-form input[type="file"] { width: 100%; min-width: 0; max-width: 100%; overflow: hidden; }
.release-bundle-field { display: block; min-width: 0; }
.release-bundle-field small { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; }
.release-bundle-field small, .release-bundle-field small code { overflow-wrap: anywhere; white-space: normal; }
.release-upload-controls { display: grid; grid-template-columns: minmax(0, 680px) auto; align-items: center; gap: 12px; margin-top: 6px; }
.release-upload-button { min-height: 42px; white-space: nowrap; }
.upload-progress, .upload-error { grid-column: 1 / -1; }
.upload-progress { display: grid; gap: 7px; padding-top: 2px; }
.upload-progress > div { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.upload-progress strong { color: var(--text); font-variant-numeric: tabular-nums; }
.upload-progress progress { width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 999px; accent-color: var(--accent); background: var(--line2); }
.upload-progress progress::-webkit-progress-bar { border-radius: 999px; background: var(--line2); }
.upload-progress progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #4f8cff, #f6b71e); }
.upload-progress progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #4f8cff, #f6b71e); }
.upload-error { margin: 0; }
.release-apply-form { flex-wrap: nowrap; align-items: center; }
.release-apply-form select { min-width: 100px; }
.deployment-job-card { max-width: 900px; }
.deployment-timing { display: flex; gap: 24px; color: var(--muted); font-size: 13px; }
.deployment-steps { display: grid; gap: 10px; margin: 22px 0; padding: 0; list-style: none; }
.deployment-steps li { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line2); }
.deployment-steps time { color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.deployment-steps span { display: block; margin-top: 3px; color: var(--muted); }
.deployment-credentials { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.deployment-actions { flex-wrap: nowrap; align-items: center; }
.deployment-actions form { margin: 0; }
.deployment-result-actions { display: flex; justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line2); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.modal-head form { margin: 0; }
dialog.user-modal { width: min(940px, calc(100vw - 28px)); }
.session-button { min-width: 88px; }
dialog.sessions-modal { width: min(1320px, calc(100vw - 28px)); max-width: calc(100vw - 28px); overflow-x: auto; }
.sessions-modal .modal-head > div, .sessions-modal .session-table-wrap { min-width: 0; }
.session-summary { margin-bottom: 16px; }
.session-table { min-width: 980px; }
.session-table td { vertical-align: top; }
.session-transfer { display: inline-grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 7px; align-items: baseline; white-space: nowrap; }
.session-transfer .transfer-down { color: #55a7ff; font-weight: 700; }
.session-transfer .transfer-up { color: #39d98a; font-weight: 700; }
.user-summary { margin-bottom: 16px; }
.modal-section { padding: 15px 0; border-top: 1px solid var(--line); }
.modal-section h4 { margin: 0 0 11px; font-size: 12px; }
.modal-section p:last-child { margin-bottom: 0; }
.modal-section.danger-zone { margin-top: 2px; padding: 14px; border: 1px solid #4d2930; }
.security-admin-list { display: grid; gap: 8px; }
.security-admin-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
.security-admin-item > div:first-child { display: grid; gap: 3px; min-width: 0; }
.security-admin-item > div:first-child span { color: var(--muted); font-size: 11px; }
.security-admin-action { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.security-admin-action form { margin: 0; }
.plan-action { display: flex !important; align-items: center; gap: 7px; }
.plan-action select { min-width: 175px; }
.compact-panel p { margin: 0; }
.advanced-settings { margin-top: 13px; border-top: 1px solid var(--line2); padding-top: 11px; }
.advanced-settings summary { font-size: 11px; }
.advanced-settings .field { margin-top: 11px; }
.advanced-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.advanced-panel > summary span { color: var(--muted); font-size: 11px; font-weight: 400; }
.advanced-panel[open] > summary { padding-bottom: 14px; border-bottom: 1px solid var(--line2); }
.advanced-grid { display: grid; grid-template-columns: minmax(0, .65fr) minmax(0, 1.35fr); gap: 24px; padding-top: 16px; }
.advanced-grid section { min-width: 0; }
.advanced-grid code { overflow-wrap: anywhere; }

/* ---------- auth pages ---------- */
.auth-page { background: #090d12; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1fr) minmax(420px, 520px); }
.auth-intro { position: relative; display: flex; min-width: 0; flex-direction: column; justify-content: space-between; padding: 46px clamp(40px, 6vw, 92px); overflow: hidden; border-right: 1px solid #202731; background: radial-gradient(circle at 20% 15%, rgba(152,197,30,.13), transparent 27%), radial-gradient(circle at 80% 82%, rgba(79,140,255,.14), transparent 32%), #0b1016; }
.auth-intro:after { content: ""; position: absolute; inset: 0; opacity: .22; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 38px 38px; mask-image: linear-gradient(to bottom right, #000, transparent 76%); }
.auth-brand { position: relative; z-index: 1; display: flex; gap: 11px; align-items: center; width: fit-content; color: var(--text); text-decoration: none; }
.auth-brand:hover { color: var(--text); }
.auth-brand .brand-icon, .auth-brand .logo { width: 40px; height: 40px; border-radius: 9px; }
.auth-brand b, .auth-brand small { display: block; }
.auth-brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.auth-copy { position: relative; z-index: 1; max-width: 620px; }
.eyebrow { display: inline-block; color: #aeca67; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.auth-copy h1 { max-width: 590px; margin: 15px 0 16px; font-size: clamp(34px, 4.2vw, 60px); line-height: 1.05; letter-spacing: -.035em; }
.auth-copy p { max-width: 510px; margin: 0; color: var(--muted); font-size: 15px; }
.auth-health { position: relative; z-index: 1; color: var(--muted); font-size: 11px; }
.auth-health span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(57,217,138,.09); }
.auth-card-wrap { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: 38px clamp(28px, 5vw, 62px); background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; margin: auto; padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.auth-card-head { margin-bottom: 22px; }
.auth-card-head h2 { margin: 7px 0 5px; font-size: 23px; }
.auth-card-head p { margin: 0; color: var(--muted); font-size: 12px; }
.auth-form { display: grid; gap: 14px; }
.auth-form .field input { min-height: 42px; }
.auth-secondary-form { margin-top: 10px; }
.label-optional { float: right; color: var(--muted); font-size: 11px; font-weight: 400; }
.auth-switch { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.auth-switch a { font-weight: 600; text-decoration: none; }
.auth-downloads { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.auth-downloads h3 { margin: 0 0 10px; font-size: 13px; }
.auth-download-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.auth-android-download { display: grid; min-width: 0; gap: 12px; }
.auth-android-download > .btn { width: 100%; }
.auth-qr { display: block; width: fit-content; margin: 0 auto; color: var(--muted); text-decoration: none; }
.auth-qr img { width: 92px; height: 92px; padding: 5px; border-radius: 8px; background: #fff; }
.totp-enrollment { display: grid; grid-template-columns: 192px minmax(0, 1fr); gap: 18px; align-items: center; margin: 14px 0 18px; }
.totp-enrollment > img { display: block; width: 192px; height: 192px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.totp-enrollment p { margin: 0 0 8px; }
.totp-manual { margin-top: 12px; }
.totp-manual summary { width: fit-content; color: var(--link); cursor: pointer; }
.totp-manual .copy-row { margin-top: 9px; }
.auth-meta { margin: 18px auto 0; color: var(--muted); font-size: 11px; text-align: center; }

/* ---------- deployment result ---------- */
.result-card { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: start; }
.result-card h2 { margin: 2px 0 6px; font-size: 17px; }
.result-card p { margin: 0; }
.result-icon { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid; border-radius: 50%; font-size: 20px; font-weight: 800; }
.result-success .result-icon { color: var(--green); border-color: #2a6249; background: #10281e; }
.result-error .result-icon { color: var(--red); border-color: #6a2b36; background: #2a1419; }
.credential-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.copy-field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.copy-field > div { display: flex; gap: 6px; }
.copy-field input { width: 100%; min-width: 0; font-family: Consolas, monospace; }
.app-release-main { display: flex; align-items: flex-start; gap: 18px; }
.app-release-list { display: grid; gap: 16px; }
.app-release-list .app-release { margin-bottom: 0; }
.app-release-icon { flex: 0 0 auto; border-radius: 20px; box-shadow: 0 8px 28px #0007; }
.app-release-content { flex: 1 1 auto; min-width: 0; }
.app-release-facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.app-release-facts strong { font-size: 13px; overflow-wrap: anywhere; }
.app-release-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.app-release-hash { margin-top: 14px; }
.app-release-inline-details { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); align-items: center; gap: 18px; margin-top: 14px; }
.app-release-inline-details .app-release-actions { margin-top: 0; flex-wrap: nowrap; }
.app-release-inline-details .app-release-actions .btn { flex: 0 0 auto; white-space: nowrap; }
.app-release-inline-details .app-release-hash { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 0; }
.app-release-inline-details .app-release-hash label { margin: 0; white-space: nowrap; }
.app-release-qr { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.app-release-qr img { width: 112px; height: 112px; padding: 5px; border-radius: 8px; background: #fff; }
.app-release-qr div { display: grid; align-items: start; gap: 7px; }
.apps-publish-feedback { margin-bottom: 16px; }
.app-release-publish { margin-top: 16px; border-top: 1px solid var(--line); }
.app-release-beta { border-color: color-mix(in srgb, var(--yellow) 34%, var(--line)); }
.app-release-publish-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 12px 0; cursor: pointer; list-style: none; }
.app-release-publish-head::-webkit-details-marker { display: none; }
.app-release-publish-head > span:first-child { display: grid; gap: 4px; min-width: 0; }
.app-release-publish-head:focus-visible { border-radius: 7px; outline: 2px solid var(--focus); outline-offset: 3px; }
.disclosure-hint { flex: 0 0 auto; color: var(--link); font-size: 11px; font-weight: 700; white-space: nowrap; }
.disclosure-hint::before { content: "▾"; margin-right: 6px; }
.app-release-publish-disclosure[open] .disclosure-hint::before { content: "▴"; }
.app-release-publish-body { padding: 2px 0 4px; }
.app-release-publish-form { display: grid; grid-template-columns: minmax(135px, .45fr) minmax(280px, 1.3fr) minmax(280px, 1.1fr) minmax(210px, auto); align-items: start; gap: 12px; width: 100%; max-width: none; }
.app-release-publish-form > label { min-width: 0; }
.release-bundle-field input[type="file"],
.app-publish-file input[type="file"], .app-publish-approval input[type="file"] { width: 100%; min-width: 0; min-height: 42px; padding: 4px; background: var(--bg); color: var(--muted); font-size: 12px; cursor: pointer; }
.release-bundle-field input[type="file"]::file-selector-button,
.app-publish-file input[type="file"]::file-selector-button, .app-publish-approval input[type="file"]::file-selector-button {
  min-height: 32px; margin-right: 10px; padding: 6px 11px; border: 1px solid #345987; border-radius: 6px;
  background: #111820; color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.release-bundle-field input[type="file"]::file-selector-button:hover,
.app-publish-file input[type="file"]::file-selector-button:hover, .app-publish-approval input[type="file"]::file-selector-button:hover { border-color: var(--blue); background: #17243b; }
.release-bundle-field input[type="file"]:focus-visible,
.app-publish-file input[type="file"]:focus-visible, .app-publish-approval input[type="file"]:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(138,180,255,.18); outline: 0; }
.app-publish-file small, .app-publish-approval small { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.app-publish-submit { min-width: 210px; min-height: 42px; margin-top: 27px; white-space: nowrap; }
.app-install-help { margin-top: 16px; }
.log-panel summary { cursor: pointer; font-weight: 700; }
.log-panel pre { margin: 14px 0 0; max-height: 520px; }
.support-modal { width: min(820px, calc(100vw - 28px)) !important; }
.support-list-tools { display: grid; grid-template-columns: minmax(240px, 1fr); gap: 10px; align-items: end; padding: 0 18px 16px; }
.support-list-tools label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.support-list-tools input, .support-list-tools select { width: 100%; }
.support-status-column { display: flex; align-items: center; gap: 8px; }
.support-status-column select { width: auto; min-width: 118px; height: 32px; padding: 5px 26px 5px 8px; color: var(--muted); font-size: 11px; font-weight: 500; }
.support-filter-summary { display: flex; justify-content: flex-end; min-height: 20px; margin: -8px 18px 12px; color: var(--muted); font-size: 11px; }
.support-filter-empty { margin: 0 18px 16px; padding: 22px 12px; }
.support-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.support-meta > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.support-meta small { color: var(--muted); }
.support-meta b { overflow-wrap: anywhere; }
.support-description { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-log { max-height: 300px; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-thread-section { display: grid; gap: 14px; }
.support-thread { display: grid; gap: 10px; max-height: min(46vh, 480px); overflow-y: auto; padding: 4px 8px 4px 2px; }
.support-message { width: min(82%, 620px); padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px 13px 13px 4px; background: rgba(255,255,255,.035); }
.support-message.admin { justify-self: end; border-color: rgba(76,132,255,.38); border-radius: 13px 13px 4px 13px; background: rgba(76,132,255,.11); }
.support-message-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.support-message-head time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.support-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.support-reply-form { display: grid; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.support-reply-form textarea { resize: vertical; min-height: 92px; }
.support-send-row { display: grid; grid-template-columns: 230px minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.support-send-row > * { min-width: 0; }
.support-send-row label { display: grid; gap: 5px; margin: 0; color: var(--muted); font-size: 12px; }
.support-send-row select { width: 100%; }
.support-status-help { align-self: center; line-height: 1.35; overflow-wrap: anywhere; }
.support-send-row .btn { min-width: 112px; }
.support-details { display: block; }
.support-details > summary { cursor: pointer; font-weight: 700; color: var(--text); }
.support-details[open] > summary { margin-bottom: 16px; }
.support-attachment { margin-top: 18px; }
.support-screenshot { display: block; width: auto; max-width: 100%; max-height: 520px; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; object-fit: contain; background: #080c12; }
.support-controls { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.support-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; }
.support-footer form { margin: 0; }
.support-footer .btn { min-width: 112px; }
.support-count { min-width: 20px; text-align: center; background: #ef4444 !important; color: #fff !important; }
.mobile-tab-icon { position: relative; }
.support-tab-badge { position: absolute; top: -8px; right: -12px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font: 700 10px/16px system-ui; font-style: normal; }
.support-live-notice { position: fixed; z-index: 10000; right: 20px; bottom: 20px; padding: 12px 16px; border: 1px solid #4c84ff; border-radius: 10px; background: #17243b; color: #fff; box-shadow: 0 12px 32px rgba(0,0,0,.35); cursor: pointer; font: inherit; font-weight: 700; }
.refresh-stale { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 14px; padding: 11px 12px; border: 1px solid #6a5730; border-radius: 9px; background: #241f14; color: #f6d98b; }
.refresh-stale[hidden] { display: none; }
.refresh-stale-copy { display: grid; gap: 2px; min-width: 0; }
.refresh-stale-copy strong { font-size: 12px; }
.refresh-stale-copy span { color: #c9b984; font-size: 11px; overflow-wrap: anywhere; }
.refresh-stale-retry { flex: 0 0 auto; min-width: 96px; }
.audit-head { align-items: center; }
.audit-search { display: grid; grid-template-columns: minmax(240px, 1fr) auto auto; align-items: end; gap: 8px; margin: 2px 0 16px; }
.audit-search .field { margin: 0; }
.ok-notice { margin-bottom: 14px; border-color: #24563f; background: #10241b; color: #80e9b8; }
.traffic-period-form { display: flex; align-items: center; gap: 10px 12px; margin: 0 0 14px; flex-wrap: wrap; }
.traffic-period-range, .traffic-period-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.traffic-period-caption { color: var(--muted); white-space: nowrap; }
.traffic-period-form label { display: flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; }
.traffic-period-form input { width: 150px; min-width: 0; }
.traffic-period-form .error { flex: 1 0 100%; }
.report-filter-panel { display: grid; gap: 14px; }
.report-quick-ranges, .report-period-form { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.report-period-form .field { width: min(220px, 100%); }
.report-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.http-telemetry-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.http-telemetry-summary .box { min-width: 0; }
.http-telemetry-summary .box strong { display: block; margin-top: 7px; font-size: 20px; }
.http-telemetry-summary .box small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.45; }
.http-telemetry-filter { margin-bottom: 16px; }
.traffic-chart-scroll { overflow-x: auto; padding: 4px 0 0; scrollbar-gutter: stable; }
.traffic-chart-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.traffic-chart { display: block; min-width: 760px; width: 100%; height: 230px; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-download { fill: var(--blue); }
.chart-upload { fill: var(--green); }
.chart-label { fill: var(--muted); font-size: 8px; transform: rotate(45deg); transform-box: fill-box; transform-origin: center; }

/* ---------- settings / web certificate ---------- */
.settings-layout { width: 100%; min-width: 0; align-items: start; }
.settings-layout > .panel { min-width: 0; min-height: 0; }
.panel-maintenance-panel .row { flex-wrap: wrap; }
.panel-maintenance-panel details code { display: block; max-width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); overflow-wrap: anywhere; white-space: pre-wrap; }
.certificate-panel .ph > div { min-width: 0; flex: 1 1 220px; }
.certificate-panel .ph > .status { flex: 0 0 auto; }
.mail-settings-panel { margin-top: 12px; }
.mail-workflow-heading { display: flex; align-items: center; gap: 11px; margin: 4px 0 13px; }
.mail-workflow-heading > div { min-width: 0; }
.mail-workflow-heading h3 { margin: 0 0 3px; font-size: 14px; }
.mail-workflow-heading p { margin: 0; }
.mail-workflow-heading > .status { margin-left: auto; }
.mail-step { display: grid; flex: 0 0 28px; width: 28px; height: 28px; place-items: center; border: 1px solid #345987; border-radius: 50%; background: #17243b; color: var(--accent); font-size: 12px; font-weight: 800; }
.mail-settings-form { display: grid; gap: 13px; }
.mail-method-row { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.1fr); gap: 13px; align-items: stretch; }
.mail-mode-description { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); color: var(--muted); font-size: 12px; line-height: 1.45; }
.mail-mode-description b { color: var(--text); font-size: 12px; }
.mail-mode-description[hidden], [data-smtp-external][hidden], [data-smtp-local][hidden] { display: none !important; }
.mail-config-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); }
.mail-config-heading { margin-bottom: 13px; }
.mail-config-heading h3 { margin: 0 0 4px; font-size: 13px; }
.mail-config-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.mail-external-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 13px; align-items: start; }
.mail-external-grid .smtp-host-field { grid-column: span 3; }
.mail-external-grid .smtp-port-field { grid-column: span 1; }
.mail-external-grid .smtp-security-field { grid-column: span 2; }
.mail-external-grid .smtp-username-field,
.mail-external-grid .smtp-password-field { grid-column: span 3; }
.mail-external-grid .smtp-from-field { grid-column: 1 / -1; }
.mail-local-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.mail-settings-actions { justify-content: flex-end; margin-top: 14px; }
.mail-verification-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.mail-verification { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end; margin-top: 10px; padding: 18px; border: 1px solid #315072; border-radius: 10px; background: #0d1622; }
.mail-verification h4 { margin: 0 0 5px; font-size: 13px; }
.mail-verification p { margin: 0; }
.mail-verification-controls { display: flex; align-items: end; gap: 10px; }
.mail-verification-controls .field { min-width: 190px; margin: 0; }
.mail-verification-controls .btn { white-space: nowrap; }
.mail-verification-empty { margin: 8px 0 0 39px; }
.mail-deployment { margin-top: 20px; border-top: 1px solid var(--line); }
.mail-deployment > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; padding: 12px 0; cursor: pointer; list-style: none; }
.mail-deployment > summary::-webkit-details-marker { display: none; }
.mail-deployment > summary > span:first-child { display: grid; gap: 3px; min-width: 0; }
.mail-deployment > summary small { color: var(--muted); font-weight: 400; }
.mail-deployment > summary:focus-visible { border-radius: 7px; outline: 2px solid var(--focus); outline-offset: 3px; }
.mail-deployment[open] > summary .disclosure-hint { font-size: 0; }
.mail-deployment[open] > summary .disclosure-hint::after { content: "Скрыть"; font-size: 11px; }
.mail-deployment-body { padding: 2px 0 4px; }
.mail-deployment-head h3 { margin: 0 0 5px; font-size: 15px; }
.mail-deployment-head p { margin: 0 0 13px; }
.mail-dns-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.mail-dns-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); }
.mail-dns-row > b { color: var(--accent); font-size: 12px; }
.mail-dns-row > span { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; max-width: 100%; gap: 3px; }
.mail-dns-row small { min-width: 0; max-width: 100%; overflow-wrap: anywhere; color: var(--muted); }
.mail-dns-row code, .mail-dns-row em { min-width: 0; max-width: 100%; overflow-wrap: anywhere; color: var(--text); font-size: 11px; font-style: normal; }
.mail-dns-wide { grid-column: 1 / -1; }
.routing-preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.routing-preset-card { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.routing-preset-card.is-disabled { opacity: .7; }
.routing-preset-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.routing-preset-heading { display: flex; min-width: 0; align-items: center; flex-wrap: wrap; gap: 8px; }
.routing-preset-title h3 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.routing-preset-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.routing-preset-actions form { margin: 0; }
.routing-preset-modes { display: flex; min-height: 34px; margin: 10px 0; align-items: flex-start; flex-wrap: wrap; gap: 7px; }
.routing-mode-badge { display: inline-flex; min-height: 28px; align-items: center; padding: 5px 8px; border: 1px solid #345987; border-radius: 999px; color: #b8d2ff; background: rgba(79, 140, 255, .08); font-size: 11px; font-weight: 700; line-height: 1.35; }
.routing-preset-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 11px; }
.routing-preset-facts span { padding: 6px 8px; border: 1px solid var(--line2); border-radius: 7px; color: var(--muted); font-size: 11px; background: var(--bg); }
.routing-preset-facts b { color: var(--text); }
.routing-preset-card details { border-top: 1px solid var(--line2); padding-top: 10px; }
.routing-preset-card summary { color: var(--accent); cursor: pointer; font-size: 11px; font-weight: 700; }
.routing-preset-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.routing-preset-rules > div:first-child { grid-column: 1 / -1; }
.routing-preset-rules b { display: block; margin-bottom: 5px; font-size: 11px; }
.routing-preset-rules pre { max-height: 190px; margin: 0; padding: 9px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
.routing-presets-empty { grid-column: 1 / -1; }
dialog.routing-preset-modal { width: min(780px, calc(100vw - 28px)); }
dialog.modal.routing-import-modal { width: min(780px, calc(100vw - 28px)); max-width: calc(100vw - 28px); min-width: 0; }
.routing-preset-form, .routing-preset-form > label, .routing-preset-form > fieldset, .routing-preset-form :is(input, select, textarea) { min-width: 0; max-width: 100%; }
.routing-preset-form textarea { width: 100%; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.routing-mode-picker { min-width: 0; max-width: 100%; margin: 0; padding: 0; border: 0; }
.routing-mode-picker legend { padding: 0; color: var(--text); font-size: 12px; font-weight: 700; }
.routing-mode-picker legend span { color: var(--red); }
.routing-mode-picker > .help { margin: 5px 0 8px; }
.routing-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; min-width: 0; }
label.routing-mode-option { display: grid; grid-template-columns: 20px minmax(0, 1fr); min-width: 0; min-height: 68px; margin: 0; padding: 11px; align-items: start; gap: 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--panel2); cursor: pointer; transition: border-color .14s ease, background .14s ease, box-shadow .14s ease; }
label.routing-mode-option:hover { border-color: #3b587c; background: rgba(79, 140, 255, .06); }
label.routing-mode-option:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(79, 140, 255, .12); }
label.routing-mode-option:has(input:checked) { border-color: #527eb5; background: rgba(79, 140, 255, .1); }
label.routing-mode-option input[type="checkbox"] { display: block; width: 18px; height: 18px; margin: 1px 0 0; padding: 0; accent-color: var(--blue); }
.routing-mode-option span { min-width: 0; overflow-wrap: anywhere; }
.routing-mode-option b, .routing-mode-option small { display: block; }
.routing-mode-option b { font-size: 12px; line-height: 1.35; }
.routing-mode-option small { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.4; }
.routing-mode-error { display: block; margin-top: 7px; color: var(--red); font-size: 11px; }
.routing-mode-error[hidden] { display: none; }
.routing-preset-enabled { display: flex; align-self: end; min-height: 42px; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.routing-preset-enabled input[type="checkbox"] { display: block; flex: 0 0 18px; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--blue); }
.routing-preset-danger { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.routing-preset-danger form { margin: 0; }
.routing-import-form { display: grid; width: 100%; min-width: 0; max-width: 100%; gap: 15px; }
.routing-import-form > * { min-width: 0; max-width: 100%; }
.routing-import-form > :is(h3, p) { margin: 0; }
.routing-import-file { display: grid; min-width: 0; max-width: 100%; gap: 6px; }
.routing-import-file > label { color: var(--text); font-size: 12px; font-weight: 700; }
.routing-import-file > label span { color: var(--red); }
.routing-json-file { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 46px; overflow: hidden; padding: 5px; border: 1px solid #303845; border-radius: 8px; color: var(--muted); background: #0f141b; font-size: 12px; cursor: pointer; }
.routing-json-file::file-selector-button { min-height: 34px; margin-right: 10px; padding: 7px 11px; border: 1px solid #345987; border-radius: 7px; color: var(--text); background: #111820; font: inherit; font-weight: 600; cursor: pointer; }
.routing-json-file:hover::file-selector-button { border-color: #527eb5; background: #172131; }
.routing-import-file .help, .routing-import-file code { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.routing-import-file code { color: var(--text); font-size: 10px; }
.routing-import-validation { margin: 2px 0 0; padding: 9px 10px; border: 1px solid transparent; border-radius: 8px; font-size: 11px; line-height: 1.45; }
.routing-import-validation.is-valid { border-color: #1e6147; color: #72e6ad; background: #0d271e; }
.routing-import-validation.is-error { border-color: #73313b; color: #ff9aa7; background: #2b1116; }
.routing-import-toolbar { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.routing-import-toolbar .routing-preset-enabled { min-width: 0; max-width: 100%; margin: 0; overflow-wrap: anywhere; }
.routing-import-toolbar .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.routing-import-atomic { min-width: 0; max-width: 100%; padding: 11px 12px; border: 1px solid #5f5127; border-radius: 8px; color: #f0d57c; background: #211d10; overflow-wrap: anywhere; font-size: 11px; }
.routing-import-atomic b { color: #ffe29a; }
.routing-preset-modal .modal-actions .btn, .routing-presets-head .btn { min-height: 44px; }
.activation-result { text-align: center; }
.activation-result h2, .activation-result p, .auth-note { overflow-wrap: anywhere; }
.device-reactivation-form { display: grid; min-width: 0; gap: 10px; margin-top: 16px; }
.device-reactivation-form .form-error { margin: 0; color: var(--danger); font-size: 11px; }
.auth-note { margin: 0; color: var(--muted); font-size: 12px; }
.auth-result-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 50%; font-size: 26px; font-weight: 800; }
.auth-result-icon.success { color: #70db70; background: rgba(46, 160, 67, .14); border: 1px solid rgba(46, 160, 67, .35); }
.auth-result-icon.error { color: #ff7b72; background: rgba(248, 81, 73, .13); border: 1px solid rgba(248, 81, 73, .32); }
.dns-form, .dns-form .field { min-width: 0; }
.dns-form { margin-bottom: 16px; }
.dns-form input { max-width: 100%; }
.settings-actions { margin: 0 0 14px; }
.certificate-summary { margin-bottom: 14px; }
.certificate-diagnostic { margin-top: 14px; }

/* ---------- account page: profile sub-navigation ---------- */
.account-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 16px; }
.account-menu, .account-body { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.account-menu { padding: 14px; align-self: start; position: sticky; top: 84px; }
.account-profile { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; padding: 8px 7px 14px; border-bottom: 1px solid var(--line); }
.account-profile .avatar { width: 40px; height: 40px; }
.account-profile b { display: block; font-size: 12px; }
.account-profile small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.role-badge { display: inline-block; margin-top: 6px; color: #86b8ff; background: #4f8cff15; padding: 4px 7px; border-radius: 999px; font-size: 10px; }
.account-nav { display: grid; gap: 3px; padding-top: 11px; }
.account-nav a, .account-nav button { border: 0; background: transparent; color: #a8b6c7; text-decoration: none; text-align: left; padding: 10px; border-radius: 7px; cursor: pointer; display: flex; justify-content: space-between; }
.account-nav a:hover, .account-nav button:hover { background: #141a22; }
.account-nav a.active, .account-nav button.active { background: #192338; color: #fff; box-shadow: inset 3px 0 var(--blue); }
.account-nav small { color: var(--muted); }
.account-body { padding: 20px; min-height: 560px; }
.account-pane { display: none; }
.account-pane.active { display: block; }
.account-pane-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; }
.account-pane-head h2 { margin: 0 0 5px; font-size: 17px; }
.account-pane-head p { margin: 0; color: var(--muted); font-size: 11px; }
.account-section { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 15px; margin-bottom: 14px; }
.account-section h3 { margin: 0 0 12px; font-size: 12px; }
.promo-account-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 10px; align-items: end; }
.promo-account-form .field { min-width: 0; }
.promo-account-form .btn { min-height: 36px; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.summary3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.account-state-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.account-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.account-item:last-child { border-bottom: 0; }
.account-item b { display: block; font-size: 11px; margin-bottom: 4px; }
.account-item span { color: var(--muted); font-size: 11px; }
.notice { border: 1px solid #5f5127; background: #211d10; color: #f0d57c; border-radius: 7px; padding: 10px; font-size: 11px; }
.danger-zone { border: 1px solid #4d2930; background: #1b1216; border-radius: 8px; padding: 14px; display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.danger-zone b { display: block; font-size: 11px; color: #ff9aa5; margin-bottom: 4px; }
.danger-zone span { font-size: 11px; color: #c19aa3; }

/* A plain tap-through menu — kept for any leftover simple list use. */
.menu-list { display: flex; flex-direction: column; }
.menu-row { border-bottom: 1px solid var(--line); }
.menu-row:last-child { border-bottom: none; }
button.menu-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: .9rem .2rem; border: none; background: transparent; color: var(--text); font: inherit; font-size: 1rem; text-align: left; cursor: pointer; }
button.menu-item:hover { color: var(--accent); }
button.menu-item::after { content: "\203A"; color: var(--muted); font-size: 1.3rem; margin-left: .5rem; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 200px minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid2, .split { grid-template-columns: minmax(0, 1fr); }
  .health { grid-template-columns: repeat(3, 1fr); }
  .account-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .credential-grid { grid-template-columns: 1fr; }
  .advanced-grid { grid-template-columns: 1fr; }
  .monitor-trends { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .referral-management-grid { grid-template-columns: minmax(0, 1fr); }
  .app-release-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-release-inline-details { grid-template-columns: 1fr; align-items: stretch; }
  .app-release-inline-details .app-release-actions { flex-wrap: wrap; }
  .app-release-inline-details .app-release-hash { display: block; }
  .app-release-inline-details .app-release-hash label { margin-bottom: 6px; }
  .app-release-publish-form { grid-template-columns: minmax(140px, .55fr) minmax(0, 1.45fr); }
  .app-publish-submit { grid-column: 1 / -1; justify-self: start; margin-top: 0; }
}
@media (max-width: 920px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { min-height: 265px; padding: 28px clamp(24px, 7vw, 64px); }
  .auth-copy h1 { margin: 12px 0 10px; font-size: clamp(28px, 6vw, 42px); }
  .auth-health { display: none; }
  .auth-card-wrap { padding: 34px 24px; }
  .referral-management-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .account-layout { grid-template-columns: 1fr; }
  .account-menu { position: static; }
  .account-nav { grid-template-columns: repeat(2, 1fr); }
  .account-grid, .summary3, .account-state-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
	.side .side-nav a, .side .side-nav button { padding-block: 10px; }
	.monitor-node-head { align-items: flex-start; flex-direction: column; gap: 8px; }
	.monitor-node-title { width: 100%; }
	.monitor-checked { white-space: normal; }
	details > summary { box-sizing: border-box; min-height: 44px; padding-block: 12px; }
	.support-send-row { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
	.app-release-publish-form { grid-template-columns: minmax(0, 1fr); }
	.app-publish-file, .app-publish-approval, .app-publish-submit { grid-column: auto; }
	.app-publish-submit { width: 100%; margin-top: 0; }
	dialog.modal.deployment-history-modal { width: calc(100vw - 40px); }
	.routing-preset-grid { grid-template-columns: minmax(0, 1fr); padding: 0; }
	.routing-preset-rules { grid-template-columns: minmax(0, 1fr); }
	.routing-preset-rules > div:first-child { grid-column: auto; }
	.routing-mode-options { grid-template-columns: minmax(0, 1fr); }
	dialog.modal.routing-import-modal { width: calc(100vw - 24px); max-width: calc(100vw - 24px); }
	.routing-import-modal .routing-mode-option > span { min-width: 0; overflow-wrap: anywhere; }
	.routing-import-toolbar { align-items: stretch; flex-direction: column; }
	.routing-import-toolbar .routing-preset-enabled { align-self: stretch; }
	.routing-import-toolbar .btn { width: 100%; }
	.routing-import-modal .modal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
	.routing-import-modal .modal-actions .btn { width: 100%; min-width: 0; padding-inline: 8px; }
	.routing-preset-title { align-items: stretch; flex-direction: column; }
	.routing-preset-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: auto; max-width: 100%; min-width: 0; align-self: stretch; }
	.routing-preset-actions form { width: 100%; min-width: 0; }
	.routing-preset-actions .btn { width: 100%; min-width: 0; padding-inline: 8px; }
  .marketing-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .app-release-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .wide { grid-column: auto; }
  .referral-link-row { grid-template-columns: 1fr; }
  .referral-link-row .btn { width: 100%; }
  .referral-access-head { align-items: stretch; flex-direction: column; }
  .referral-access-head .status { align-self: flex-start; }
  .referral-users-table { max-height: none; }
  .referral-users-table table { min-width: 0; }
  .marketing-settings-form .modal-actions { justify-content: stretch; }
  .marketing-settings-form .modal-actions .btn { width: 100%; }
  .deployment-history-modal .modal-head { align-items: stretch; flex-direction: column; }
  .deployment-history-modal .modal-head form, .deployment-history-modal .modal-head button { width: 100%; }
  .deployment-history-tools { grid-template-columns: minmax(0, 1fr); }
  .deployment-history-search { grid-column: auto; }
  .deployment-history-summary { align-items: stretch; flex-direction: column; }
  .deployment-history-summary .btn { width: 100%; }
  .app { display: block; }
  .js .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); height: 100dvh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 24px 0 70px rgba(0,0,0,.4); }
  .js body.nav-open .side { transform: translateX(0); }
  .side-backdrop { position: fixed; inset: 0; z-index: 25; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(2,6,10,.66); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .js .side-backdrop { display: block; }
  .js body.nav-open .side-backdrop { opacity: 1; pointer-events: auto; }
  .js body.nav-open { overflow-y: hidden; }
  .mobile-nav-toggle { display: block; }
  .mobile-tabs {
    position: fixed; z-index: 24; inset: auto 0 0; display: grid;
    grid-auto-flow: column; grid-auto-columns: 1fr; min-height: 64px;
    padding: 5px max(8px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid #26303b; background: rgba(11, 15, 20, .96); backdrop-filter: blur(14px);
    box-shadow: 0 -12px 34px rgba(0,0,0,.24);
  }
  .mobile-tabs a { min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 9px; color: #7f90a4; text-decoration: none; }
  .mobile-tabs a span { height: 22px; font-size: 20px; line-height: 22px; }
  .mobile-tabs a b { max-width: 100%; overflow: hidden; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-tabs a.active { color: #b9d2ff; background: #192338; }
  .top { height: 56px; padding: 0 16px; }
  .mobile-nav-toggle { min-width: 44px; min-height: 44px; }
  .top-link { display: none; }
  .cards, .form, .detail { grid-template-columns: minmax(0, 1fr); }
  .admin-promote-form { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .content { padding: 16px 14px calc(82px + env(safe-area-inset-bottom)); }
  .head { align-items: flex-start; flex-direction: column; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1 1 auto; }
  .health { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 15px; }
  .btn, .btn.sm { min-height: 44px; }
  input[type="search"], .users-clear { min-height: 44px; height: 44px; }
  label.check, label.plan-picker-option { min-height: 44px; }
  .release-upload-form { grid-template-columns: minmax(0, 1fr); padding: 0 14px 14px; }
  .release-upload-controls { grid-template-columns: minmax(0, 1fr); }
  .release-upload-button { width: 100%; }
  input, select, textarea { min-width: 0; font-size: 16px; }
  .ip { grid-template-columns: 1fr; }
  .mono { overflow-wrap: anywhere; }
  .table-scroll, .table { overflow: visible; }
  .table-scroll > table.mobile-table, .table > table.mobile-table, table.mobile-table.devices-table { display: block; min-width: 0; width: 100%; }
  .mobile-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .mobile-table tbody { display: grid; gap: 10px; width: 100%; }
  .mobile-table tr { display: block; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
  .mobile-table td { display: grid; grid-template-columns: minmax(86px, .72fr) minmax(0, 1.28fr); gap: 12px; align-items: start; min-width: 0; padding: 10px 11px; border-bottom: 1px solid var(--line2); overflow-wrap: anywhere; }
  .mobile-table :is(th, td) { width: auto !important; white-space: normal !important; }
  .mobile-table td:last-child { border-bottom: 0; }
  .mobile-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.4; }
  .mobile-table td > .mobile-cell-value { display: block; grid-column: 2; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .mobile-table td[colspan] { display: block; padding: 22px 12px; text-align: center; }
  .mobile-table td[colspan]::before { display: none; }
  .mobile-table td > form, .mobile-table td > .row, .mobile-table td > .name { min-width: 0; max-width: 100%; }
  .mobile-table .status { width: max-content; max-width: 100%; justify-self: start; }
  .mobile-table .bar { width: 100%; max-width: 130px; justify-self: end; }
  .mobile-table .table-menu { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; opacity: 1; }
  details .devices-table { min-width: 0; }
  dialog.modal { padding: 18px; }
  dialog.modal[open] {
    max-height: calc(100dvh - 92px - env(safe-area-inset-bottom));
    margin: 8px auto calc(76px + env(safe-area-inset-bottom));
  }
  .account-nav { grid-template-columns: 1fr 1fr; }
  .certificate-panel .ph { align-items: flex-start; flex-direction: column; }
  .certificate-panel .ph > div { width: 100%; flex: 0 1 auto; }
  .mail-method-row { grid-template-columns: 1fr; }
  .mail-external-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mail-external-grid .smtp-host-field,
  .mail-external-grid .smtp-from-field { grid-column: 1 / -1; }
  .mail-external-grid .smtp-port-field,
  .mail-external-grid .smtp-security-field,
  .mail-external-grid .smtp-username-field,
  .mail-external-grid .smtp-password-field { grid-column: auto; }
  .mail-dns-grid { grid-template-columns: 1fr; }
  .mail-dns-wide { grid-column: auto; }
  .mail-verification-empty { margin-left: 39px; }
  #mail-outbox .table-wrap { overflow: visible; border: 0; }
  .totp-enrollment { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .totp-enrollment > div { width: 100%; min-width: 0; }
  .totp-manual summary { margin-inline: auto; }
  .auth-intro { min-height: auto; gap: 32px; padding: 22px 20px 26px; }
  .auth-copy h1 { font-size: 25px; }
  .auth-copy p { font-size: 12px; }
  .auth-card-wrap { padding: 24px 14px; }
  .auth-card { padding: 22px 18px; }
  .monitor-trends { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .service-control-row { gap: 8px 12px; }
  .users-tools { grid-template-columns: minmax(0, 1fr) auto; }
  .sessions-modal .modal-head { align-items: stretch; flex-direction: column; }
  .sessions-modal .modal-head form, .sessions-modal .modal-head button { width: 100%; }
  .mobile-table.sortable-table thead { position: static; display: block; width: auto; height: auto; margin: 0 0 10px; overflow: visible; clip: auto; white-space: normal; }
  .mobile-table.sortable-table thead tr { display: flex; flex-wrap: wrap; gap: 7px; overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .mobile-table.sortable-table thead th { display: none; }
  .mobile-table.sortable-table thead th.sortable-column { display: block; padding: 0; border: 0; }
  .mobile-table.sortable-table .table-sort-button { min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel2); }
  .mobile-table.sortable-table .support-status-column { flex-wrap: wrap; }
  .mobile-table.sortable-table .support-status-column select { min-height: 44px; }
  .support-live-notice { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; text-align: left; }
  .refresh-stale { align-items: stretch; flex-direction: column; }
  .refresh-stale-retry { width: 100%; min-height: 44px; }
  .deployment-history-table-wrap { max-height: none; border: 0; }
  .deployment-history-table { min-width: 0; }
  .deployment-history-detail summary { width: auto; }
}
@media (max-width: 600px) {
	/* The activation page is also opened by mobile mail clients. Keep its
	   confirmation card fully visible without changing the other auth forms. */
	.auth-card:has(.activation-result) { width: 100%; max-width: 300px; padding: 20px 16px; }
	.auth-card:has(.activation-result) .activation-result { min-width: 0; }
	.auth-card:has(.activation-result) .activation-result h2 { font-size: 21px; }
	.auth-card-wrap:has(.activation-result) { justify-content: flex-start; padding: 18px 10px 24px; }
	.auth-intro:has(+ .auth-card-wrap .activation-result) { min-height: auto; padding: 16px 18px; border-right: 0; border-bottom: 1px solid #202731; }
	.auth-intro:has(+ .auth-card-wrap .activation-result) .auth-copy,
	.auth-intro:has(+ .auth-card-wrap .activation-result) .auth-health { display: none; }
}
@media (max-width: 480px) {
	.deployment-history-tools { grid-template-columns: 1fr; }
	.deployment-history-search { grid-column: auto; }
	.deployment-history-summary { align-items: stretch; flex-direction: column; }
	.deployment-history-summary .btn { width: 100%; }
	.routing-presets-head .btn { width: 100%; }
	.routing-preset-title { align-items: stretch; flex-direction: column; }
	.routing-preset-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: auto; max-width: 100%; min-width: 0; align-self: stretch; }
	.routing-preset-actions form { width: 100%; min-width: 0; }
	.routing-preset-actions .btn { width: 100%; min-width: 0; padding-inline: 8px; }
	.routing-preset-danger { align-items: stretch; flex-direction: column; }
	.routing-preset-danger .btn { width: 100%; }
  .cards, .health, .account-nav { grid-template-columns: 1fr; }
  .breadcrumb span:first-child, .breadcrumb span:nth-child(2) { display: none; }
  .head-actions { display: grid; }
  .head { gap: 14px; }
  .head h1 { font-size: 22px; }
  .head-actions .btn, .app-release-actions .btn { width: 100%; text-align: center; }
  .copy-field > div { align-items: stretch; flex-direction: column; }
  .app-release-main { flex-direction: column; }
  .app-release-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .app-release-icon { width: 68px; height: 68px; border-radius: 16px; }
  .app-release-actions { align-items: stretch; flex-direction: column; }
  .app-release-qr { align-items: flex-start; }
  .app-release-publish-head, .mail-deployment > summary { align-items: flex-start; flex-direction: column; gap: 7px; }
  .app-release-publish-head .disclosure-hint, .mail-deployment > summary .disclosure-hint { min-height: 30px; display: inline-flex; align-items: center; }
  .app-release-publish-form { grid-template-columns: 1fr; }
  .app-publish-file, .app-publish-submit { grid-column: auto; }
  .app-publish-submit { width: 100%; }
  .account-body { min-height: 0; padding: 14px; }
  .account-section { padding: 12px; }
  .promo-account-form { grid-template-columns: minmax(0, 1fr); }
  .promo-account-form .btn { width: 100%; }
  .security-admin-item { grid-template-columns: 1fr; align-items: stretch; }
  .security-admin-action { justify-content: flex-start; flex-wrap: wrap; }
  .security-admin-action form, .security-admin-action .btn { width: 100%; }
  .row { align-items: stretch; }
  .row > .btn, .row > button, .actions-stack > form, .actions-stack > form > button { width: 100%; }
  dialog.modal { width: calc(100vw - 12px); padding: 16px; }
  .support-meta { grid-template-columns: minmax(0, 1fr); }
  .support-list-tools { grid-template-columns: minmax(0, 1fr); padding: 0 14px 14px; }
  .support-filter-summary { margin: -6px 14px 12px; }
  .support-filter-empty { margin: 0 14px 14px; }
  .support-controls { align-items: stretch; flex-direction: column; }
  .support-message { width: 94%; }
  .support-message-head { flex-wrap: wrap; row-gap: 4px; }
  .support-message-head b { min-width: 0; overflow-wrap: anywhere; }
  .support-message-head time { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .support-footer { width: 100%; margin-left: 0; }
  .support-footer .btn { width: auto; }
  .audit-search { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .traffic-period-form { align-items: stretch; flex-direction: column; }
  .traffic-period-range { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .traffic-period-caption { grid-column: 1 / -1; }
  .traffic-period-form label { display: contents; }
  .traffic-period-form label span { align-self: center; }
  .traffic-period-form input { width: 100%; }
  .traffic-period-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .traffic-period-actions .btn { width: 100%; }
  .report-summary { grid-template-columns: 1fr; }
  .http-telemetry-summary { grid-template-columns: 1fr; }
  .report-quick-ranges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-quick-ranges .btn, .report-period-form .btn { width: 100%; }
  .report-period-form { align-items: stretch; }
  .report-period-form .field { width: 100%; }
  .auth-intro { padding: 16px 18px; border-right: 0; border-bottom: 1px solid #202731; }
  .auth-copy, .auth-health { display: none; }
  .auth-card-wrap { justify-content: flex-start; padding: 14px 10px 24px; }
  .auth-card { max-width: none; padding: 20px 16px; }
  .mail-external-grid, .mail-local-grid { grid-template-columns: 1fr; }
  .mail-external-grid .smtp-host-field,
  .mail-external-grid .smtp-port-field,
  .mail-external-grid .smtp-security-field,
  .mail-external-grid .smtp-username-field,
  .mail-external-grid .smtp-password-field,
  .mail-external-grid .smtp-from-field { grid-column: auto; }
  .mail-config-card { padding: 12px; }
  .mail-settings-actions { align-items: stretch; flex-direction: column; }
  .mail-settings-actions .btn { width: 100%; }
  .mail-verification { grid-template-columns: 1fr; padding: 14px; }
  .mail-verification-controls { align-items: stretch; flex-direction: column; }
  .mail-verification-controls .field { min-width: 0; }
  .mail-verification-controls .btn { width: 100%; }
  .mail-workflow-heading { align-items: flex-start; }
  .mail-workflow-heading > .status { margin: 3px 0 0; }
  .mail-verification-empty { margin-left: 0; }
  .totp-enrollment { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .totp-enrollment > div { width: 100%; }
  .totp-manual summary { margin-inline: auto; }
  .totp-manual .copy-row { align-items: stretch; flex-direction: column; text-align: left; }
  .totp-manual .copy-row .btn { width: 100%; }
  .mail-dns-row { grid-template-columns: 42px minmax(0, 1fr); align-items: start; }
  .mail-dns-row .btn { grid-column: 2; justify-self: start; }
  .result-card { grid-template-columns: 36px minmax(0, 1fr); }
  .result-icon { width: 34px; height: 34px; font-size: 16px; }
  .monitor-trends { grid-template-columns: 1fr; }
  .service-control-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "service" "status" "actions"; }
  .service-control-actions { grid-template-columns: 1fr; }
  .server-reboot-control { align-items: stretch; flex-direction: column; }
  .server-reboot-control button { width: 100%; }
  .release-apply-form { flex-wrap: wrap; }
}
@media (max-width: 370px) {
  .app-release-facts { grid-template-columns: 1fr; }
  .app-release-qr { flex-direction: column; }
  .app-release-qr > div { width: 100%; }
  .app-release-qr .btn { width: 100%; text-align: center; }
  .mobile-table td { grid-template-columns: 1fr; gap: 4px; }
  .mobile-table td > .mobile-cell-value { grid-column: 1; }
}
@media (max-width: 360px) {
  .marketing-summary { grid-template-columns: minmax(0, 1fr); }
}
@media (hover: none) {
  .table-menu { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
