:root {
    color-scheme: dark;
    --bg: #0a0e16;
    --surface: #111722;
    --surface-2: #151d2a;
    --surface-3: #1a2332;
    --surface-hover: #1d2636;
    --border: #273145;
    --border-strong: #354158;
    --text: #f1f4fb;
    --text-2: #a2acc0;
    --text-3: #8590a6;
    --accent: #7768e8;
    --accent-hover: #897cf3;
    --accent-soft: rgba(119, 104, 232, 0.14);
    --green: #36cfa7;
    --green-soft: rgba(54, 207, 167, 0.13);
    --red: #ff6474;
    --red-soft: rgba(255, 100, 116, 0.13);
    --orange: #f2ba55;
    --orange-soft: rgba(242, 186, 85, 0.14);
    --blue: #67aef7;
    --blue-soft: rgba(103, 174, 247, 0.13);
    --sidebar-width: 208px;
    --radius-sm: 7px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
summary:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid rgba(119, 104, 232, 0.42);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    left: 16px;
    top: -60px;
    z-index: 500;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: var(--bg);
    font-weight: 700;
    text-decoration: none;
}
.skip-link:focus { top: 16px; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    overflow-y: auto;
    background: #0e131d;
    border-right: 1px solid var(--border);
    transition: transform 180ms ease;
}
.brand {
    display: flex;
    min-height: 78px;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    border-bottom: 1px solid rgba(39, 49, 69, 0.72);
}
.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(119, 104, 232, 0.45);
    border-radius: 9px;
    background: var(--accent-soft);
    color: #a99fff;
    font-size: 17px;
}
.brand-copy { min-width: 0; }
.brand-title { font-size: 16px; font-weight: 750; letter-spacing: .01em; }
.brand-subtitle { margin-top: 1px; color: var(--text-3); font-size: 11px; }

