
:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #eef1f5;
  line-height: 1.45;
  --ink: #101828;
  --muted: #667085;
  --line: #d9e0e8;
  --soft-line: #e8edf2;
  --surface: #ffffff;
  --soft: #f7f9fb;
  --nav: #151b26;
  --nav-hover: #232c3b;
  --blue: #175cd3;
  --blue-soft: #eff8ff;
  --green: #067647;
  --green-soft: #ecfdf3;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --red: #b42318;
  --red-soft: #fef3f2;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #eef1f5; }
body.app-body { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea, a { letter-spacing: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #2e90fa; outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell { height: 100vh; height: 100dvh; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); overflow: hidden; }
.sidebar { position: relative; height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 16px 12px; background: var(--nav); color: #d6deea; z-index: 30; }
.sidebar-backdrop { display: none; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 9px; color: #fff; text-decoration: none; font-size: 16px; font-weight: 800; }
.brand-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; background: #2e6fdf; color: #fff; }
.nav-group { margin-top: 18px; }
.nav-label { padding: 0 10px 7px; color: #7f8da1; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.nav-list { display: grid; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 8px 10px; border-radius: 6px; color: #cbd5e1; text-decoration: none; font-size: 13px; font-weight: 650; }
.nav-link:hover { background: var(--nav-hover); color: #fff; }
.nav-link.active { background: #273958; color: #fff; }
.nav-icon { width: 18px; text-align: center; color: #94a3b8; font-size: 15px; }
.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid #2b3442; }
.user-chip { padding: 0 9px 10px; overflow: hidden; }
.user-name { overflow: hidden; color: #f8fafc; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.user-role { margin-top: 2px; color: #8492a6; font-size: 11px; }

.main-shell { min-width: 0; min-height: 0; height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; }
.topbar { position: relative; z-index: 20; min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.topbar-title { min-width: 0; }
.topbar h1 { margin: 0; overflow: hidden; color: var(--ink); font-size: 19px; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
.topbar-subtitle { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn.mobile-menu { display: none; }
.page-content { min-width: 0; min-height: 0; overflow: auto; padding: 18px 22px; }
body.event-mode .page-content { display: flex; flex-direction: column; overflow: hidden; }
body.event-mode .page-content > [data-page-tabs] { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
body.event-mode [data-tab-panel="events"]:not([hidden]) { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
body.event-mode .event-workspace { min-height: 0; flex: 1 1 auto; }

.panel { min-width: 0; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.panel-pad { padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--soft-line); }
.panel-head h2, .panel-head h3 { margin: 0; color: var(--ink); font-size: 14px; }
.panel-note { margin-top: 3px; color: var(--muted); font-size: 12px; }
.command-form { flex: 1; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .8fr) auto; align-items: end; gap: 10px; }

.tabs { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab-button { min-height: 39px; padding: 8px 13px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #475467; cursor: pointer; font-size: 13px; font-weight: 700; }
.tab-button:hover { color: var(--ink); }
.tab-button.active { border-bottom-color: var(--blue); color: var(--blue); }
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; margin-left: 5px; padding: 0 5px; border-radius: 9px; background: #eef2f6; color: #475467; font-size: 10px; }
.tab-button.active .tab-count { background: var(--blue-soft); color: var(--blue); }
.context-bar { min-height: 44px; flex: 0 0 auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.context-bar .tabs { min-width: 0; margin-bottom: 0; border-bottom: 0; }
.context-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 7px; padding-bottom: 6px; }
.domain-state { display: inline-flex; align-items: center; gap: 6px; margin-right: 3px; color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }
.domain-state > span { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.domain-state.active { color: var(--green); }
.domain-state.active > span { background: #12b76a; }
.domain-state.inactive { color: var(--red); }
.domain-state.inactive > span { background: #f04438; }

.metric-strip { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.metric { min-width: 0; padding: 13px 15px; border-right: 1px solid var(--soft-line); }
.metric:last-child { border-right: 0; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-value { margin-top: 3px; color: var(--ink); font-size: 21px; font-weight: 800; }

label { display: block; margin: 0 0 5px; color: #475467; font-size: 11px; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 36px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; padding: 7px 9px; color: #101828; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #6ea0ed; box-shadow: 0 0 0 3px rgba(23,92,211,.11); }
textarea { min-height: 108px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 11px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.field-help { margin-top: 4px; color: var(--muted); font-size: 10px; }

.btn, button.btn { min-height: 35px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 6px; padding: 7px 11px; background: var(--blue); color: #fff; text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 750; white-space: nowrap; }
.btn:hover { filter: brightness(.96); }
.btn.secondary { background: #344054; }
.btn.ghost { border: 1px solid #cfd7e2; background: #fff; color: #344054; }
.btn.danger { background: var(--red); }
.btn.small { min-height: 29px; padding: 5px 8px; font-size: 11px; }
.icon-btn { width: 31px; height: 31px; min-height: 31px; display: inline-grid; place-items: center; border: 1px solid #d6dde6; border-radius: 6px; background: #fff; color: #344054; cursor: pointer; font-size: 15px; }
.icon-btn:hover { background: #f3f6f9; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.danger { border-color: #f2c7c2; color: var(--red); }

.badge { display: inline-flex; align-items: center; min-height: 21px; border-radius: 10px; padding: 2px 7px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge.http, .badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.dns { background: #f4f3ff; color: #5925dc; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.off { background: #f2f4f7; color: #475467; }
.badge.bad { background: var(--red-soft); color: var(--red); }

.event-workspace { --event-list-width: 56%; min-height: 0; display: grid; grid-template-columns: minmax(420px, var(--event-list-width)) 5px minmax(320px, 1fr); grid-template-rows: minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.event-list-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.event-resizer { position: relative; min-width: 5px; background: #f2f4f7; cursor: col-resize; touch-action: none; }
.event-resizer::after { content: ""; position: absolute; inset: 0 1px; background: var(--line); transition: background .15s ease; }
.event-resizer:hover::after, .event-resizer:focus-visible::after, body.event-resizing .event-resizer::after { background: var(--blue); }
body.event-resizing, body.event-resizing * { cursor: col-resize !important; user-select: none !important; }
.event-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--soft-line); background: #fbfcfd; }
.event-filter-group { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 8px; }
.event-filter-group input, .event-filter-group select { min-height: 33px; }
.event-filter-group [data-event-search] { min-width: 170px; flex: 1 1 auto; }
.event-filter-group [data-event-kind] { width: 110px; flex: 0 0 110px; }
.event-filter-group [data-event-domain] { width: 180px; flex: 0 0 180px; }
.event-toolbar-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }
.event-visible-count { color: var(--muted); font-size: 10px; white-space: nowrap; }
.event-visible-count strong { color: var(--ink); font-size: 12px; }
.toggle-label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: #475467; white-space: nowrap; }
.toggle-label input { width: 15px; min-height: 15px; margin: 0; }
.toggle-label[data-paused="true"] { color: var(--amber); }
.event-list-header, .event-row { display: grid; grid-template-columns: 95px 58px minmax(190px,1fr) minmax(130px,165px); align-items: center; gap: 9px; }
.event-list-header { min-height: 32px; padding: 0 11px; border-bottom: 1px solid var(--soft-line); background: #f8fafc; color: #667085; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.event-list { min-height: 0; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.event-row { width: 100%; min-height: 58px; overflow: hidden; padding: 8px 11px; border: 0; border-bottom: 1px solid #edf0f4; border-radius: 0; background: #fff; color: #344054; text-align: left; cursor: pointer; }
.event-row:hover { background: #f8fbff; }
.event-row.active { background: #eef6ff; box-shadow: inset 3px 0 0 var(--blue); }
.event-time { color: #667085; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.event-request { min-width: 0; }
.event-summary { display: block; overflow: hidden; color: #101828; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.event-domain { display: block; margin-top: 3px; overflow: hidden; color: #667085; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.event-peer { min-width: 0; overflow: hidden; color: #475467; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.event-empty { padding: 38px 18px; color: var(--muted); text-align: center; font-size: 12px; }
.event-detail-pane { min-width: 0; min-height: 0; height: 100%; overflow: auto; overscroll-behavior: contain; background: #fbfcfd; }
.detail-placeholder { height: 100%; display: grid; place-items: center; padding: 30px; color: var(--muted); font-size: 12px; text-align: center; }
.event-detail { min-height: 100%; background: #fff; }
.detail-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.detail-title { min-width: 0; }
.detail-kicker { display: flex; align-items: center; gap: 7px; }
.detail-event-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.detail-title h3 { margin: 5px 0 0; overflow-wrap: anywhere; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.detail-time { margin-top: 4px; color: var(--muted); font-size: 10px; }
.detail-head-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.detail-close { display: none; }
.detail-section { padding: 14px 16px; border-bottom: 1px solid var(--soft-line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.detail-section h4 { margin: 0; color: #344054; font-size: 11px; font-weight: 850; text-transform: uppercase; }
.detail-grid { display: grid; grid-template-columns: 125px minmax(0,1fr); gap: 7px 10px; margin: 0; }
.detail-grid dt { color: #667085; font-size: 10px; }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; color: #1d2939; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.code-block { max-height: 330px; margin: 0; overflow: auto; border: 1px solid #d9e0e8; border-radius: 6px; background: #101828; padding: 11px; color: #edf2f7; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.code-block.light { background: #f8fafc; color: #172033; }
.event-detail .code-block { max-height: none; overflow: visible; }
.answer-list { display: grid; gap: 6px; }
.answer-item { padding: 7px 9px; border-left: 3px solid #7f56d9; background: #f9f5ff; color: #42307d; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; overflow-wrap: anywhere; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 9px 10px; border-bottom: 1px solid var(--soft-line); text-align: left; vertical-align: middle; font-size: 11px; }
.data-table th { background: #f8fafc; color: #667085; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow: auto; }
.table-primary-link { color: var(--ink); font-weight: 750; text-decoration: none; }
.table-primary-link:hover { color: var(--blue); text-decoration: underline; }
.table-primary-text { color: var(--ink); font-weight: 750; }
.cell-primary { min-width: 0; }
.cell-primary .copy-compact { margin-left: 7px; }
.table-actions { white-space: nowrap; }
.table-actions form { display: inline-flex; }
.table-actions .btn { margin-right: 3px; }
.copy-compact { min-width: 43px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.wrap { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

.base-domain-add-form, .invite-create-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 10px; }
.invite-create-form { grid-template-columns: minmax(160px, .55fr) minmax(160px, .55fr) auto; }
.base-domain-list { display: grid; gap: 12px; }
.base-domain-item { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.base-domain-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 15px; }
.base-domain-identity { min-width: 0; }
.base-domain-identity > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.base-domain-name { color: var(--ink); font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.delegation-steps { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--soft-line); }
.delegation-step { min-width: 0; padding: 14px 15px; }
.delegation-step + .delegation-step { border-left: 1px solid var(--soft-line); }
.step-heading { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 11px; }
.step-heading h3 { margin: 0; color: var(--ink); font-size: 12px; }
.step-index { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 850; }
.dns-instruction-list { display: grid; gap: 1px; margin: 0; }
.dns-instruction-list > div { min-width: 0; display: grid; grid-template-columns: 82px minmax(0,1fr) auto; align-items: center; gap: 8px; min-height: 37px; padding: 5px 0; border-bottom: 1px solid #f0f2f5; }
.dns-instruction-list > div:last-child { border-bottom: 0; }
.dns-instruction-list dt { color: var(--muted); font-size: 10px; }
.dns-instruction-list dd { min-width: 0; margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.base-domain-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 15px; border-top: 1px solid var(--soft-line); background: #fbfcfd; }
.base-domain-footer [data-state="checking"] { color: var(--blue); }
.base-domain-footer [data-state="error"] { color: var(--red); }
.base-domain-footer [data-state="success"] { color: var(--green); }
.api-token-panel, .single-secret-panel { max-width: 760px; }
.api-token-panel h2, .single-secret-panel h2 { margin: 0; font-size: 14px; }

.config-stack { min-width: 0; display: grid; gap: 14px; }
.config-disclosure { border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.config-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.config-disclosure > summary::-webkit-details-marker { display: none; }
.config-summary-title { color: var(--ink); font-size: 13px; font-weight: 800; }
.config-summary-value { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.config-disclosure-body { padding: 2px 14px 14px; border-top: 1px solid var(--soft-line); }
.rule-table { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.rule-record, .rule-table-head { display: grid; grid-template-columns: 48px 90px minmax(160px,1fr) 82px minmax(130px,.8fr) 142px; align-items: center; gap: 8px; min-height: 45px; padding: 7px 10px; }
.rule-table-head { min-height: 34px; background: #f8fafc; color: #667085; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.rule-record { border-top: 1px solid var(--soft-line); font-size: 11px; }
.rule-record:first-of-type { border-top: 0; }
.rule-path, .rule-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-path { color: #101828; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; }
.rule-actions { display: flex; justify-content: flex-end; gap: 4px; }
.empty-row { padding: 24px; color: var(--muted); text-align: center; font-size: 12px; }
.config-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.autosave-strip { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: 11px; }
.save-status { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 700; }
.save-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.save-status[data-state="saved"] { color: var(--green); }
.save-status[data-state="saved"] .save-status-dot { background: #12b76a; }
.save-status[data-state="saving"] { color: var(--blue); }
.save-status[data-state="saving"] .save-status-dot { background: #2e90fa; animation: save-pulse .9s ease-in-out infinite alternate; }
.save-status[data-state="waiting"] { color: var(--amber); }
.save-status[data-state="waiting"] .save-status-dot { background: #f79009; }
.save-status[data-state="error"] { color: var(--red); }
.save-status[data-state="error"] .save-status-dot { background: #f04438; }
@keyframes save-pulse { from { opacity: .35; } to { opacity: 1; } }

.dns-record-table { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.dns-record-head, .dns-record-row { display: grid; grid-template-columns: 130px minmax(200px,1fr) 120px 38px; align-items: center; gap: 8px; padding: 8px 10px; }
.dns-record-head { background: #f8fafc; color: #667085; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.dns-record-row { border-top: 1px solid var(--soft-line); }
.dns-record-row input, .dns-record-row select { min-height: 33px; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: flex-end; background: rgba(15,23,42,.36); }
.drawer { width: min(560px, 100%); height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; background: #fff; box-shadow: -16px 0 40px rgba(15,23,42,.18); }
.drawer-head { z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.drawer-head h3 { margin: 0; font-size: 15px; }
.drawer-body { min-height: 0; overflow: auto; padding: 16px; overscroll-behavior: contain; }
.drawer-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; }
.drawer-save-note { margin-right: auto; color: var(--muted); font-size: 11px; }
.inline-error, .error-box { margin-bottom: 12px; border: 1px solid #fecdca; border-radius: 6px; background: var(--red-soft); padding: 9px 11px; color: var(--red); font-size: 11px; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-form { padding: 14px 16px; border-bottom: 1px solid var(--soft-line); }
.notice { border: 1px solid #b2ddff; border-radius: 6px; background: var(--blue-soft); padding: 10px 12px; color: #1849a9; font-size: 11px; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef1f5; }
.auth-card { width: min(420px,100%); border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 22px; box-shadow: 0 14px 35px rgba(16,24,40,.1); }
.auth-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; color: var(--ink); font-weight: 850; }
.auth-card h1 { margin: 0 0 4px; font-size: 20px; }
.auth-sub { margin-bottom: 15px; color: var(--muted); font-size: 12px; }
.token-block { margin: 12px 0; }

@media (max-width: 1180px) {
  .event-workspace { --event-list-width: 54%; grid-template-columns: minmax(380px, var(--event-list-width)) 5px minmax(300px, 1fr); }
  .rule-record, .rule-table-head { grid-template-columns: 42px 78px minmax(140px,1fr) 75px 110px 132px; }
}

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: 220px; transition: transform .18s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; border: 0; border-radius: 0; background: rgba(15,23,42,.38); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .icon-btn.mobile-menu { display: inline-grid; }
  .topbar { padding: 9px 13px; }
  .page-content { padding: 13px; }
  .command-form { grid-template-columns: 1fr 1fr auto; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--soft-line); }
  .event-workspace { min-height: 0; grid-template-columns: 1fr; }
  .event-resizer { display: none; }
  .event-list-pane { border-right: 0; }
  .event-detail-pane { position: fixed; inset: 0; z-index: 70; display: none; background: #fff; }
  .event-workspace.detail-open .event-detail-pane { display: block; }
  .detail-close { display: inline-grid; }
  .event-list-header, .event-row { grid-template-columns: 80px 52px minmax(0,1fr); }
  .event-list-header > :last-child, .event-row > :last-child { display: none; }
  .rule-table { overflow: auto; }
  .rule-table-head, .rule-record { min-width: 780px; }
  .admin-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .delegation-steps { grid-template-columns: 1fr; }
  .delegation-step + .delegation-step { border-top: 1px solid var(--soft-line); border-left: 0; }
}

@media (max-width: 620px) {
  .topbar-subtitle { display: none; }
  .page-content { padding: 10px; }
  .command-form { grid-template-columns: 1fr; }
  .context-bar { align-items: stretch; flex-direction: column; gap: 4px; }
  .context-actions { justify-content: flex-end; padding-bottom: 8px; }
  .tabs { overflow-x: auto; }
  .tab-button { flex: 0 0 auto; }
  .admin-tabs { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 5px; overflow: visible; border-bottom: 0; }
  .admin-tabs .tab-button { min-width: 0; min-height: 35px; grid-column: span 2; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; padding: 6px 7px; text-overflow: ellipsis; white-space: nowrap; }
  .admin-tabs .tab-button:nth-child(n+4) { grid-column: span 3; }
  .admin-tabs .tab-button.active { border-color: #84adf4; background: var(--blue-soft); }
  .event-toolbar { align-items: stretch; flex-direction: column; gap: 7px; }
  .event-filter-group [data-event-kind] { width: 92px; flex-basis: 92px; }
  .event-filter-group [data-event-domain] { width: 120px; flex-basis: 120px; }
  .event-toolbar-actions { justify-content: flex-end; min-height: 31px; }
  .event-toolbar .toggle-label { margin-right: auto; }
  .metric-strip { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .metric { padding: 9px 8px; border-bottom: 0 !important; }
  .metric:nth-child(2) { border-right: 1px solid var(--soft-line); }
  .metric-label { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .metric-value { font-size: 17px; }
  .detail-grid { grid-template-columns: 105px minmax(0,1fr); }
  .detail-head { padding: 12px; }
  .detail-head-actions .btn { min-width: 74px; }
  .dns-record-head { display: none; }
  .dns-record-row { grid-template-columns: 100px minmax(0,1fr) 36px; }
  .dns-record-row [name="dns_priority"] { grid-column: 1/3; }
  .rule-table { overflow: visible; }
  .rule-table-head { display: none; }
  .rule-record { min-width: 0; grid-template-columns: 34px 56px minmax(0,1fr) 52px; gap: 6px; padding: 10px; }
  .rule-record [data-rule-index] { grid-column: 1; color: var(--muted); }
  .rule-record [data-rule-index]::before { content: "#"; }
  .rule-record [data-rule-match] { grid-column: 2; color: var(--blue); font-weight: 750; }
  .rule-record [data-rule-path] { grid-column: 3; }
  .rule-record [data-rule-status] { grid-column: 4; text-align: right; }
  .rule-record [data-rule-status]::before { content: "状态 "; color: var(--muted); font-size: 9px; }
  .rule-record [data-rule-type] { grid-column: 2/5; overflow: visible; color: var(--muted); white-space: normal; }
  .rule-record [data-rule-type]::before { content: "类型 "; color: var(--muted); font-size: 9px; font-weight: 750; }
  .rule-record .rule-actions { grid-column: 1/5; padding-top: 3px; border-top: 1px solid var(--soft-line); }
  .base-domain-add-form, .invite-create-form { grid-template-columns: 1fr; }
  .base-domain-head { align-items: flex-start; }
  .base-domain-footer { align-items: flex-start; flex-direction: column; }
  .base-domain-footer form, .base-domain-footer .btn { width: 100%; }
  .dns-instruction-list > div { grid-template-columns: 76px minmax(0,1fr) auto; }

  .responsive-table-wrap { overflow: visible; }
  .responsive-table { display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tbody { display: block; padding: 0 10px; }
  .responsive-table tbody tr { display: block; padding: 9px 0; border-bottom: 1px solid var(--soft-line); }
  .responsive-table tbody tr:last-child { border-bottom: 0; }
  .responsive-table tbody td { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 5px 3px; border-bottom: 0; text-align: right; white-space: normal; }
  .responsive-table tbody td::before { content: attr(data-label); flex: 0 0 84px; color: var(--muted); font-size: 10px; font-weight: 750; text-align: left; }
  .responsive-table tbody td.cell-primary { align-items: center; flex-wrap: wrap; padding-top: 7px; padding-bottom: 8px; text-align: left; }
  .responsive-table tbody td.cell-primary::before { flex-basis: 100%; }
  .responsive-table tbody td.cell-primary .table-primary-link, .responsive-table tbody td.cell-primary .table-primary-text { min-width: 0; flex: 1 1 180px; overflow-wrap: anywhere; }
  .responsive-table tbody td.table-actions { align-items: center; justify-content: flex-end; flex-wrap: wrap; }
  .responsive-table tbody td.table-actions::before { margin-right: auto; }
  .responsive-table tbody .responsive-empty { padding: 0; }
  .responsive-table tbody .responsive-empty td { display: block; text-align: center; }
  .responsive-table tbody .responsive-empty td::before { display: none; }
}
