:root {
  color-scheme: dark;
  --bg: #071019;
  --surface: #0d1823;
  --surface-2: #111f2c;
  --surface-3: #172838;
  --border: #263b4d;
  --text: #edf5fb;
  --muted: #9fb2c2;
  --primary: #43a8ff;
  --primary-strong: #168be9;
  --amber: #e6a33c;
  --danger: #ff6b6b;
  --success: #42d392;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .25);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 85% -10%, rgba(45, 139, 210, .13), transparent 34%), var(--bg); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(67, 168, 255, .45); outline-offset: 2px; }
.skip { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 12px 16px; background: var(--primary); color: #001522; border-radius: 8px; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); padding: 36px; border: 1px solid var(--border); border-radius: 20px; background: rgba(13, 24, 35, .94); box-shadow: var(--shadow); }
.login-card h1 { margin: 8px 0 10px; font-size: clamp(25px, 5vw, 34px); letter-spacing: -.03em; }
.login-card label { display: block; margin: 28px 0 8px; font-weight: 650; }
.login-card .button { width: 100%; margin-top: 8px; }
.password-control { display: flex; align-items: stretch; width: 100%; }
.password-control input { min-width: 0; border-radius: 9px 0 0 9px; }
.password-toggle { min-width: 88px; min-height: 44px; padding: 0 12px; color: #cfe5f5; background: var(--surface-3); border: 1px solid var(--border); border-left: 0; border-radius: 0 9px 9px 0; font-size: 12px; font-weight: 650; }
.password-toggle:hover { background: #20374a; }

.brand-mark { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #315775; border-radius: 12px; background: linear-gradient(145deg, #19364c, #0b1822); }
.brand-mark::before { content: ""; width: 18px; height: 21px; border: 2px solid var(--primary); border-radius: 9px 9px 11px 11px; clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%); }
.brand-mark span { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px var(--primary); }
.eyebrow { margin: 0; color: #70bdfa; font: 650 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .13em; }
.muted { color: var(--muted); line-height: 1.6; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px; border-right: 1px solid var(--border); background: rgba(8, 18, 27, .9); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; min-height: 46px; gap: 12px; padding: 0 13px; color: var(--muted); border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; transition: color .18s ease, background .18s ease, border-color .18s ease; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.nav-item.active { color: #dff2ff; background: rgba(67, 168, 255, .1); border-color: rgba(67, 168, 255, .22); }
.nav-icon { display: grid; place-items: center; width: 22px; height: 22px; font-family: ui-monospace, monospace; color: currentColor; }
.nav-icon { fill: none; stroke: currentColor; stroke-width: 1.5; flex-shrink: 0; }
.connection-status { margin: -12px 0 22px; color: var(--muted); font-size: 13px; }
.connection-status.offline { color: var(--amber); }
.status-dot.paused { background: var(--muted); box-shadow: none; }
.retry-field { margin-top: 18px; }
.chart-data { margin: 0; padding: 0 20px; border-bottom: 0; }
.sidebar-bottom { margin-top: auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 14px 8px 0; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(66, 211, 146, .55); }
.text-button { color: var(--muted); border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; }

main { min-width: 0; padding: 32px clamp(20px, 3vw, 48px) 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.topbar h1 { margin: 4px 0 0; font-size: clamp(26px, 3vw, 35px); letter-spacing: -.04em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
select, input, textarea { min-height: 44px; width: 100%; padding: 0 12px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; transition: border-color .18s ease, box-shadow .18s ease; }
textarea { min-height: 108px; padding-block: 10px; resize: vertical; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
select:hover, input:hover, textarea:hover { border-color: #3b576d; }
.top-actions select { width: 190px; }
.button { min-height: 44px; padding: 0 17px; border: 1px solid transparent; border-radius: 9px; font-weight: 680; transition: background .18s ease, border-color .18s ease, opacity .18s ease; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button.primary { color: #001827; background: var(--primary); }
.button.primary:hover { background: #6dbbff; }
.button.secondary { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.button.secondary.active { color: #dff2ff; background: rgba(67, 168, 255, .1); border-color: rgba(67, 168, 255, .35); }
.button.danger { color: #ffdede; background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .28); }

.view { display: none; }
.active-view { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mobile-only { display: none; }
.metric-card, .panel { border: 1px solid var(--border); background: linear-gradient(150deg, rgba(17, 31, 44, .92), rgba(11, 22, 32, .92)); box-shadow: 0 12px 32px rgba(0, 0, 0, .12); }
.metric-card { min-height: 148px; padding: 21px; border-radius: var(--radius); }
.metric-card strong { display: block; margin: 16px 0 7px; font: 650 clamp(27px, 3vw, 36px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.05em; }
.operations-metrics .metric-card strong { font-size: clamp(19px, 2vw, 25px); letter-spacing: -.03em; }
.metric-card small, .metric-label { color: var(--muted); }
.metric-label { font-size: 13px; font-weight: 650; }
.metric-card small { font-size: 12px; }
.panel { border-radius: var(--radius); overflow: hidden; }
.chart-panel { margin-top: 14px; }
.panel-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.panel-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.015em; }
.panel-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.legend { display: flex; gap: 18px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.legend .blue { background: var(--primary); }
.legend .amber { background: var(--amber); }
.chart-wrap { height: 270px; padding: 20px 22px 16px; }
#traffic-chart { width: 100%; height: 100%; overflow: visible; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.compact-list { min-height: 220px; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 20px; border-bottom: 1px solid rgba(38, 59, 77, .65); }
.list-row:last-child { border-bottom: 0; }
.list-main { min-width: 0; flex: 1; }
.list-main strong, .list-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main strong { font-size: 13px; }
.list-main small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.empty-compact { display: grid; place-items: center; min-height: 220px; padding: 24px; color: var(--muted); text-align: center; font-size: 13px; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; font: 650 11px/1 ui-monospace, monospace; border: 1px solid var(--border); color: var(--muted); background: rgba(255, 255, 255, .025); }
.badge.challenge { color: #ffcc7a; border-color: rgba(230, 163, 60, .3); background: rgba(230, 163, 60, .08); }
.badge.bypass, .badge.fail_open { color: #ffcc7a; border-color: rgba(230, 163, 60, .3); background: rgba(230, 163, 60, .08); }
.badge.block { color: #ff9a9a; border-color: rgba(255, 107, 107, .3); background: rgba(255, 107, 107, .08); }
.badge.monitor, .badge.observe { color: #8ccaff; border-color: rgba(67, 168, 255, .3); background: rgba(67, 168, 255, .08); }
.badge.enabled { color: #75e3aa; border-color: rgba(66, 211, 146, .3); }

.table-panel { min-height: 420px; }
.secondary-panel { margin-top: 14px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; text-align: left; font-weight: 650; }
th, td { height: 58px; padding: 0 20px; border-bottom: 1px solid rgba(38, 59, 77, .65); white-space: nowrap; }
td code { color: #bdd2e2; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-button { min-width: 44px; min-height: 44px; color: var(--muted); border: 1px solid transparent; border-radius: 9px; background: transparent; font-size: 20px; }
.icon-button:hover { color: var(--text); background: var(--surface-3); border-color: var(--border); }
.button.small { min-height: 38px; padding-inline: 13px; font-size: 12px; }
.empty { min-height: 320px; display: grid; align-content: center; justify-items: center; padding: 30px; text-align: center; }
.empty h3 { margin: 0; font-size: 16px; }
.empty p { color: var(--muted); }

dialog { width: min(680px, calc(100% - 28px)); max-height: calc(100dvh - 40px); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
#domain-dialog { width: min(780px, calc(100% - 28px)); }
#origin-tls-dialog { width: min(760px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(0, 6, 11, .75); backdrop-filter: blur(4px); }
#domain-form, #unban-form, .certificate-dialog { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.dialog-heading h2 { margin: 5px 0 0; font-size: 23px; }
.wizard-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.wizard-progress { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 26px; }
.wizard-progress::before { content: ""; position: absolute; z-index: 0; top: 18px; left: 16.66%; right: 16.66%; height: 1px; background: var(--border); }
.wizard-step { position: relative; z-index: 1; display: grid; justify-items: center; gap: 5px; min-height: 68px; padding: 0 8px; color: var(--muted); background: transparent; border: 0; border-radius: 10px; text-align: center; }
.wizard-step span { display: grid; place-items: center; width: 36px; height: 36px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 50%; font: 650 12px ui-monospace, SFMono-Regular, Menlo, monospace; transition: color .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.wizard-step strong { color: inherit; font-size: 12px; }
.wizard-step small { color: inherit; font-size: 10px; }
.wizard-step.active { color: #dff2ff; }
.wizard-step.active span { color: #001827; background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(67,168,255,.1); }
.wizard-step.done { color: #9de9c2; }
.wizard-step.done span { color: #052518; background: var(--success); border-color: var(--success); }
.wizard-panel { min-height: 410px; }
.wizard-panel > .section-title { margin-bottom: 20px; }
.guided-tip { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; padding: 14px 16px; color: #cde5f7; background: rgba(67,168,255,.07); border: 1px solid rgba(67,168,255,.22); border-radius: 11px; font-size: 13px; line-height: 1.55; }
.guided-tip strong { flex: 0 0 auto; color: #e5f4ff; }
.advanced-options { margin-top: 18px; }
.profile-picker { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.profile-card { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; min-height: 76px; padding: 14px 16px; color: var(--text); background: rgba(255,255,255,.018); border: 1px solid var(--border); border-radius: 11px; cursor: pointer; transition: background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.profile-card:hover { background: rgba(67,168,255,.045); border-color: #3b576d; }
.profile-card:has(input:checked) { background: rgba(67,168,255,.09); border-color: rgba(67,168,255,.55); box-shadow: 0 0 0 2px rgba(67,168,255,.08); }
.profile-card input { width: 22px; min-height: 22px; margin: 0; accent-color: var(--primary); }
.profile-card span strong, .profile-card span small { display: block; }
.profile-card span strong { font-size: 14px; }
.profile-card span small { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.profile-card em { padding: 5px 8px; color: #9de9c2; background: rgba(66,211,146,.08); border: 1px solid rgba(66,211,146,.28); border-radius: 999px; font: normal 650 10px ui-monospace, monospace; }
.simple-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.threshold-grid { margin-top: 18px; }
.configuration-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.configuration-summary div { min-width: 0; padding: 13px 14px; background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 10px; }
.configuration-summary span, .configuration-summary strong { display: block; }
.configuration-summary span { color: var(--muted); font-size: 11px; }
.configuration-summary strong { margin-top: 6px; overflow: hidden; color: #e4f3ff; font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.dns-guide { margin-top: 18px; overflow: hidden; border: 1px solid rgba(67,168,255,.28); border-radius: 12px; background: rgba(67,168,255,.035); }
.dns-guide-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.dns-guide-heading h4 { margin: 0; font-size: 15px; }
.dns-guide-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.dns-status { flex: 0 0 auto; padding: 6px 9px; color: #cfeaff; background: rgba(67,168,255,.08); border: 1px solid rgba(67,168,255,.24); border-radius: 999px; font: 600 10px ui-monospace, monospace; }
.dns-table th, .dns-table td { height: 54px; padding-inline: 18px; }
.dns-table code { white-space: normal; overflow-wrap: anywhere; }
.dns-checklist { margin: 20px 0 0; padding-left: 25px; color: #c8dae8; font-size: 13px; line-height: 1.6; }
.dns-checklist li + li { margin-top: 8px; }
.wizard-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.wizard-final-actions { display: flex; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.crawler-options { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
.crawler-options legend { padding-inline: 6px; color: #c8dae8; font-size: 13px; font-weight: 650; }
.crawler-options label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.crawler-options input { width: 22px; min-height: 22px; accent-color: var(--primary); }
.simulation-result:not(:empty) { margin-top: 16px; padding: 12px 14px; color: #cce7fa; background: rgba(67,168,255,.08); border: 1px solid rgba(67,168,255,.25); border-radius: 9px; font-size: 13px; line-height: 1.5; }
.operations-columns { margin-bottom: 14px; }
.settings-form { display: grid; gap: 14px; padding-bottom: 84px; }
.settings-panel { overflow: visible; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 22px; }
.settings-grid .full { grid-column: 1 / -1; }
.settings-note { margin: 0; padding: 13px 15px; color: var(--muted); background: rgba(230, 163, 60, .07); border: 1px solid rgba(230, 163, 60, .2); border-radius: 9px; font-size: 12px; line-height: 1.55; }
.notice { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 12px 16px; color: #cde5f7; background: rgba(67, 168, 255, .07); border: 1px solid rgba(67, 168, 255, .24); border-radius: 11px; font-size: 13px; line-height: 1.5; }
.notice strong { flex: 0 0 auto; }
.notice.warning { color: #ffe0a8; background: rgba(230, 163, 60, .08); border-color: rgba(230, 163, 60, .28); }
.secret-status { display: inline-flex; margin-left: 6px; padding: 3px 7px; color: #ffcc7a; background: rgba(230, 163, 60, .08); border: 1px solid rgba(230, 163, 60, .26); border-radius: 999px; font: 600 10px/1 ui-monospace, monospace; vertical-align: middle; }
.secret-status.configured { color: #75e3aa; background: rgba(66, 211, 146, .08); border-color: rgba(66, 211, 146, .28); }
.field .inline-check { display: flex; align-items: center; gap: 9px; min-height: 44px; margin: 8px 0 0; color: var(--muted); font-weight: 500; }
.inline-check input, .toggle-card input { width: 22px; min-height: 22px; flex: 0 0 auto; accent-color: var(--primary); }
.toggle-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; padding: 13px 15px; background: rgba(255, 255, 255, .02); border: 1px solid var(--border); border-radius: 10px; }
.toggle-card label { margin: 0 0 4px; }
.settings-actions { position: sticky; z-index: 20; bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; padding: 12px 14px 12px 18px; background: rgba(13, 24, 35, .96); border: 1px solid #31516b; border-radius: 12px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.toggle-field { display: flex; align-items: center; gap: 12px; }
.toggle-field label { margin: 0; }
.toggle-field input { width: 22px; min-height: 22px; accent-color: var(--primary); }
details { margin-top: 22px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
summary { min-height: 48px; display: flex; align-items: center; color: #c8dae8; cursor: pointer; font-size: 13px; font-weight: 650; }
.advanced { padding: 4px 0 20px; }
.form-error { min-height: 20px; margin: 14px 0 0; color: #ff9a9a; font-size: 13px; }
.certificate-action { display: flex; align-items: flex-end; }
.certificate-action .button { width: 100%; }
.certificate-dialog .notice { margin: 18px 0; }
.certificate-dialog textarea[readonly] { min-height: 132px; margin-bottom: 8px; color: #cce7fa; background: #09131d; cursor: text; }
.certificate-meta { overflow-wrap: anywhere; color: var(--muted); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.setup-progress { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 0; }
.setup-progress::before { content: ""; position: absolute; z-index: 0; top: 17px; left: 16.66%; right: 16.66%; height: 1px; background: var(--border); }
.setup-step { position: relative; z-index: 1; display: grid; justify-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.setup-step span { display: grid; place-items: center; width: 34px; height: 34px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 50%; font: 650 12px ui-monospace, monospace; }
.setup-step.active { color: #cfeaff; }
.setup-step.active span { color: #001827; background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(67,168,255,.1); }
.setup-step.done { color: #9de9c2; }
.setup-step.done span { color: #052518; background: var(--success); border-color: var(--success); }
.tls-section { margin-top: 18px; padding: 18px; background: rgba(255,255,255,.018); border: 1px solid var(--border); border-radius: 12px; }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-title h3 { margin: 0; font-size: 15px; }
.section-title p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.tls-warning { margin-top: 18px; }
.notice.success { color: #bdf3d6; background: rgba(66,211,146,.08); border-color: rgba(66,211,146,.28); }
.tls-result { margin-top: 18px; }
.tls-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 0; }
.tls-facts div { padding: 13px; background: rgba(0,0,0,.12); border: 1px solid rgba(38,59,77,.7); border-radius: 9px; }
.tls-facts dt { color: var(--muted); font-size: 11px; }
.tls-facts dd { margin: 5px 0 0; overflow-wrap: anywhere; font: 600 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.table-note { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.warning-text { color: #ffcc7a; }
.install-steps { margin: 22px 0 0; padding-left: 24px; color: #c8dae8; font-size: 13px; line-height: 1.65; }
.install-steps li + li { margin-top: 7px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 10px; }
.toast { position: fixed; z-index: 80; right: 24px; bottom: 24px; max-width: min(380px, calc(100% - 48px)); padding: 13px 16px; color: var(--text); background: #183044; border: 1px solid #31516b; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #351b21; border-color: #70404a; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 80px 1fr; }
  .sidebar { padding-inline: 10px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > div:last-child, .nav-item:not(.active) .nav-label, .sidebar-bottom span:not(.status-dot) { display: none; }
  .nav-item { justify-content: center; padding: 0; font-size: 0; }
  .nav-icon { font-size: 16px; }
  .sidebar-bottom { grid-template-columns: 1fr; justify-items: center; }
  .text-button { font-size: 11px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .mobile-only { display: block; margin-bottom: 16px; min-height: 44px; }
  .app-shell { display: block; padding-bottom: 72px; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 40; width: 100%; height: 68px; padding: 8px 12px; border: 1px solid var(--border); border-width: 1px 0 0; }
  .brand, .sidebar-bottom { display: none; }
  nav { height: 100%; grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .nav-item, .nav-item:not(.active) { flex-direction: column; justify-content: center; gap: 1px; padding: 3px; font-size: 11px; }
  .nav-icon { height: 19px; font-size: 15px; }
  main { padding: 22px 15px 36px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  .top-actions select { min-width: 0; flex: 1; width: auto; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 126px; padding: 16px; }
  .two-columns { grid-template-columns: 1fr; }
  .panel-heading { flex-direction: column; }
  .chart-wrap { height: 230px; padding-inline: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .simple-toggles, .configuration-summary { grid-template-columns: 1fr; }
  .profile-card { grid-template-columns: auto 1fr; }
  .profile-card em { grid-column: 2; justify-self: start; }
  .dns-guide-heading { flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; padding: 18px; }
  .settings-grid .full { grid-column: auto; }
  .notice { align-items: flex-start; flex-direction: column; }
  .section-title { flex-direction: column; }
  .tls-facts { grid-template-columns: 1fr; }
  .settings-actions { bottom: 78px; }
  .field.full { grid-column: auto; }
  #domain-form { padding: 20px; }
  .dialog-actions { flex-wrap: wrap; }
  .wizard-step small { display: none; }
}

@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr; }
  .top-actions { align-items: stretch; flex-direction: column; }
  .top-actions select { width: 100%; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
  .wizard-actions { align-items: stretch; flex-direction: column-reverse; }
  .wizard-actions > .button, .wizard-final-actions, .wizard-final-actions .button { width: 100%; }
  .wizard-final-actions { display: grid; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .settings-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