.sidebar-nav { display: grid; gap: 5px; padding: 18px 12px; }
.nav-link, .sidebar-action {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.nav-link i, .sidebar-action i { width: 19px; color: var(--text-3); font-size: 17px; text-align: center; }
.nav-link:hover, .sidebar-action:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active {
    border-color: rgba(119, 104, 232, 0.34);
    background: var(--accent-soft);
    color: var(--text);
    box-shadow: inset 3px 0 0 var(--accent);
}
.nav-link.active i { color: #a99fff; }
.sidebar-footer {
    display: grid;
    gap: 5px;
    margin-top: auto;
    padding: 14px 12px 18px;
    border-top: 1px solid rgba(39, 49, 69, 0.72);
}
.sidebar-footer form { margin: 0; }
.brand, .sidebar-nav, .sidebar-footer { flex-shrink: 0; }
.panel-version { display: flex; justify-content: space-between; gap: 8px; padding: 0 13px 3px; color: var(--text-2); font-size: 12px; }
.panel-version span { color: var(--text); font-variant-numeric: tabular-nums; }
.sidebar-action:disabled { opacity: .65; cursor: wait; }
.panel-update-result { padding: 0 13px; color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.panel-update-result p { margin: 0; }
.panel-update-result a { color: #b3aaff; text-underline-offset: 3px; }
.panel-update-result a i { margin-left: 5px; font-size: 10px; }
.panel-update-result p:not(:empty), .panel-update-result a:not([hidden]) { margin-bottom: 6px; }

.mobile-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    display: none;
    height: 60px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(14, 19, 29, 0.97);
    border-bottom: 1px solid var(--border);
}
.mobile-brand { display: flex; align-items: center; gap: 9px; font-weight: 750; }
.mobile-brand i { color: #a99fff; }
.icon-button {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
}
.icon-button:hover { border-color: var(--border-strong); color: var(--text); }
.sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 110; background: rgba(2, 5, 10, 0.72); }
.sidebar-overlay.show { display: block; }

.main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding: 28px clamp(22px, 2.4vw, 38px) 48px;
}
.content-shell { width: 100%; max-width: 1660px; margin: 0 auto; }
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}
.page-heading { min-width: 0; }
.eyebrow { margin: 0 0 3px; color: var(--text-3); font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.page-title { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: clamp(24px, 2vw, 29px); font-weight: 720; line-height: 1.24; letter-spacing: -.02em; }
.page-description { max-width: 680px; margin: 7px 0 0; color: var(--text-2); font-size: 13px; }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.page-meta { color: var(--text-3); font-size: 12px; white-space: nowrap; }

.panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 18px; }
.panel-header {
    display: flex;
    flex-wrap: wrap;
    min-height: 57px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
}
.panel-title { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 15px; font-weight: 700; }
.panel-title i { color: var(--text-3); font-size: 16px; }
.panel-meta { color: var(--text-3); font-size: 12px; }
.panel-body { padding: 18px; }
.panel-footer {
    display: flex;
    min-height: 52px;
    align-items: center;
    padding: 0 18px;
    border-top: 1px solid var(--border);
}
.panel-link { display: inline-flex; align-items: center; gap: 7px; color: #9e94ff; font-size: 13px; font-weight: 650; text-decoration: none; }
.panel-link:hover { color: #b5adff; }

.system-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
    border: 0;
    background: transparent;
}
.system-strip > .system-metric {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.system-metric { min-width: 0; padding: 17px 19px; }
.metric-label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12px; }
.metric-label i { color: var(--text-3); }
.metric-value { margin-top: 8px; color: var(--text); font-size: clamp(21px, 2vw, 27px); font-weight: 730; line-height: 1.15; letter-spacing: -.02em; }
.metric-value.is-green { color: var(--green); }
.metric-value.is-orange { color: var(--orange); }
.metric-value.is-blue { color: var(--blue); }
.metric-note { margin-top: 5px; color: var(--text-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(280px, 4fr); gap: 18px; align-items: start; }
.dashboard-grid > .panel { margin: 0; min-width: 0; }
.dashboard-grid .panel-body { min-height: 0; }
.dashboard-grid .attention-panel { grid-row: span 2; }
.dashboard-grid .traffic-summary { min-height: 190px; }
.dashboard-grid > .panel:last-child { grid-column: 2; }
.dashboard-bottom { margin-top: 18px; }

.alert-list, .health-list, .activity-list { list-style: none; margin: 0; padding: 0; }
.alert-item, .health-item {
    display: grid;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(39, 49, 69, 0.78);
}
.alert-item { grid-template-columns: 30px minmax(0, 1fr) auto; }
.health-item { grid-template-columns: minmax(0, 1fr) auto; }
.alert-item:last-child, .health-item:last-child { border-bottom: 0; }
.alert-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 8px; background: var(--orange-soft); color: var(--orange); }
.alert-name, .health-name { overflow: hidden; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.alert-detail, .health-detail { margin-top: 2px; color: var(--text-3); font-size: 11px; }

.attention-group { border-bottom: 1px solid var(--border); }
.attention-group summary { display: flex; min-height: 44px; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.attention-group summary::-webkit-details-marker { display: none; }
.attention-group summary::before { content: "›"; color: var(--text-3); font-size: 19px; transition: transform 140ms ease; }
.attention-group[open] summary::before { transform: rotate(90deg); }
.attention-group summary > span:first-of-type { display: inline-flex; align-items: center; gap: 8px; flex: 1; font-weight: 650; }
.attention-group summary i { color: var(--text-3); }
.attention-list { overflow: visible; }
.attention-item { padding: 10px 4px 10px 0; border-top: 1px solid var(--border); }
.attention-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.attention-heading .alert-name { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.attention-heading .badge { flex-shrink: 0; }
.attention-item .alert-detail { overflow-wrap: anywhere; }
.attention-item .cell-actions { margin-top: 8px; }
.attention-note { margin: 10px 0 0; color: var(--text-3); font-size: 11px; }
.attention-footer { justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.traffic-summary { display: flex; min-height: 245px; flex-direction: column; justify-content: center; }
.traffic-number { font-size: 27px; font-weight: 750; letter-spacing: -.03em; }
.traffic-number span { color: var(--text-3); font-size: 13px; font-weight: 500; letter-spacing: 0; }
.traffic-legend { display: grid; gap: 10px; margin-top: 24px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 12px; }
.legend-label { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.legend-dot.is-muted { background: var(--border-strong); }

.progress { width: 100%; height: 7px; overflow: hidden; border-radius: 99px; background: #222b3b; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--accent); transition: width 220ms ease; }
.progress-bar.green { background: var(--green); }
.progress-bar.orange { background: var(--orange); }
.progress-bar.red { background: var(--red); }
.progress-lg { height: 9px; margin-top: 12px; }

.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    height: 42px;
    padding: 0 14px;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
td { min-height: 54px; padding: 13px 14px; border-bottom: 1px solid rgba(39, 49, 69, 0.74); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 140ms ease; }
tbody tr:hover { background: rgba(119, 104, 232, 0.055); }
tr.clickable { cursor: pointer; }
.cell-title { display: block; color: var(--text); font-weight: 650; }
.cell-subtitle { display: block; margin-top: 2px; color: var(--text-3); font-size: 11px; }
.cell-stack { display: grid; gap: 7px; min-width: 150px; }
.cell-row { display: flex; min-width: 0; align-items: center; gap: 8px; }
.cell-row > input { min-width: 0; }
.panel-header > div:first-child { min-width: 0; flex: 1; }
.panel-header .cell-row { flex-wrap: wrap; }
.cell-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.text-link { color: #9e94ff; font-weight: 650; text-decoration: none; }
.text-link:hover { color: #b5adff; text-decoration: underline; }
code, .code-value { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.code-value { display: inline-flex; max-width: 100%; align-items: center; padding: 4px 7px; border: 1px solid rgba(39, 49, 69, .78); border-radius: 6px; background: var(--bg); color: #c8d0df; font-size: 11px; word-break: break-all; }

.badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 3px 9px;
    border: 1px solid transparent;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 680;
    line-height: 1;
    white-space: nowrap;
}
.badge-green { border-color: rgba(54, 207, 167, .18); background: var(--green-soft); color: var(--green); }
.badge-red { border-color: rgba(255, 100, 116, .18); background: var(--red-soft); color: var(--red); }
.badge-orange { border-color: rgba(242, 186, 85, .18); background: var(--orange-soft); color: var(--orange); }
.badge-blue { border-color: rgba(103, 174, 247, .18); background: var(--blue-soft); color: var(--blue); }
.badge-neutral { border-color: var(--border); background: var(--surface-3); color: var(--text-2); }

.btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .58; cursor: wait; transform: none; }
.btn-primary { border-color: #8679f2; background: #6352cf; color: #fff; }
.btn-primary:hover { background: #7060d5; }
.btn-secondary, .btn-ghost { border-color: var(--border); background: var(--surface-2); color: var(--text-2); }
.btn-secondary:hover, .btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-3); color: var(--text); }
.btn-success { border-color: rgba(54, 207, 167, .24); background: var(--green-soft); color: var(--green); }
.btn-danger { border-color: rgba(255, 100, 116, .22); background: var(--red-soft); color: var(--red); }
.btn-danger:hover { border-color: rgba(255, 100, 116, .4); background: rgba(255, 100, 116, .2); }
.btn-sm { min-height: 32px; padding: 0 10px; border-radius: 7px; font-size: 11px; }
.btn-icon { width: 34px; padding: 0; }

.accounts-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.account-count { flex-shrink: 0; color: var(--text-3); font-size: 12px; }
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.account-card {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 220px;
    padding: 19px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: inherit;
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}
.account-card:hover { border-color: rgba(119, 104, 232, .62); background: var(--surface-2); transform: translateY(-2px); }
.account-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.account-card > *, .account-card-header > div { min-width: 0; }
.account-card-header > div { flex: 1; }
.account-card-header > .badge { flex-shrink: 0; }
.account-card-name { margin: 0; overflow: hidden; font-size: 16px; font-weight: 720; white-space: nowrap; text-overflow: ellipsis; }
.account-card-meta { display: flex; gap: 13px; margin-top: 6px; color: var(--text-3); font-size: 11px; flex-wrap: wrap; }
.account-card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.account-traffic { align-self: end; margin-top: 26px; }
.account-traffic-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.account-traffic-main { font-size: 19px; font-weight: 720; }
.account-traffic-limit { color: var(--text-3); font-size: 11px; }
.account-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; color: var(--text-3); font-size: 11px; }
.account-card-footer span { min-width: 0; overflow-wrap: anywhere; }
.account-card-footer i { color: #9e94ff; font-size: 15px; }

.detail-summary { display: grid; grid-template-columns: 1fr 1.35fr 1fr 1.2fr; margin-bottom: 18px; }
.detail-summary .system-metric { border: 1px solid var(--border); background: var(--surface); }
.detail-summary .system-metric:first-child { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.detail-summary .system-metric:last-child { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.detail-summary .system-metric + .system-metric { border-left: 0; }
.secret-value { display: inline-flex; align-items: center; gap: 5px; }
.copy-button {
    display: inline-grid;
    width: 30px;
    height: 30px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
}
.copy-button:hover { background: var(--surface-3); color: #a99fff; }

.monitor-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary-card { padding: 16px 17px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.summary-card-value { margin-top: 6px; font-size: 24px; font-weight: 740; }

.rules-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr); gap: 18px; align-items: start; }
.info-banner { display: flex; gap: 12px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid rgba(103, 174, 247, .22); border-radius: var(--radius); background: var(--blue-soft); color: var(--text-2); }
.info-banner i { margin-top: 1px; color: var(--blue); }
.info-banner strong { display: block; margin-bottom: 2px; color: var(--text); }
.rule-preview { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); align-items: center; gap: 8px; }
.rule-arrow { color: var(--text-3); text-align: center; }

label { display: block; margin: 0 0 7px; color: var(--text-2); font-size: 12px; font-weight: 620; }
input, textarea, select {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: 0;
    background: var(--bg);
    color: var(--text);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea { min-height: 104px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #5f697d; }
input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(119, 104, 232, .14); }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-help { margin: 6px 0 0; color: var(--text-3); font-size: 11px; }

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 5, 10, .78);
}
.modal-overlay.show { display: flex; }
.modal {
    width: min(100%, 560px);
    max-height: min(88vh, 800px);
    overflow-y: auto;
    overflow-wrap: anywhere;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .52);
}
.modal-sm { width: min(100%, 420px); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 20px 15px; }
.modal-title { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 17px; }
.modal-title i { color: #a99fff; }
.modal-description { margin: 6px 0 0; color: var(--text-2); font-size: 12px; }
.modal-body { padding: 5px 20px 20px; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 20px; flex-wrap: wrap; }
.modal-close { flex: 0 0 auto; }

.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: var(--radius);
    font-size: 13px;
}
.flash-success { border-color: rgba(54, 207, 167, .28); background: var(--green-soft); color: #9ce8d4; }
.flash-error { border-color: rgba(255, 100, 116, .28); background: var(--red-soft); color: #ffb2ba; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; color: var(--text-3); font-size: 12px; }
.breadcrumb [aria-current], .metric-value, .info-banner > div { min-width: 0; overflow-wrap: anywhere; }
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: #a99fff; }
.breadcrumb .sep { color: #4a556a; }
.empty-state { display: grid; min-height: 220px; place-items: center; padding: 34px 20px; color: var(--text-2); text-align: center; }
.empty-state-inner { max-width: 360px; }
.empty-icon { display: grid; width: 48px; height: 48px; place-items: center; margin: 0 auto 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text-3); font-size: 20px; }
.empty-state h3 { margin: 0 0 5px; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0 0 16px; font-size: 12px; }
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: #1d2636;
    color: var(--text);
    box-shadow: 0 16px 50px rgba(0,0,0,.42);
    font-size: 12px;
    transform: translateX(-50%);
}
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.login-page {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    padding: 28px;
    background: #090d14;
}
.login-shell {
    display: grid;
    width: min(100%, 900px);
    min-height: 540px;
    grid-template-columns: 1.05fr .95fr;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 32px 100px rgba(0,0,0,.44);
}
.login-context { display: flex; flex-direction: column; padding: 42px; background: #0e141f; border-right: 1px solid var(--border); }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-title { font-size: 18px; }
.login-copy { margin: auto 0; }
.login-copy h1 { max-width: 370px; margin: 0; font-size: 34px; line-height: 1.22; letter-spacing: -.035em; }
.login-copy > p { max-width: 390px; margin: 13px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.75; }
.trust-list { display: grid; gap: 12px; margin: 30px 0 0; padding: 0; list-style: none; }
.trust-list li { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 12px; }
.trust-list i { color: var(--green); }
.login-version { color: var(--text-3); font-size: 11px; }
.login-form-pane { display: flex; flex-direction: column; justify-content: center; padding: 42px; }
.login-form-pane h2 { margin: 0; font-size: 22px; }
.login-form-pane > p { margin: 7px 0 26px; color: var(--text-2); font-size: 12px; }
.login-form-pane .btn { width: 100%; min-height: 44px; margin-top: 5px; }
.login-form-pane .flash { margin-bottom: 18px; }

@media (max-width: 1180px) {
    .system-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid > .panel:last-child { grid-column: 2; }
    .traffic-summary { min-height: auto; }
    .rules-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 208px; }
    .main { padding-inline: 20px; }
    .detail-summary { grid-template-columns: 1fr; gap: 10px; }
    .detail-summary .system-metric { border: 1px solid var(--border) !important; border-radius: var(--radius) !important; }
}

@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .sidebar { width: min(84vw, 300px); transform: translateX(-102%); box-shadow: 12px 0 42px rgba(0,0,0,.45); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 80px 14px 34px; }
    .content-shell { max-width: none; }
    .page-header { align-items: stretch; flex-direction: column; gap: 15px; margin-bottom: 18px; }
    .page-title { font-size: 23px; }
    .page-actions { justify-content: flex-start; }
    .page-actions .btn { flex: 1 1 auto; }
    .page-meta { width: 100%; }
    .system-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .system-metric { min-height: 108px; padding: 15px; }
    .system-metric:last-child { grid-column: 1 / -1; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-grid > .panel:last-child { grid-column: auto; }
    .dashboard-grid .attention-panel { grid-row: auto; }
    .dashboard-grid .panel-body { min-height: auto; }
    .panel-header { min-height: 54px; padding: 12px 14px; }
    .panel-body { padding: 14px; }
    .panel-footer { padding: 0 14px; }
    .accounts-grid { grid-template-columns: 1fr; }
    .account-card { min-height: 205px; }
    .monitor-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-row { grid-template-columns: 1fr; }
    .modal-overlay { padding: 10px; }
    .modal { max-height: 92vh; }
    .modal-actions { align-items: stretch; flex-direction: column-reverse; }
    .modal-actions .btn { width: 100%; }
    .rule-preview { grid-template-columns: 1fr; }
    .rule-arrow { transform: rotate(90deg); }
    .login-page { padding: 14px; }
    .login-shell { width: min(100%, 460px); min-height: auto; grid-template-columns: 1fr; }
    .login-context { padding: 24px; border-right: 0; border-bottom: 1px solid var(--border); }
    .login-copy { margin: 34px 0 12px; }
    .login-copy h1 { font-size: 27px; }
    .trust-list { display: none; }
    .login-version { display: none; }
    .login-form-pane { padding: 28px 24px 30px; }

    .rwd-table thead { display: none; }
    .rwd-table, .rwd-table tbody, .rwd-table tr, .rwd-table td { display: block; width: 100%; }
    .rwd-table tbody { padding: 8px; }
    .rwd-table tr { margin-bottom: 9px; padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
    .rwd-table tr:last-child { margin-bottom: 0; }
    .rwd-table td { display: grid; grid-template-columns: 76px minmax(0, 1fr); min-height: 38px; align-items: center; column-gap: 14px; padding: 8px 0; border-bottom: 1px solid rgba(39,49,69,.72); text-align: right; overflow-wrap: anywhere; }
    .rwd-table td:last-child { border-bottom: 0; }
    .rwd-table td[data-label]::before { content: attr(data-label); flex: 0 0 76px; color: var(--text-3); font-size: 11px; font-weight: 600; text-align: left; }
    .rwd-table td.hide-mobile { display: none !important; }
    .rwd-table td > * { grid-column: 2; min-width: 0; max-width: 100%; justify-self: end; }
    .rwd-table td .cell-title, .rwd-table td > strong { width: 100%; }
    .rwd-table .secret-value { flex-wrap: wrap; justify-content: flex-end; }
    .rwd-table .cell-stack { width: min(100%, 230px); min-width: 0; }
    .rwd-table .cell-row, .rwd-table .cell-actions { justify-content: flex-end; }
}

@media (max-width: 420px) {
    .page-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-actions .btn { width: 100%; padding-inline: 10px; }
    .system-strip { grid-template-columns: 1fr 1fr; }
    .metric-value { font-size: 20px; }
    .account-card { padding: 16px; }
    .monitor-summary { gap: 9px; }
    .summary-card { padding: 13px; }
    .summary-card-value { font-size: 21px; }
}


/* Shared operation feedback and compact mobile administration. */
[hidden] { display: none !important; }
.sidebar-close { display: none; }
.form-feedback { color: var(--text-2); margin: 10px 0; overflow-wrap: anywhere; }
.form-feedback:empty { display: none; }
.form-feedback.is-error { color: var(--red); }
[aria-invalid="true"] { border-color: var(--red); }
.operation-feedback { padding: 16px 18px; margin-bottom: 18px; border: 1px solid var(--green); border-radius: var(--radius); background: var(--surface); }
.operation-feedback p { margin: 0 0 10px; }
.operation-feedback ul:empty { display: none; }
.operation-feedback li { margin-bottom: 8px; overflow-wrap: anywhere; }
.operation-feedback.is-error { border-color: var(--orange); }
.attention-more { width: 100%; margin: 8px 0; }
#attention-title { scroll-margin-top: 90px; }
.service-filters { display: flex; align-items: end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.service-filters .form-group { flex: 1 1 180px; margin: 0; }
.service-filters .form-hint { margin: 0; }
@media (max-width: 768px) {
    .sidebar-close { display: grid; position: absolute; top: 18px; right: 12px; }
    .sidebar .brand { padding-right: 60px; }
    .page-actions .page-meta { flex: 0 0 100%; grid-column: 1 / -1; width: auto; white-space: normal; overflow-wrap: anywhere; }
    .page-actions > .page-meta + .btn:last-child { grid-column: 1 / -1; }
    .dashboard-metrics { gap: 8px; }
    .dashboard-metrics > .system-metric { min-height: 76px; padding: 10px 12px; }
    .dashboard-metrics .metric-note { white-space: normal; overflow: visible; font-size: 11px; }
    .dashboard-metrics > .system-metric:last-child { grid-column: auto; }
    .dashboard-metrics > .system-metric:nth-child(3) { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 48px; }
    .dashboard-metrics > .system-metric:nth-child(3) .metric-value { font-size: 18px; }
    .dashboard-metrics > .system-metric:nth-child(3) .metric-note { margin-left: auto; }
    .btn-sm { min-height: 40px; font-size: 13px; padding-inline: 12px; }
    .attention-item .alert-detail, .attention-note { font-size: 12px; }
    .detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-summary .system-metric { min-height: 100px; padding: 12px; }
    .detail-summary .system-metric:last-child { grid-column: auto; }
    .detail-summary .metric-note { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Probe evidence must remain readable in the existing mobile table cards. */
.node-health { min-width: 230px; max-width: 470px; white-space: normal; overflow-wrap: anywhere; }
.node-health .badge { white-space: normal; text-align: left; }
.node-health summary { cursor: pointer; margin-top: 8px; color: #b3aaff; }
.probe-stage { margin: 10px 0; }
@media (max-width: 768px) {
    .rwd-table td.node-health { display: block; min-width: 0; max-width: none; text-align: left; }
    .rwd-table td.node-health::before { display: block; margin-bottom: 8px; }
    .rwd-table td.node-health > * { max-width: 100%; }
    .node-health .cell-subtitle { margin-top: 6px; }
}

/* Keep the subscription toggle independent of full-width text inputs. */
.form-group label.node-filter-toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.node-filter-toggle input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
