:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --text: #172033;
    --muted: #6f7a8d;
    --line: #e4e8ef;
    --primary: #1d4ed8;
    --primary-dark: #173ea7;
    --danger: #b42318;
    --success-bg: #ecfdf3;
    --success-text: #067647;
    --error-bg: #fff1f0;
    --error-text: #b42318;
    --shadow: 0 12px 30px rgba(20, 32, 55, .06);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "HarmonyOS Sans", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .94em; }
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 10;
    display: flex; flex-direction: column; padding: 24px 18px;
    color: #eef3ff; background: #111827;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
    color: white; background: #2563eb; font-weight: 800; letter-spacing: -.04em;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; }
.brand span { margin-top: 1px; color: #8fa0ba; font-size: 11px; }
.sidebar nav { margin-top: 32px; display: grid; gap: 6px; }
.sidebar nav a { padding: 10px 12px; border-radius: 8px; color: #b9c4d6; text-decoration: none; }
.sidebar nav a:hover { background: #1f2937; color: #fff; }
.sidebar nav a.active { background: #263348; color: #fff; font-weight: 650; }
.sidebar-footer { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid #293447; }
.signed-in { margin-bottom: 8px; color: #9aa8bc; font-size: 12px; }
.link-button { border: 0; padding: 0; color: #c9d4e5; background: none; cursor: pointer; }
.link-button:hover { color: #fff; text-decoration: underline; }
.main { min-height: 100vh; margin-left: 250px; padding: 36px 40px 60px; }
.main-auth { margin-left: 0; padding: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head.compact { align-items: flex-start; }
.page-head h1 { margin: 3px 0 2px; font-size: 28px; line-height: 1.25; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; }
.head-actions form { margin: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.search-card { margin-bottom: 16px; padding: 14px 16px; }
.search-form { display: flex; gap: 8px; }
.search-input-wrap { flex: 1; }
.search-form input { width: 100%; }
.result-count { margin-top: 10px; color: var(--muted); font-size: 12px; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
    width: 100%; border: 1px solid #cfd6e2; border-radius: 8px; padding: 10px 12px;
    color: var(--text); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus { border-color: #7598ef; box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }
input[type="checkbox"], input[type="radio"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex: 0 0 16px;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    accent-color: var(--primary);
    vertical-align: middle;
}
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .18);
    outline-offset: 2px;
}
textarea { resize: vertical; }
select { cursor: pointer; }
.button {
    display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 8px 14px;
    border: 1px solid #cfd6e2; border-radius: 8px; color: #273248; background: #fff;
    font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.button:hover { border-color: #aeb8c8; background: #f8fafc; text-decoration: none; }
.button.primary { border-color: var(--primary); color: #fff; background: var(--primary); }
.button.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.button.danger { border-color: #f0b5af; color: var(--danger); background: #fff7f6; }
.button.ghost { color: var(--muted); background: transparent; }
.button.full { width: 100%; }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: #657086; background: #fafbfc; font-size: 12px; font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
.server-link { color: var(--text); font-weight: 700; }
td.actions { white-space: nowrap; }
td.actions a + a, td.actions button + button, td.actions a + button, td.actions button + a { margin-left: 10px; }
.nowrap { white-space: nowrap; }
.empty-state { display: grid; justify-items: center; gap: 4px; padding: 64px 20px; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: 16px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 20px; color: var(--muted); }
.alert { margin-bottom: 18px; padding: 12px 14px; border-radius: 9px; }
.alert.success { color: var(--success-text); background: var(--success-bg); border: 1px solid #abefc6; }
.alert.error { color: var(--error-text); background: var(--error-bg); border: 1px solid #f7c5c0; }
.error-list > div + div { margin-top: 4px; }
.form-card { max-width: 920px; padding: 0; overflow: hidden; }
.form-section { padding: 24px; border-bottom: 1px solid var(--line); }
.section-title, .card-title { margin-bottom: 18px; }
.section-title strong, .section-title span, .card-title strong, .card-title span { display: block; }
.section-title strong, .card-title strong { font-size: 16px; }
.section-title span, .card-title span { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.full-span { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; font-weight: 700; }
.field label span { margin-left: 5px; color: var(--muted); font-size: 11px; font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 24px; background: #fbfcfd; }
.narrow-form { max-width: 600px; padding: 24px; }
.narrow-form .field + .field { margin-top: 18px; }
.narrow-form .form-actions { margin: 24px -24px -24px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-card { padding: 22px; }
.full-detail { grid-column: 1 / -1; }
.details { margin: 0; }
.details > div { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.details > div:last-child { border-bottom: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; min-width: 0; }
.details dd code { word-break: break-all; }
.copy-button {
    margin-left: 8px; padding: 2px 7px; border: 1px solid #d8dee8; border-radius: 6px;
    color: #5b6780; background: #fff; font-size: 11px; cursor: pointer;
}
.copy-button:hover { color: var(--primary); border-color: #9bb2ec; }
.graph-link { display: inline-block; text-decoration: none; }
.graph-link:hover { text-decoration: none; }
.no-left-margin { margin-left: 0; }
.table-graph-link { margin-left: 8px; font-size: 11px; white-space: nowrap; }
.copy-button:disabled { opacity: .6; cursor: wait; }

.copy-icon-button {
    display: inline-grid;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    place-items: center;
    margin-left: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    color: #7b879a;
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
    transition: color .15s ease, background-color .15s ease, transform .15s ease;
}
.copy-icon-button svg {
    display: block;
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.copy-icon-button:hover {
    color: var(--primary);
    background: #eef3ff;
}
.copy-icon-button:active { transform: scale(.94); }
.copy-icon-button:focus-visible {
    outline: 2px solid rgba(43, 91, 211, .28);
    outline-offset: 1px;
}
.copy-icon-button.is-copied {
    color: var(--success-text);
    background: var(--success-bg);
}
.copy-icon-button:disabled { opacity: .55; cursor: wait; }

.hidden { display: none !important; }
.sr-only {
    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;
}

.security-note { margin-top: 14px; padding: 10px 12px; border-radius: 8px; color: #6f5b1c; background: #fffaeb; font-size: 12px; }
.ip-list { display: grid; gap: 8px; }
.ip-list > div { display: flex; align-items: center; }
.notes-content { min-height: 50px; white-space: normal; word-break: break-word; }
.muted { color: var(--muted); }
.auth-wrap, .install-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-card, .install-card { width: 100%; max-width: 430px; padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 18px 50px rgba(20, 32, 55, .09); }
.auth-brand, .install-brand { margin-bottom: 30px; }
.auth-card h1, .install-card h1 { margin: 0 0 4px; font-size: 25px; }
.auth-card .field, .install-card .field { margin-top: 18px; }
.auth-card .button, .install-card .button { margin-top: 22px; }
.install-body { background: #f3f6fb; }
.checks { margin: 22px 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.checks > div { display: flex; justify-content: space-between; padding: 9px 11px; border-bottom: 1px solid var(--line); }
.checks > div:last-child { border-bottom: 0; }
.checks .ok { color: var(--success-text); }
.checks .bad { color: var(--danger); }
.install-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.search-form-wide select { width: min(320px, 32vw); }
.table-subtext { margin-top: 3px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.field-help { margin-top: 6px; color: var(--muted); font-size: 11px; }
.port-check-status { min-height: 20px; margin-top: 6px; font-size: 12px; }
.port-check-status.checking { color: var(--muted); }
.port-check-status.available { color: var(--success-text); }
.port-check-status.conflict, .port-check-status.error { color: var(--danger); }
input[aria-invalid="true"] { border-color: #e58d84; box-shadow: 0 0 0 3px rgba(180, 35, 24, .08); }
.inline-notice { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #c9d8fb; border-radius: 8px; color: #31466f; background: #f4f7ff; }
.empty-inline { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 100px; }
.card-section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-title.no-margin { margin: 0; }
.compact-empty { padding: 36px 20px; }
@media (max-width: 760px) {
    .search-form-wide select { width: 100%; flex-basis: 100%; }
    .card-section-head { align-items: stretch; flex-direction: column; }
    .card-section-head .button { width: 100%; }
}

@media (max-width: 900px) {
    .sidebar { position: static; width: auto; min-height: auto; }
    .sidebar nav { grid-template-columns: repeat(4, 1fr); margin-top: 20px; }
    .sidebar-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
    .signed-in { margin: 0; }
    .main { margin-left: 0; padding: 26px 20px 48px; }
    .main-auth { padding: 0; }
    .detail-grid { grid-template-columns: 1fr; }
    .full-detail { grid-column: auto; }
}
@media (max-width: 640px) {
    .sidebar nav { grid-template-columns: 1fr; }
    .page-head { align-items: stretch; flex-direction: column; }
    .head-actions { width: 100%; }
    .head-actions .button, .head-actions form, .head-actions form .button { flex: 1; width: 100%; }
    .search-form { flex-wrap: wrap; }
    .search-input-wrap { flex-basis: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .full-span { grid-column: auto; }
    .details > div { grid-template-columns: 1fr; gap: 5px; }
    .auth-wrap, .install-wrap { padding: 16px; }
    .auth-card, .install-card { padding: 24px 20px; }
}

/* Tags — Feishu Bitable inspired compact labels */
.tag-badge-list, .server-tag-cell, .tag-cloud {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.tag-red { --tag-accent: #d94b58; --tag-text: #7f2430; --tag-bg: #fde7e9; --tag-hover: #f9d9dc; }
.tag-orange { --tag-accent: #d97824; --tag-text: #75400e; --tag-bg: #feead6; --tag-hover: #f9dfc3; }
.tag-yellow { --tag-accent: #c29216; --tag-text: #66500b; --tag-bg: #fff1b8; --tag-hover: #f8e7a3; }
.tag-blue { --tag-accent: #4c79d8; --tag-text: #284b86; --tag-bg: #e8f0ff; --tag-hover: #dce8ff; }
.tag-green { --tag-accent: #3b9b69; --tag-text: #246041; --tag-bg: #dff4e7; --tag-hover: #d2eedc; }
.tag-purple { --tag-accent: #8062c7; --tag-text: #533d88; --tag-bg: #eee8ff; --tag-hover: #e5dcfb; }
.tag-gray { --tag-accent: #77808e; --tag-text: #3f4754; --tag-bg: #eef0f3; --tag-hover: #e4e7eb; }
.tag-badge {
    display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 2px 8px;
    border: 1px solid transparent; border-radius: 5px;
    color: var(--tag-text, #3f4754); background: var(--tag-bg, #eef0f3);
    font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap;
    box-shadow: none;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.tag-badge::before { content: none; display: none; }
.tag-badge:hover {
    background: var(--tag-hover, #e4e7eb);
    border-color: rgba(15, 23, 42, .06);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.server-head-tags { margin-top: 9px; }
.server-head-tags .tag-badge { min-height: 25px; padding: 3px 9px; font-size: 12px; }
.tag-inactive { opacity: .5; filter: grayscale(.18); }
.tag-more {
    display: inline-flex; align-items: center; justify-content: center; min-width: 25px; min-height: 24px;
    padding: 2px 7px; border: 1px solid transparent; border-radius: 5px;
    color: #556070; background: #eef0f3; font-size: 12px; font-weight: 500; line-height: 18px;
    white-space: nowrap;
}
.tag-more-button { cursor: pointer; font-family: inherit; }
.tag-more-button:hover { color: #284b86; border-color: rgba(76, 121, 216, .18); background: #e8f0ff; }

.tag-choice { position: relative; display: inline-flex; cursor: pointer; }
.tag-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tag-choice span {
    display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 3px 9px;
    border: 1px solid transparent; border-radius: 5px;
    color: var(--tag-text, #3f4754); background: var(--tag-bg, #eef0f3);
    font-size: 12px; font-weight: 500; line-height: 20px;
    box-shadow: none;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.tag-choice span::before { content: none; display: none; }
.tag-choice span::after {
    content: ''; width: 0; overflow: hidden; color: var(--tag-accent, #77808e);
    font-size: 12px; font-weight: 800; line-height: 1;
    transition: width .12s ease;
}
.tag-choice:hover span {
    background: var(--tag-hover, #e4e7eb);
    border-color: rgba(15, 23, 42, .08);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.tag-choice input:focus-visible + span { outline: 3px solid rgba(37, 99, 235, .16); outline-offset: 2px; }
.tag-choice input:checked + span {
    border-color: var(--tag-accent, #77808e);
    background: var(--tag-bg, #eef0f3);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .42);
}
.tag-choice input:checked + span::after { content: '✓'; width: 12px; }
.tag-editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.button.small { min-height: 31px; padding: 5px 10px; font-size: 12px; }
.text-link { font-size: 12px; }
.inline-tag-create {
    display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 260px) auto; gap: 8px;
    align-items: center; margin-top: 12px; padding: 12px; border: 1px dashed #c8d2e3; border-radius: 9px; background: #fafcff;
}
.inline-status { grid-column: 1 / -1; min-height: 16px; color: var(--muted); font-size: 11px; }
.inline-status.success { color: var(--success-text); }
.inline-status.error { color: var(--danger); }

.tag-filter-form { flex-wrap: wrap; }
.full-search-row { flex: 1 0 100%; }
.tag-filter-panel { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.tag-filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.tag-filter-heading strong { font-size: 12px; }
.tag-filter-heading select { width: auto; min-width: 170px; padding: 6px 9px; font-size: 12px; }
.compact-tag-cloud { gap: 6px; }
.compact-tag-cloud .tag-choice span { min-height: 25px; padding: 2px 8px; font-size: 12px; }
.server-tags-column { min-width: 178px; }
.server-tags-wrap {
    display: flex; width: 100%; max-width: 100%; min-width: 0; align-items: center;
    vertical-align: middle;
}
.server-tag-cell { flex: 1 1 auto; width: 100%; min-width: 0; }
.server-tag-cell .tag-badge { min-height: 23px; padding: 2px 7px; font-size: 12px; }
.adaptive-server-tags {
    display: flex; width: 100%; max-width: 100%; min-width: 0; align-items: center;
    flex-wrap: nowrap; gap: 6px; overflow: hidden; white-space: nowrap;
}
.adaptive-server-tags .server-tag-item,
.adaptive-server-tags .server-tag-more { flex: 0 0 auto; }
.adaptive-server-tags [hidden] { display: none !important; }
.quick-tag-button {
    display: inline-grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px;
    margin-left: 1px; border: 0; border-radius: 4px; padding: 0;
    color: #7b8492; background: transparent; cursor: pointer;
    transition: color .12s ease, background-color .12s ease;
}
.quick-tag-button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.quick-tag-button:hover { color: var(--primary); background: #eef3ff; }
.quick-tag-button:focus-visible { outline: 2px solid rgba(37, 99, 235, .22); outline-offset: 1px; }

.tag-dialog { width: min(680px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 13px; box-shadow: 0 24px 80px rgba(18, 28, 46, .28); }
.tag-dialog::backdrop { background: rgba(17, 24, 39, .46); }
.tag-dialog-card { margin: 0; }
.tag-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.tag-dialog-head strong, .tag-dialog-head span { display: block; }
.tag-dialog-head span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.dialog-close { border: 0; padding: 0 5px; color: var(--muted); background: transparent; font-size: 25px; line-height: 1; cursor: pointer; }
.dialog-tag-cloud { max-height: 48vh; overflow-y: auto; padding: 20px 22px; }
.tag-dialog-status { min-height: 20px; padding: 0 22px; color: var(--muted); font-size: 12px; }
.tag-dialog-status.error { color: var(--danger); }
.tag-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }

.tag-create-card { margin-bottom: 16px; padding: 20px; }
.tag-create-form { display: grid; grid-template-columns: minmax(190px, 1.2fr) minmax(190px, 1fr) 110px auto auto auto; gap: 12px; align-items: end; }
.tag-create-form .field label { font-size: 12px; }
.check-field { display: flex; align-items: center; gap: 6px; min-height: 39px; white-space: nowrap; cursor: pointer; }
.check-field input, .table-check input { width: auto; }
.tag-management-table input, .tag-management-table select { min-width: 120px; padding: 7px 8px; font-size: 12px; }
.tag-management-table .order-input { min-width: 74px; width: 74px; }
.table-check { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.row-inactive { background: #fafafa; }
.tag-policy-note { margin-top: 16px; }

@media (max-width: 1100px) {
    .tag-create-form { grid-template-columns: 1fr 1fr 100px; }
    .tag-create-form .check-field, .tag-create-form .button { align-self: center; }
}
@media (max-width: 900px) {
    .sidebar nav { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 760px) {
    .inline-tag-create { grid-template-columns: 1fr; }
    .tag-filter-heading { align-items: stretch; flex-direction: column; }
    .tag-filter-heading select { width: 100%; }
    .tag-create-form { grid-template-columns: 1fr; }
    .tag-create-form .small-field { width: 100%; }
}
@media (max-width: 640px) {
    .sidebar nav { grid-template-columns: 1fr; }
    .tag-dialog-actions .button { flex: 1; }
}

/* Manual IPMI inspection */
.card-title-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.card-title-actions > div { min-width: 0; }
.ipmi-check-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.ipmi-status-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 10px; border: 1px solid transparent; border-radius: 999px; font-weight: 750; }
.ipmi-status-badge.status-never { color: #556174; background: #f3f5f8; border-color: #d6dce5; }
.ipmi-status-badge.status-success { color: #17663a; background: #ecfdf3; border-color: #a9e8c2; }
.ipmi-status-badge.status-partial { color: #9a4b06; background: #fff5e8; border-color: #f2c48e; }
.ipmi-status-badge.status-failed { color: #9f2017; background: #fff1ef; border-color: #f3b8b2; }
.ipmi-check-message { min-height: 21px; margin-bottom: 6px; font-size: 12px; }
.ipmi-check-message.checking { color: var(--muted); }
.ipmi-check-message.success { color: var(--success-text); }
.ipmi-check-message.warning { color: #9a4b06; }
.ipmi-check-message.error { color: var(--danger); }
.ipmi-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.ipmi-result-block { padding: 15px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.ipmi-result-block h3 { margin: 0 0 8px; font-size: 13px; }
.mini-details { margin: 0; }
.mini-details > div { display: grid; grid-template-columns: 135px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid #ebeff5; }
.mini-details > div:last-child { border-bottom: 0; }
.mini-details dt { color: var(--muted); }
.mini-details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.state-ok { color: var(--success-text); font-weight: 700; }
.state-bad { color: var(--danger); font-weight: 700; }
.ipmi-failure-box { margin-top: 16px; padding: 13px 15px; border: 1px solid #f3b8b2; border-radius: 9px; color: #7d251d; background: #fff6f5; }
.ipmi-failure-box strong, .ipmi-failure-box span { display: block; }
.ipmi-failure-box p { margin: 5px 0; overflow-wrap: anywhere; }
.ipmi-failure-box span { color: #98635e; font-size: 11px; }
.manual-check-note { margin-top: 16px; padding: 10px 12px; border-radius: 8px; color: #536077; background: #f5f7fa; font-size: 11px; }

@media (max-width: 760px) {
    .card-title-actions { align-items: stretch; flex-direction: column; }
    .card-title-actions .button { width: 100%; }
    .ipmi-result-grid { grid-template-columns: 1fr; }
    .mini-details > div { grid-template-columns: 1fr; gap: 3px; }
}

/* TYAN B8033 HTML5 console */
.console-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.console-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.console-status-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 10px; border: 1px solid transparent; border-radius: 999px; font-weight: 750; }
.console-status-badge.status-never { color: #556174; background: #f3f5f8; border-color: #d6dce5; }
.console-status-badge.status-ready, .console-status-badge.status-active { color: #17663a; background: #ecfdf3; border-color: #a9e8c2; }
.console-status-badge.status-starting { color: #2556a5; background: #eef4ff; border-color: #b9cef7; }
.console-status-badge.status-unavailable, .console-status-badge.status-failed { color: #9f2017; background: #fff1ef; border-color: #f3b8b2; }
.console-status-badge.status-disabled { color: #556174; background: #f3f5f8; border-color: #d6dce5; opacity: .75; }
.console-message { min-height: 21px; margin-bottom: 10px; font-size: 12px; overflow-wrap: anywhere; }
.console-message.checking { color: var(--muted); }
.console-message.success { color: var(--success-text); }
.console-message.warning { color: #9a4b06; }
.console-message.error { color: var(--danger); }
.console-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.console-detail-item { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; }
.console-detail-item span, .console-detail-item strong { display: block; }
.console-detail-item span { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.console-detail-item strong { overflow-wrap: anywhere; font-size: 12px; }
.console-notice { margin-top: 14px; padding: 11px 13px; border-radius: 8px; color: #7a5308; background: #fff8e8; border: 1px solid #efcf8f; font-size: 11px; }
.console-notice.error { color: #7d251d; background: #fff6f5; border-color: #f3b8b2; }

@media (max-width: 900px) {
    .console-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .console-actions { justify-content: stretch; }
    .console-actions .button { flex: 1 1 100%; width: 100%; }
}
.console-status-badge.status-expired { color: #556174; background: #f3f5f8; border-color: #d6dce5; }

/* LibreNMS integration */
.no-top-border { padding-top: 0; border-top: 0; }
.compact-check { min-height: 28px; margin-top: 8px; }
.tall-check { min-height: 39px; }
.inline-form { margin-top: 14px; }
.librenms-match-box { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfe; }
.librenms-match-controls { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.3fr); gap: 10px; }
.librenms-match-status { min-height: 19px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.librenms-match-status.checking { color: #2556a5; }
.librenms-match-status.success { color: var(--success-text); }
.librenms-match-status.warning { color: #9a4b06; }
.librenms-match-status.error { color: var(--danger); }
.librenms-port-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 13px; margin-bottom: 14px; }
.librenms-port-heading > span:last-child { color: var(--muted); font-size: 11px; }
.librenms-status-pill { display: inline-flex; min-width: 58px; justify-content: center; padding: 4px 9px; border: 1px solid #d6dce5; border-radius: 999px; color: #556174; background: #f3f5f8; font-size: 11px; font-weight: 800; }
.librenms-status-pill.up { color: #17663a; background: #ecfdf3; border-color: #a9e8c2; }
.librenms-status-pill.down { color: #9f2017; background: #fff1ef; border-color: #f3b8b2; }
.librenms-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 13px; }
.librenms-metrics > div { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; }
.librenms-metrics span, .librenms-metrics strong, .librenms-metrics small { display: block; }
.librenms-metrics span { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.librenms-metrics strong { overflow-wrap: anywhere; font-size: 17px; }
.librenms-metrics small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.librenms-monitor-message { min-height: 19px; color: var(--muted); font-size: 11px; }
.librenms-monitor-message.warning { color: #9a4b06; }
.librenms-monitor-message.error { color: var(--danger); }
.compact-traffic-body .librenms-monitor-message:empty { display: none; }
.librenms-periods { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.librenms-periods button { min-height: 31px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 7px; color: #536077; background: #fff; cursor: pointer; }
.librenms-periods button.active { color: #fff; border-color: var(--primary); background: var(--primary); }
.librenms-graph-wrap { min-height: 220px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.librenms-graph-wrap img { display: block; width: 100%; min-width: 620px; height: auto; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
@media (max-width: 900px) {
    .librenms-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sidebar nav { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .librenms-match-controls, .librenms-metrics { grid-template-columns: 1fr; }
    .librenms-graph-wrap img { min-width: 520px; }
}

/* LibreNMS multi-instance management */
.librenms-security-note {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start;
    margin-bottom: 16px; padding: 14px 16px; border: 1px solid #b9cef7; border-radius: 10px;
    color: #294b7d; background: #f4f8ff;
}
.librenms-security-note strong { display: block; margin-bottom: 3px; color: #21467e; }
.librenms-security-note p { margin: 0; font-size: 12px; line-height: 1.65; }
.librenms-instance-list { display: grid; gap: 14px; }
.librenms-instance-card { overflow: hidden; padding: 0; }
.librenms-instance-card > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 18px 20px; cursor: pointer; list-style: none; user-select: none;
}
.librenms-instance-card > summary::-webkit-details-marker { display: none; }
.librenms-instance-card[open] > summary { border-bottom: 1px solid var(--line); background: #fbfcfe; }
.librenms-instance-summary-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.librenms-instance-summary-main > div { min-width: 0; }
.librenms-instance-summary-main strong, .librenms-instance-summary-main span { display: block; }
.librenms-instance-summary-main span { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.librenms-instance-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #9aa5b5; box-shadow: 0 0 0 4px rgba(154, 165, 181, .13); }
.librenms-instance-dot.active { background: #22a35a; box-shadow: 0 0 0 4px rgba(34, 163, 90, .13); }
.librenms-instance-dot.inactive { background: #9aa5b5; }
.librenms-instance-summary-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.librenms-instance-summary-stats span { padding: 4px 8px; border-radius: 999px; color: #536077; background: #f1f4f8; font-size: 11px; white-space: nowrap; }
.instance-test-state {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    white-space: nowrap;
    box-shadow: none;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.instance-test-state.success { color: #246041; background: #dff4e7; }
.instance-test-state.failed { color: #7f2430; background: #fde7e9; }
.instance-test-state.neutral { color: #3f4754; background: #eef0f3; }
.instance-test-state:hover {
    border-color: rgba(15, 23, 42, .06);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.instance-test-state.success:hover { background: #d2eedc; }
.instance-test-state.failed:hover { background: #f9d9dc; }
.instance-test-state.neutral:hover { background: #e4e7eb; }
.librenms-instance-body { padding: 20px; }
.librenms-instance-form { display: grid; gap: 18px; }
.librenms-instance-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 11px; }
.librenms-instance-meta strong { color: var(--text); }
.librenms-instance-actions, .librenms-instance-operations {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.librenms-instance-actions { justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--line); }
.librenms-instance-operations { margin-top: 14px; padding-top: 14px; border-top: 1px dashed #ccd5e2; }
.librenms-instance-operations form { margin: 0; }
.librenms-new-instance { margin-top: 16px; }
.checkbox-cell { width: 42px; text-align: center; }
.checkbox-cell input { width: auto; }
.bulk-action-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 15px 18px; border-top: 1px solid var(--line); color: var(--muted); background: #fbfcfe; font-size: 12px;
}

@media (max-width: 760px) {
    .librenms-security-note { grid-template-columns: 1fr; }
    .librenms-instance-card > summary { align-items: flex-start; flex-direction: column; }
    .librenms-instance-summary-stats { justify-content: flex-start; }
    .librenms-instance-actions, .librenms-instance-operations { align-items: stretch; flex-direction: column; }
    .librenms-instance-actions .button, .librenms-instance-operations .button, .librenms-instance-operations form { width: 100%; }
    .librenms-instance-operations form .button { width: 100%; }
    .bulk-action-bar { align-items: stretch; flex-direction: column; }
    .bulk-action-bar .button { width: 100%; }
}

/* Compact server detail layout */
.server-detail-head { margin-bottom: 14px; }
.server-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 14px; color: var(--muted); font-size: 12px; }
.server-head-meta span { display: inline-flex; align-items: center; gap: 5px; }
.server-head-meta span + span::before { content: "·"; margin-right: 7px; color: #b2bac7; }
.server-head-tags { margin-top: 10px; }
.server-action-bar {
    display: grid; grid-template-columns: minmax(280px, 1fr) auto; align-items: center; gap: 12px 20px;
    margin-bottom: 16px; padding: 15px 18px;
}
.server-action-summary { min-width: 0; }
.server-action-state { display: flex; align-items: center; gap: 11px; min-width: 0; }
.server-action-state > div { min-width: 0; }
.server-action-state strong, .server-action-state span { display: block; }
.server-action-state strong { font-size: 14px; }
.server-action-state > div span { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.server-action-time { margin-top: 5px; color: var(--muted); font-size: 11px; }
.server-primary-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.server-action-feedback { grid-column: 1 / -1; display: grid; gap: 2px; }
.server-action-feedback .ipmi-check-message, .server-action-feedback .console-message { min-height: 0; margin: 0; }
.server-action-feedback .ipmi-check-message:empty, .server-action-feedback .console-message:empty { display: none; }
.compact-warning { grid-column: 1 / -1; padding: 8px 10px; border-radius: 7px; color: #7a5308; background: #fff8e8; border: 1px solid #efcf8f; font-size: 11px; }
.compact-detail-grid { gap: 14px; }
.compact-info-card { padding: 18px 20px; }
.compact-info-card .card-title { margin-bottom: 9px; }
.compact-details > div { grid-template-columns: 105px 1fr; gap: 12px; padding: 9px 0; }
.compact-security-note { margin-top: 9px; padding: 8px 10px; font-size: 11px; }
.compact-empty-inline { min-height: 74px; }
.compact-traffic-card { padding: 0; overflow: hidden; }
.compact-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.compact-section-head > div { min-width: 0; }
.compact-section-head strong, .compact-section-head span { display: block; }
.compact-section-head strong { font-size: 15px; }
.compact-section-head span { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.compact-traffic-body { padding: 14px 18px 17px; }
.compact-port-heading { margin-bottom: 9px; }
.compact-port-heading > span:last-child { color: var(--muted); font-size: 11px; }
.compact-metrics { gap: 8px; margin-bottom: 3px; }
.compact-metrics > div { padding: 10px 12px; }
.compact-metrics strong { font-size: 15px; }
.compact-periods { display: none; margin: 14px 0 8px; }
.compact-graph-wrap { min-height: 0; max-height: 220px; overflow: hidden; padding: 5px; transition: max-height .2s ease; }
.compact-graph-wrap img { min-width: 0; width: 100%; max-height: 208px; object-fit: contain; }
.compact-traffic-card.traffic-expanded .compact-periods { display: flex; }
.compact-traffic-card.traffic-expanded .compact-graph-wrap { max-height: none; overflow: auto; }
.compact-traffic-card.traffic-expanded .compact-graph-wrap img { min-width: 620px; max-height: none; object-fit: initial; }
.compact-disclosure { padding: 0; overflow: hidden; }
.compact-disclosure > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px;
    cursor: pointer; list-style: none; user-select: none;
}
.compact-disclosure > summary::-webkit-details-marker { display: none; }
.compact-disclosure > summary:hover { background: #fbfcfe; }
.compact-disclosure > summary > div { min-width: 0; }
.compact-disclosure > summary strong, .compact-disclosure > summary span { display: block; }
.compact-disclosure > summary strong { font-size: 14px; }
.compact-disclosure > summary > div span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.disclosure-indicator { flex: 0 0 auto; color: var(--primary); font-size: 11px; }
.compact-disclosure[open] .disclosure-indicator { font-size: 0; }
.compact-disclosure[open] .disclosure-indicator::after { content: "收起"; font-size: 11px; }
.disclosure-body { padding: 0 18px 17px; border-top: 1px solid var(--line); }
.disclosure-body > .ipmi-result-grid { margin-top: 15px; }
.compact-ip-list { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); padding-top: 14px; }
.compact-ip-list > div { justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.detail-footer-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 1px 4px; color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
    .server-action-bar { grid-template-columns: 1fr; }
    .server-primary-actions { justify-content: flex-start; }
    .server-action-feedback, .compact-warning { grid-column: auto; }
    .compact-traffic-card.traffic-expanded .compact-graph-wrap img { min-width: 520px; }
}
@media (max-width: 640px) {
    .server-head-meta { align-items: flex-start; flex-direction: column; gap: 3px; }
    .server-head-meta span + span::before { display: none; }
    .server-action-bar { padding: 14px; }
    .server-action-state { align-items: flex-start; }
    .server-primary-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
    .server-primary-actions .button { width: 100%; }
    .compact-section-head { align-items: stretch; flex-direction: column; }
    .compact-section-head .button { width: 100%; }
    .compact-metrics { grid-template-columns: 1fr 1fr; }
    .compact-graph-wrap { max-height: 180px; }
    .compact-disclosure > summary { padding: 13px 15px; }
    .disclosure-body { padding: 0 15px 15px; }
}

/* Server detail refinements */
.additional-ip-inline { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.additional-ip-inline-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.additional-ip-inline-head strong { font-size: 13px; }
.additional-ip-inline-head span { color: var(--muted); font-size: 11px; }
.additional-ip-empty { padding: 9px 0 2px; font-size: 12px; }
.additional-ip-detail-list { display: grid; gap: 9px; }
.additional-ip-detail { padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; }
.additional-ip-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.additional-ip-detail-head code { overflow-wrap: anywhere; font-weight: 700; }
.additional-ip-detail dl { display: grid; gap: 5px; margin: 0; }
.additional-ip-detail dl > div { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 9px; align-items: start; }
.additional-ip-detail dt { color: var(--muted); font-size: 11px; }
.additional-ip-detail dd { min-width: 0; margin: 0; font-size: 12px; line-height: 1.55; }
.available-ip-ranges { display: inline; white-space: normal; overflow-wrap: anywhere; }
.additional-ip-note { font-size: 11px; line-height: 1.55; }

/* The graph is full-size by default. Collapsing hides it instead of showing an unreadable thumbnail. */
.compact-traffic-card:not(.traffic-expanded) .compact-periods,
.compact-traffic-card:not(.traffic-expanded) .compact-graph-wrap { display: none; }
.compact-traffic-card.traffic-expanded .compact-periods { display: flex; }
.compact-traffic-card.traffic-expanded .compact-graph-wrap {
    display: block; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 8px;
}
.compact-traffic-card.traffic-expanded .compact-graph-wrap img {
    display: block; width: 100%; min-width: 0; max-height: none; object-fit: contain;
}

@media (max-width: 640px) {
    .additional-ip-detail-head { align-items: flex-start; flex-direction: column; }
    .additional-ip-detail-head .copy-button { width: 100%; }
    .additional-ip-detail dl > div { grid-template-columns: 48px minmax(0, 1fr); }
}

/* Server detail refinements */
.server-action-title { min-width: 0; margin-bottom: 9px; }
.server-action-title strong, .server-action-title span { display: block; }
.server-action-title strong { font-size: 14px; }
.server-action-title span { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ipmi-visual-status {
    display: grid; grid-template-columns: repeat(3, minmax(118px, 1fr)); gap: 8px;
}
.oob-status-item {
    position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) 8px; gap: 10px;
    align-items: center; min-width: 0; padding: 9px 11px;
    border: 1px solid #e5e9f0; border-radius: 12px; background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .035);
}
.oob-status-icon {
    display: inline-grid; width: 36px; height: 36px; place-items: center;
    border-radius: 10px; color: #667085; background: #f1f4f8;
}
.oob-status-icon svg {
    width: 19px; height: 19px; fill: none; stroke: currentColor;
    stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8;
}
.oob-status-copy { min-width: 0; }
.oob-status-copy small, .oob-status-copy strong { display: block; }
.oob-status-copy small {
    margin-bottom: 2px; color: var(--muted); font-size: 10px; font-weight: 650; line-height: 1.2;
}
.oob-status-copy strong {
    overflow: hidden; color: var(--text); font-size: 13px; line-height: 1.25;
    text-overflow: ellipsis; white-space: nowrap;
}
.oob-status-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #98a2b3;
    box-shadow: 0 0 0 3px rgba(152, 162, 179, .12);
}
.oob-status-item.good .oob-status-icon { color: #087a45; background: #e9f8ef; }
.oob-status-item.good .oob-status-dot { background: #18a566; box-shadow: 0 0 0 3px rgba(24, 165, 102, .13); }
.oob-status-item.warn .oob-status-icon { color: #a15c00; background: #fff4d8; }
.oob-status-item.warn .oob-status-dot { background: #e99a12; box-shadow: 0 0 0 3px rgba(233, 154, 18, .14); }
.oob-status-item.bad .oob-status-icon { color: #b42318; background: #ffebe8; }
.oob-status-item.bad .oob-status-dot { background: #d92d20; box-shadow: 0 0 0 3px rgba(217, 45, 32, .13); }
.oob-status-item.neutral .oob-status-icon { color: #667085; background: #f1f4f8; }
.status-help {
    display: inline-grid; width: 13px; height: 13px; margin-left: 3px; place-items: center;
    border: 1px solid #cbd2dc; border-radius: 50%; color: #667085; font-size: 8px; font-weight: 800;
    vertical-align: 1px;
}
.server-head-meta-single { gap: 0; }


.additional-ip-compact-list { display: grid; gap: 7px; }
.additional-ip-compact-item {
    display: flex; align-items: center; justify-content: flex-start; gap: 6px;
    padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe;
}
.additional-ip-compact-item code { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }

.notes-card { padding: 0; overflow: hidden; }
.notes-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.notes-card-head > div { min-width: 0; }
.notes-card-head strong, .notes-card-head span { display: block; }
.notes-card-head strong { font-size: 14px; }
.notes-card-head span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.notes-preview { padding: 15px 18px 17px; color: var(--text); font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; white-space: pre-wrap; }
.notes-preview.is-collapsed { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.notes-preview.is-expanded { display: block; overflow: visible; -webkit-line-clamp: unset; }

@media (max-width: 640px) {
    .ipmi-visual-status { grid-template-columns: 1fr; }
    .oob-status-item { width: 100%; }
    .additional-ip-compact-item { align-items: center; flex-direction: row; }
    .additional-ip-compact-item .copy-button { width: auto; }
    .notes-card-head { align-items: stretch; flex-direction: column; }
    .notes-card-head .button { width: 100%; }
}

.network-additional-ip { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border, #e5e7eb); }

/* Server detail status refinements */
.server-detail-head .server-head-meta { display: none; }
.server-action-bar { grid-template-columns: auto minmax(310px, 1fr); }
.server-action-summary { width: max-content; max-width: 100%; }
.ipmi-visual-status {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.oob-status-item {
    flex: 0 0 148px;
    width: 148px;
    min-height: 54px;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 12px 8px 9px;
    border-radius: 10px;
}
.oob-status-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
}
.oob-status-icon svg { width: 17px; height: 17px; }
.oob-status-copy { padding-right: 9px; }
.oob-status-copy small {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 14px;
}
.oob-status-copy strong { font-size: 13px; }
.oob-status-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 6px;
    height: 6px;
}
.server-primary-actions { justify-self: end; }

.status-help-details {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    line-height: 1;
}
.status-help-details > summary {
    display: inline-grid;
    width: 14px;
    height: 14px;
    place-items: center;
    border: 1px solid #c7cfda;
    border-radius: 50%;
    color: #667085;
    background: #fff;
    cursor: pointer;
    font-size: 9px;
    font-weight: 800;
    list-style: none;
    user-select: none;
}
.status-help-details > summary::-webkit-details-marker { display: none; }
.status-help-details > summary:hover,
.status-help-details > summary:focus-visible,
.status-help-details[open] > summary {
    border-color: #7f8ea3;
    color: #344054;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 64, 84, .08);
}
.status-help-popover {
    position: absolute;
    z-index: 40;
    top: 21px;
    right: -12px;
    width: min(320px, calc(100vw - 48px));
    padding: 11px 12px;
    border: 1px solid #d9dfe8;
    border-radius: 10px;
    color: var(--text);
    background: #fff;
    box-shadow: 0 12px 30px rgba(16, 24, 40, .16);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.55;
}
.status-help-popover::before {
    content: "";
    position: absolute;
    top: -5px;
    right: 15px;
    width: 9px;
    height: 9px;
    border-top: 1px solid #d9dfe8;
    border-left: 1px solid #d9dfe8;
    background: #fff;
    transform: rotate(45deg);
}
.status-help-popover strong,
.status-help-popover span { display: block; }
.status-help-popover strong { margin-bottom: 4px; font-size: 12px; }
.status-help-popover span { color: var(--muted); }

@media (max-width: 900px) {
    .server-action-bar { grid-template-columns: 1fr; }
    .server-action-summary { width: 100%; }
    .server-primary-actions { justify-self: start; }
}
@media (max-width: 640px) {
    .ipmi-visual-status { display: grid; grid-template-columns: 1fr; }
    .oob-status-item { width: 100%; min-height: 52px; }
    .status-help-popover { right: auto; left: -64px; }
    .status-help-popover::before { right: auto; left: 68px; }
}


/* Unified server-detail section headers and OOB alignment */
.server-section-card { overflow: hidden; }
.server-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 58px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}
.server-section-heading {
    position: relative;
    min-width: 0;
    padding-left: 12px;
}
.server-section-heading::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 0;
    width: 3px;
    border-radius: 999px;
    background: var(--primary);
}
.server-section-heading strong,
.server-section-heading span { display: block; }
.server-section-heading strong {
    color: var(--text);
    font-size: 15px;
    font-weight: 760;
    line-height: 1.35;
    letter-spacing: -.01em;
}
.server-section-heading span {
    margin-top: 2px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.server-section-body { padding: 14px 18px 17px; }
.compact-info-card { padding: 0; }
.compact-info-card .card-title { display: none; }
.compact-traffic-card .compact-section-head,
.notes-card .notes-card-head { display: none; }

.server-action-bar {
    display: block;
    margin-bottom: 16px;
    padding: 0;
}
.server-action-head { width: 100%; }
.server-action-body {
    display: grid;
    grid-template-columns: auto minmax(310px, 1fr);
    align-items: center;
    gap: 14px 22px;
    padding: 14px 18px 7px;
}
.server-action-summary {
    width: auto;
    max-width: 100%;
    min-width: 0;
}
.server-primary-actions {
    align-self: center;
    justify-self: end;
}
.server-action-feedback { padding: 0 18px 6px; }
.server-action-bar > .compact-warning { margin: 0 18px 14px; }

.ipmi-visual-status {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.oob-status-item {
    position: relative;
    display: grid;
    flex: 0 0 148px;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 148px;
    height: 54px;
    min-height: 54px;
    padding: 8px 12px 8px 9px;
    border-radius: 10px;
}
.oob-status-copy {
    display: flex;
    min-width: 0;
    min-height: 34px;
    padding-right: 13px;
    flex-direction: column;
    justify-content: center;
}
.oob-status-copy small {
    display: block;
    min-height: 14px;
    margin: 0 0 2px;
    line-height: 14px;
}
.oob-status-copy strong {
    display: block;
    line-height: 17px;
}
.status-help-details.status-help-corner {
    position: absolute;
    z-index: 5;
    top: 7px;
    right: 24px;
    display: block;
    line-height: 1;
}
.status-help-details.status-help-corner > summary {
    width: 13px;
    height: 13px;
    font-size: 8px;
    line-height: 13px;
}
.status-help-details.status-help-corner .status-help-popover {
    top: 20px;
    right: -13px;
}
.oob-status-dot {
    top: 10px;
    right: 10px;
}

@media (max-width: 900px) {
    .server-action-body { grid-template-columns: 1fr; }
    .server-primary-actions { justify-self: start; }
}
@media (max-width: 640px) {
    .server-section-head {
        align-items: flex-start;
        min-height: 54px;
        padding: 12px 15px;
    }
    .server-section-head > .button { flex: 0 0 auto; width: auto; }
    .server-section-heading span { white-space: normal; }
    .server-section-body { padding: 12px 15px 15px; }
    .server-action-body { padding: 12px 14px; }
    .server-action-feedback { padding: 0 14px 10px; }
    .server-action-bar > .compact-warning { margin: 0 14px 12px; }
    .ipmi-visual-status { display: grid; grid-template-columns: 1fr; width: 100%; }
    .oob-status-item { width: 100%; height: 52px; min-height: 52px; }
    .status-help-details.status-help-corner .status-help-popover {
        right: -20px;
        left: auto;
    }
    .status-help-details.status-help-corner .status-help-popover::before {
        right: 22px;
        left: auto;
    }
}


/* Network port status indicator */
.port-status-light {
    display: inline-grid;
    width: 18px;
    height: 18px;
    margin-left: 7px;
    place-items: center;
    border-radius: 50%;
    vertical-align: middle;
}
.port-status-light > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #98a2b3;
    box-shadow: 0 0 0 3px rgba(152, 162, 179, .14);
}
.port-status-light.loading > span { animation: port-status-pulse 1.35s ease-in-out infinite; }
.port-status-light.up > span { background: #16a66a; box-shadow: 0 0 0 3px rgba(22, 166, 106, .14); }
.port-status-light.down > span,
.port-status-light.error > span { background: #d92d20; box-shadow: 0 0 0 3px rgba(217, 45, 32, .13); }
@keyframes port-status-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* Server detail alignment refinements */
.server-action-body {
    grid-template-columns: minmax(0, auto) auto;
    align-items: start;
    justify-content: space-between;
}
.server-action-summary {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: flex-start;
}
.ipmi-visual-status {
    display: grid;
    grid-template-columns: repeat(3, 148px);
    align-items: stretch;
    gap: 8px;
}
.oob-status-item {
    width: 148px;
    height: 54px;
    min-height: 54px;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
}
.oob-status-icon {
    align-self: center;
    justify-self: start;
}
.oob-status-icon svg { display: block; }
.oob-status-copy {
    height: 34px;
    min-height: 34px;
    justify-content: center;
}
.server-primary-actions {
    align-self: start;
    margin-top: 7px;
}
.server-primary-actions .button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
}

/* Keep every detail row on the same label/value/action baseline. */
.compact-details > div {
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: center;
    min-height: 42px;
    gap: 12px;
    padding: 8px 0;
}
.compact-details dt {
    align-self: center;
    line-height: 1.4;
}
.compact-details dd {
    display: flex;
    min-width: 0;
    min-height: 28px;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}
.compact-details dd > code,
.compact-details dd > a {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
}
.compact-details dd .copy-button,
.compact-details dd .copy-icon-button {
    flex: 0 0 auto;
    margin-left: 0;
}
.compact-details .password-row dd { flex-wrap: wrap; }
.compact-details .port-status-light {
    flex: 0 0 18px;
    margin-left: 0;
}

@media (max-width: 900px) {
    .server-action-body { grid-template-columns: 1fr; }
    .server-primary-actions { margin-top: 0; }
    .ipmi-visual-status { grid-template-columns: repeat(3, 148px); }
}
@media (max-width: 640px) {
    .ipmi-visual-status { grid-template-columns: 1fr; }
    .oob-status-item { width: 100%; }
    .compact-details > div {
        grid-template-columns: 1fr;
        align-items: start;
        min-height: 0;
        gap: 5px;
    }
    .compact-details dd { min-height: 0; flex-wrap: wrap; }
}


/* Detail and server-list alignment refinements */
.additional-ip-inline-head {
    justify-content: flex-start;
    gap: 6px;
}
.additional-ip-inline-head span {
    flex: 0 0 auto;
}
.server-list-table th.server-primary-ip-column,
.server-list-table td.server-primary-ip-column {
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}
.server-list-table td.server-primary-ip-column code {
    display: inline-block;
    min-width: 13ch;
    font-variant-numeric: tabular-nums;
}

/* Out-of-band management vertical centering */
@media (min-width: 901px) {
    .server-action-body {
        align-items: center;
    }
    .server-primary-actions {
        align-self: center;
        margin-top: 0;
    }
}

/* Out-of-band footer spacing refinement */
.server-action-time { margin-bottom: 0; }

/* Responsive out-of-band action layout
 * Wrap according to the card's real available width, preventing fixed status
 * cards and action buttons from overlapping on narrower desktop layouts.
 */
.server-action-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 20px;
    row-gap: 12px;
}
.server-action-summary {
    flex: 1 0 460px;
    min-width: 460px;
}
.server-primary-actions {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: center;
    justify-self: auto;
}

@media (max-width: 760px) {
    .server-primary-actions {
        flex: 1 1 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .server-action-summary {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }
    .server-primary-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }
    .server-primary-actions .button {
        width: 100%;
    }
}

/* Out-of-band button baseline alignment
 * On a single desktop row, align the bottom edge of all three action buttons
 * with the bottom edge of the three 54px status cards. The summary's
 * "last checked" line remains below and no longer affects button centering.
 */
@media (min-width: 761px) {
    .server-action-body {
        align-items: flex-start;
    }
    .server-primary-actions {
        align-self: flex-start;
        margin-top: 15px;
    }
}

/* When actions wrap onto their own row, start them normally rather than
 * carrying the desktop baseline offset into the new line. */
@media (max-width: 760px) {
    .server-primary-actions {
        margin-top: 0;
    }
}

/* Proportional out-of-band responsive scaling
 * Keep the status cards and action buttons on one aligned row by gradually
 * reducing their dimensions with the card's real available width. Only stack
 * the action row when the panel is genuinely too narrow.
 */
.server-action-bar {
    container-type: inline-size;
    --oob-card-width: 148px;
    --oob-card-height: 54px;
    --oob-icon-size: 32px;
    --oob-button-height: 40px;
}
.server-action-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px 18px;
}
.server-action-summary {
    width: auto;
    min-width: 0;
    flex: none;
}
.ipmi-visual-status {
    display: grid;
    grid-template-columns: repeat(3, var(--oob-card-width));
    gap: 8px;
}
.oob-status-item {
    width: var(--oob-card-width);
    height: var(--oob-card-height);
    min-height: var(--oob-card-height);
}
.oob-status-icon {
    width: var(--oob-icon-size);
    height: var(--oob-icon-size);
}
.server-primary-actions {
    display: flex;
    flex-wrap: nowrap;
    align-self: start;
    justify-self: end;
    justify-content: flex-end;
    gap: 8px;
    margin: calc(var(--oob-card-height) - var(--oob-button-height)) 0 0;
}
.server-primary-actions .button {
    width: auto;
    min-height: var(--oob-button-height);
    height: var(--oob-button-height);
    padding-right: 14px;
    padding-left: 14px;
    white-space: nowrap;
}

@container (max-width: 1100px) {
    .server-action-body {
        --oob-card-width: 132px;
        --oob-card-height: 50px;
        --oob-icon-size: 30px;
        --oob-button-height: 38px;
    }
    .oob-status-item {
        grid-template-columns: 30px minmax(0, 1fr);
        gap: 7px;
        padding: 7px 10px 7px 8px;
    }
    .oob-status-icon { border-radius: 8px; }
    .oob-status-icon svg { width: 16px; height: 16px; }
    .oob-status-copy { min-height: 32px; height: 32px; padding-right: 10px; }
    .oob-status-copy small { min-height: 13px; margin-bottom: 1px; font-size: 9.5px; line-height: 13px; }
    .oob-status-copy strong { font-size: 12.5px; line-height: 17px; }
    .oob-status-dot { top: 9px; right: 9px; }
    .server-primary-actions .button { padding-right: 11px; padding-left: 11px; font-size: 13px; }
}

@container (max-width: 920px) {
    .server-action-body {
        --oob-card-width: 118px;
        --oob-card-height: 48px;
        --oob-icon-size: 28px;
        --oob-button-height: 36px;
    }
    .server-action-body { gap: 10px 14px; }
    .ipmi-visual-status { gap: 6px; }
    .oob-status-item {
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 6px;
        padding: 6px 8px;
        border-radius: 9px;
    }
    .oob-status-icon { border-radius: 8px; }
    .oob-status-icon svg { width: 15px; height: 15px; }
    .oob-status-copy { min-height: 30px; height: 30px; padding-right: 8px; }
    .oob-status-copy small { min-height: 12px; margin-bottom: 1px; font-size: 9px; line-height: 12px; }
    .oob-status-copy strong { font-size: 12px; line-height: 16px; }
    .oob-status-dot { top: 8px; right: 8px; width: 5px; height: 5px; }
    .server-primary-actions { gap: 6px; }
    .server-primary-actions .button { padding-right: 9px; padding-left: 9px; font-size: 12px; }
}

@container (max-width: 760px) {
    .server-action-body { grid-template-columns: 1fr; }
    .server-primary-actions {
        justify-self: start;
        justify-content: flex-start;
        margin-top: 0;
    }
}

@container (max-width: 520px) {
    .ipmi-visual-status {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }
    .oob-status-item {
        width: 100%;
        min-width: 0;
    }
    .server-primary-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }
    .server-primary-actions .button { width: 100%; }
}


/* Clickable IPMI connection icon */
.oob-ipmi-check-trigger {
    margin: 0;
    padding: 0;
    border: 0;
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, opacity .15s ease;
}
.oob-ipmi-check-trigger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 24, 40, .12);
    filter: saturate(1.08);
}
.oob-ipmi-check-trigger:active:not(:disabled) { transform: translateY(0); }
.oob-ipmi-check-trigger:focus-visible {
    outline: 2px solid #315efb;
    outline-offset: 2px;
}
.oob-ipmi-check-trigger:disabled { cursor: wait; opacity: .75; }
.oob-ipmi-check-trigger.is-loading svg { animation: oob-ipmi-check-pulse .85s ease-in-out infinite; }
@keyframes oob-ipmi-check-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(.82); opacity: .45; }
}


/* LibreNMS responsive graph sizing */
.compact-traffic-card.traffic-expanded .compact-graph-wrap img {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
}
.librenms-graph-stage { position: relative; min-width: 0; }

/* LibreNMS SVG axis correction
 * The LibreNMS API is requested as SVG. The original vector curve and full
 * Now/Ave/Max/95th/Total legend remain intact; only the x-axis glyph row is
 * hidden and replaced with browser-local labels at the same SVG coordinates.
 */
.librenms-svg-host {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 220px;
}
.librenms-svg-host .librenms-inline-svg {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
}
.librenms-graph-loading,
.librenms-graph-error {
    display: grid;
    min-height: 220px;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
}
.librenms-graph-error { color: var(--danger); }
.compact-traffic-card.traffic-expanded .compact-graph-wrap .librenms-graph-stage > .librenms-svg-host {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Network connection row alignment */
.network-connection-details > .network-connection-row {
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
}
.network-connection-details .network-connection-value {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 28px;
    align-items: center;
    gap: 8px;
    line-height: 20px;
}
.network-connection-details .network-connection-text {
    display: inline-flex;
    min-width: 0;
    min-height: 28px;
    align-items: center;
    margin: 0;
    padding: 0;
    line-height: 20px;
}
.network-connection-details .network-port-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
}
.network-connection-details .network-port-value > .port-status-light {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 28px;
    flex: 0 0 18px;
    margin: 0;
    align-self: center;
}
.network-connection-details .network-port-value > .port-status-light > span {
    display: block;
    width: 8px;
    height: 8px;
}
@media (max-width: 640px) {
    .network-connection-details > .network-connection-row {
        grid-template-columns: 1fr;
        align-items: start;
        row-gap: 5px;
    }
}

/* Network connection spacing correction
 * The apparent empty block below the port row came from the additional-IP
 * section's top margin, not from the port text or status indicator.
 */
.network-connection-details { margin-bottom: 0; }
.network-additional-ip { margin-top: 0; }

/* Mobile-first responsive administration layout */
.mobile-topbar,
.mobile-nav-backdrop,
.mobile-sidebar-close { display: none; }

@media (max-width: 768px) {
    html, body { overflow-x: hidden; }
    body.mobile-nav-open { overflow: hidden; }

    .mobile-topbar {
        position: fixed;
        inset: 0 0 auto 0;
        z-index: 80;
        display: flex;
        height: 58px;
        align-items: center;
        gap: 10px;
        padding: 0 14px;
        border-bottom: 1px solid rgba(228, 232, 239, .96);
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 3px 14px rgba(20, 32, 55, .06);
        backdrop-filter: blur(12px);
    }
    .mobile-menu-button,
    .mobile-sidebar-close {
        display: inline-grid;
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 9px;
        color: #334155;
        background: transparent;
        cursor: pointer;
    }
    .mobile-menu-button:hover,
    .mobile-sidebar-close:hover { background: #eef2f7; }
    .mobile-menu-button svg,
    .mobile-sidebar-close svg {
        width: 21px;
        height: 21px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
    }
    .mobile-brand {
        display: flex;
        min-width: 0;
        align-items: center;
        gap: 9px;
        color: var(--text);
        text-decoration: none;
    }
    .mobile-brand:hover { text-decoration: none; }
    .mobile-brand-mark {
        display: grid;
        width: 30px;
        height: 30px;
        flex: 0 0 30px;
        place-items: center;
        border-radius: 8px;
        color: #fff;
        background: #2563eb;
        font-size: 11px;
        font-weight: 800;
    }
    .mobile-brand strong {
        overflow: hidden;
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 88;
        display: block;
        border: 0;
        background: rgba(15, 23, 42, .48);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 90;
        display: flex;
        width: min(82vw, 310px);
        min-height: 100dvh;
        padding: 22px 18px;
        transform: translateX(-104%);
        transition: transform .22s ease;
        box-shadow: 18px 0 45px rgba(15, 23, 42, .22);
    }
    .mobile-sidebar-close {
        position: absolute;
        top: 17px;
        right: 13px;
        color: #c6d0df;
    }
    .sidebar nav {
        display: grid;
        grid-template-columns: 1fr;
        margin-top: 30px;
    }
    .sidebar-footer {
        display: block;
        margin-top: auto;
        padding-top: 16px;
    }
    body.mobile-nav-open .sidebar { transform: translateX(0); }
    body.mobile-nav-open .mobile-nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        padding: 78px 14px 96px;
    }
    .main-auth { padding: 0; }
    .page-head,
    .page-head.compact {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        margin-bottom: 16px;
    }
    .page-head h1 { font-size: 23px; }
    .page-head > .button,
    .page-head .head-actions { width: 100%; }
    .page-head > .button { justify-content: center; }
    .head-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .head-actions .button,
    .head-actions form,
    .head-actions form .button { width: 100%; }

    .search-card { padding: 13px; }
    .search-form,
    .search-form-wide {
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
    }
    .search-form-wide select,
    .search-form .button,
    .search-form .ghost { width: 100%; }
    .full-search-row { grid-column: 1; }
    .tag-filter-heading {
        align-items: stretch;
        flex-direction: column;
    }

    /* Convert the server inventory table into touch-friendly cards. */
    .server-table-card {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .server-table-card .table-scroll { overflow: visible; }
    .server-list-table,
    .server-list-table tbody { display: block; width: 100%; }
    .server-list-table thead { display: none; }
    .server-list-table tbody {
        display: grid;
        gap: 12px;
    }
    .server-list-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "title title"
            "ip extra"
            "network network"
            "tags tags"
            "actions actions";
        gap: 9px 12px;
        padding: 15px;
        border: 1px solid var(--line);
        border-radius: 13px;
        background: #fff;
        box-shadow: 0 8px 22px rgba(20, 32, 55, .055);
    }
    .server-list-table tbody tr:hover { background: #fff; }
    .server-list-table tbody td {
        display: block;
        min-width: 0;
        padding: 0;
        border: 0;
    }
    .server-list-table .mobile-server-title { grid-area: title; }
    .server-list-table .mobile-server-title .server-link {
        display: block;
        overflow: hidden;
        font-size: 16px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .server-list-table .mobile-server-ip { grid-area: ip; }
    .server-list-table .mobile-server-additional {
        grid-area: extra;
        align-self: center;
        justify-self: end;
        color: var(--muted);
        font-size: 12px;
    }
    .server-list-table .mobile-server-network {
        grid-area: network;
        padding-top: 9px;
        border-top: 1px solid var(--line);
    }
    .server-list-table .mobile-server-network::before,
    .server-list-table .mobile-server-tags::before {
        display: block;
        margin-bottom: 4px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
    }
    .server-list-table .mobile-server-network::before { content: "交换机 / 端口"; }
    .server-list-table .mobile-server-tags::before { content: "标签"; }
    .server-list-table .mobile-server-tags { grid-area: tags; }
    .server-list-table .mobile-server-updated { display: none; }
    .server-list-table .mobile-server-actions {
        grid-area: actions;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding-top: 10px;
        border-top: 1px solid var(--line);
    }
    .server-list-table .mobile-server-actions a {
        display: inline-flex;
        min-height: 40px;
        align-items: center;
        justify-content: center;
        margin: 0 !important;
        border: 1px solid #cfd6e2;
        border-radius: 8px;
        color: #334155;
        background: #fff;
        font-weight: 650;
        text-decoration: none;
    }
    .server-list-table .mobile-server-actions a:first-child {
        color: #fff;
        border-color: var(--primary);
        background: var(--primary);
    }
    .server-list-table td.server-primary-ip-column code { min-width: 0; font-size: 14px; }
    .server-tags-wrap { justify-content: flex-start; }

    .detail-grid,
    .compact-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
    .full-detail { grid-column: 1; }
    .server-section-head { padding: 13px 14px; }
    .server-section-body { padding-right: 14px; padding-left: 14px; }
    .details > div,
    .compact-details > div {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 12px 0;
    }
    .details dt { font-size: 11px; }
    .details dd {
        display: flex;
        min-height: 34px;
        align-items: center;
        gap: 5px;
    }
    .network-connection-details > .network-connection-row {
        grid-template-columns: 1fr;
        row-gap: 5px;
    }
    .network-connection-details .network-connection-value { min-height: 34px; }
    .copy-icon-button {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
    .copy-icon-button svg { width: 16px; height: 16px; }

    /* Three equal status summaries remain compact on a phone. */
    .server-action-bar { --oob-card-height: auto; }
    .server-action-body {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .server-action-summary { width: 100%; }
    .ipmi-visual-status {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        width: 100%;
        gap: 7px;
    }
    .oob-status-item {
        display: flex;
        width: 100%;
        height: auto;
        min-width: 0;
        min-height: 94px;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        padding: 10px 5px 9px;
        text-align: center;
    }
    .oob-status-icon {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
    }
    .oob-status-copy {
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 0;
    }
    .oob-status-copy small { min-height: 0; margin: 0 0 1px; font-size: 9px; line-height: 1.2; }
    .oob-status-copy strong { font-size: 12px; line-height: 1.3; }
    .oob-status-dot { top: 8px; right: 8px; }
    .server-action-time { margin-top: 6px; text-align: left; }
    .server-primary-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        margin: 0;
        justify-self: stretch;
        gap: 8px;
    }
    .server-primary-actions .button {
        width: 100%;
        height: auto;
        min-height: 43px;
        padding: 9px 8px;
        white-space: normal;
    }

    /* Mobile traffic graph: fit the SVG to the card instead of forcing horizontal scrolling. */
    .compact-traffic-body { min-width: 0; }
    .compact-metrics,
    .librenms-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .librenms-periods,
    .compact-periods {
        display: flex !important;
        flex-wrap: wrap;
        max-width: 100%;
        overflow: visible;
        gap: 7px;
        padding-bottom: 0;
    }
    .librenms-periods button { flex: 0 0 auto; min-height: 38px; }
    .compact-traffic-card.traffic-expanded .compact-graph-wrap,
    .librenms-graph-wrap {
        max-width: 100%;
        overflow: hidden;
    }
    .librenms-svg-host,
    .compact-traffic-card.traffic-expanded .compact-graph-wrap .librenms-graph-stage > .librenms-svg-host {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .librenms-svg-host .librenms-inline-svg {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: auto;
    }

    .form-card { max-width: none; overflow: visible; }
    .form-section { padding: 18px 14px; }
    .form-grid { grid-template-columns: 1fr; gap: 15px; }
    .full-span { grid-column: 1; }
    .librenms-match-controls { grid-template-columns: 1fr; }
    .form-actions {
        position: sticky;
        bottom: 0;
        z-index: 25;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 11px 14px calc(11px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        box-shadow: 0 -8px 22px rgba(20, 32, 55, .08);
    }
    .form-actions .button { width: 100%; }
    input:not([type="checkbox"]):not([type="radio"]), textarea, select { font-size: 16px; }

    .tag-pill,
    .tag-badge,
    .tag-choice span { min-height: 30px; }
    .tag-dialog {
        width: 100vw;
        max-width: none;
        margin: auto 0 0;
        border-radius: 16px 16px 0 0;
    }
    .tag-dialog[open] { position: fixed; inset: auto 0 0; }
    .dialog-tag-cloud { max-height: 52vh; padding: 17px 16px; }
    .tag-dialog-head { padding: 17px 16px; }
    .tag-dialog-actions { padding: 13px 16px calc(13px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
    .main { padding-right: 10px; padding-left: 10px; }
    .card { border-radius: 11px; }
    .page-head h1 { font-size: 21px; }
    .server-primary-actions { grid-template-columns: 1fr; }
    .compact-metrics,
    .librenms-metrics { grid-template-columns: 1fr 1fr; gap: 7px; }
    .compact-metrics > div,
    .librenms-metrics > div { padding: 10px; }
    .server-list-table tbody tr { padding: 13px; }
    .server-list-table .mobile-server-actions { grid-template-columns: 1fr; }
    .form-actions { grid-template-columns: 1fr; }
}

/* Access control administration */
.nav-section-label {
    margin: 18px 12px 7px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.access-badge, .risk-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-left: 7px;
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #475569;
    background: #f8fafc;
    font-size: 10px;
    font-weight: 750;
    vertical-align: middle;
}
.access-badge.critical { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.access-badge.custom { color: #3730a3; border-color: #c7d2fe; background: #eef2ff; }
.compact-lines { display: grid; gap: 5px; }
.compact-lines > div { display: flex; flex-wrap: wrap; gap: 5px 9px; }
.compact-lines > div span { color: var(--muted); font-size: 12px; }
.inline-form { display: inline; margin: 0; }
.link-button {
    padding: 0;
    border: 0;
    color: var(--primary);
    background: transparent;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}
.danger-text { color: #b91c1c; }
.check-row { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 16px; }
.critical-check { color: #991b1b; }
.quota-options {
    display: grid;
    max-width: 620px;
    gap: 9px;
}
.quota-options > label {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fbfcfe;
    cursor: pointer;
}
.quota-options > label:has(input[type="radio"]:checked) {
    border-color: #9db7f4;
    background: #f4f7ff;
}
.quota-options .quota-custom {
    grid-template-columns: 18px auto minmax(92px, 120px) auto;
}
.quota-custom input[type="number"] { width: 100%; min-width: 0; }
.quota-custom > span { white-space: nowrap; }
.assignment-list { display: grid; gap: 11px; margin: 15px 0; }
.assignment-row {
    display: grid;
    grid-template-columns: minmax(180px, .8fr) minmax(280px, 1.5fr) auto;
    align-items: end;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
}
.assignment-row .field { margin: 0; }
.assignment-remove { margin-bottom: 1px; }
.permission-category { margin-top: 18px; }
.permission-category:first-child { margin-top: 0; }
.permission-category-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.permission-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
}
.permission-option > input { margin-top: 2px; flex: 0 0 16px; }
.permission-option > span { display: grid; min-width: 0; gap: 4px; }
.permission-option code { width: fit-content; max-width: 100%; overflow-wrap: anywhere; font-size: 11px; }
.permission-option small { color: var(--muted); line-height: 1.45; }
.permission-option em { width: fit-content; color: #92400e; font-size: 10px; font-style: normal; font-weight: 700; }
.permission-option.risk-low { border-left-color: #94a3b8; }
.permission-option.risk-medium { border-left-color: #60a5fa; }
.permission-option.risk-high { border-left-color: #f59e0b; }
.permission-option.risk-critical { border-left-color: #ef4444; }
.permission-option.disabled { opacity: .55; cursor: not-allowed; }
.risk-badge.risk-low { color: #475569; }
.risk-badge.risk-medium { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.risk-badge.risk-high { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.risk-badge.risk-critical { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.permission-editor { margin-bottom: 16px; }
.inline-actions { position: static; justify-content: flex-end; padding: 16px 0 0; border: 0; box-shadow: none; }
.member-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.member-toolbar input { min-width: min(420px, 100%); flex: 1 1 300px; }
.server-member-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 540px;
    overflow: auto;
    gap: 8px;
    padding: 2px;
}
.server-member-option {
    display: flex;
    align-items: flex-start;
    min-width: 0;
    gap: 9px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}
.server-member-option > input { margin-top: 2px; flex: 0 0 16px; }
.server-member-option > span { display: grid; min-width: 0; gap: 3px; }
.server-member-option code { overflow: hidden; text-overflow: ellipsis; }
.server-member-option small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.permission-muted { color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
    .permission-grid, .server-member-grid { grid-template-columns: 1fr; }
    .assignment-row { grid-template-columns: 1fr; align-items: stretch; }
    .assignment-remove { justify-self: start; }
}


/* Access-control forms and selection controls. */
.permission-editor { max-width: 1040px; }
.permission-editor > form { min-width: 0; }
.access-info-card { max-width: 920px; margin-top: 16px; padding: 20px 22px; }
.access-info-card .card-title { margin-bottom: 9px; }
.access-info-card p { margin: 0; }
.permission-option strong,
.server-member-option strong { overflow-wrap: anywhere; }
.permission-option code,
.server-member-option code { min-width: 0; word-break: break-word; }

@media (max-width: 640px) {
    .quota-options { max-width: none; }
    .quota-options .quota-custom {
        grid-template-columns: 18px minmax(0, 1fr) auto;
    }
    .quota-options .quota-custom input[type="number"] {
        grid-column: 2 / 3;
    }
    .quota-options .quota-custom > span:last-child {
        grid-column: 3;
        grid-row: 2;
    }
    .access-info-card { max-width: none; padding: 18px 14px; }
}

/* Access-control layout audit and responsive corrections */
.sidebar nav {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #344155 transparent;
}
.sidebar .link-button {
    color: #c9d4e5;
    font-weight: 400;
}
.sidebar .link-button:hover { color: #fff; }
.nav-section-label { grid-column: 1 / -1; }

.status-pill {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border: 1px solid #d7dee8;
    border-radius: 999px;
    color: #526075;
    background: #f4f6f9;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}
.status-pill.success {
    color: #17663a;
    border-color: #a9e8c2;
    background: #ecfdf3;
}
.status-pill.warning {
    color: #92400e;
    border-color: #f6d58a;
    background: #fffbeb;
}
.status-pill.muted {
    color: #667085;
    border-color: #d8dee8;
    background: #f3f5f8;
}

.access-form-card,
.access-editor-card { max-width: 1120px; }
.access-settings-form,
.access-settings-info { max-width: 1000px; }
.access-settings-info { width: 100%; }
.access-table-card { margin-bottom: 16px; }
.access-table { table-layout: auto; }
.access-table th:last-child,
.access-table td.actions { text-align: right; }
.access-table th:last-child { width: 1%; }
.access-table td.actions {
    width: 1%;
    min-width: 132px;
    vertical-align: middle;
}
.access-table td.actions > a,
.access-table td.actions > .inline-form,
.access-table td.actions > span {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
.access-table td.actions > * + * { margin-left: 14px; }
.access-table td.actions .inline-form { margin-top: 0; margin-bottom: 0; }
.access-table td.actions .link-button { line-height: 1.55; }
.access-table .table-subtext {
    max-width: 460px;
    white-space: normal;
    overflow-wrap: anywhere;
}
.access-table td:first-child { min-width: 190px; }
.access-table code { overflow-wrap: anywhere; }

.access-form-card .form-section > .check-field,
.access-editor-card .form-section > .check-field { margin-top: 16px; }
.access-form-card .check-field,
.access-editor-card .check-field,
.access-settings-form .check-field {
    align-items: flex-start;
    white-space: normal;
}
.access-form-card .check-field input,
.access-editor-card .check-field input,
.access-settings-form .check-field input { margin-top: 3px; }
.access-form-card .form-section > .inline-notice,
.access-editor-card .form-section > .inline-notice,
.access-settings-form .form-section > .inline-notice {
    margin-top: 16px;
    margin-bottom: 0;
}
.access-table-card + .inline-notice { margin-top: 16px; }

.quota-options {
    width: 100%;
    max-width: 760px;
    gap: 10px;
}
.quota-options > label {
    grid-template-columns: 18px minmax(0, 1fr);
    min-width: 0;
    min-height: 48px;
    padding: 11px 13px;
}
.quota-options > label > span { min-width: 0; overflow-wrap: anywhere; }
.quota-options .quota-custom {
    grid-template-columns: 18px minmax(76px, 1fr) minmax(100px, 140px) auto;
}
.quota-custom input[type="number"] { min-height: 38px; }

.assignment-row {
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.45fr) auto;
}
.assignment-row .field,
.assignment-row select { min-width: 0; }
.assignment-remove { min-width: 72px; }

.permission-category-head {
    gap: 16px;
}
.permission-category-head > strong { min-width: 0; }
.permission-category-head .link-button { flex: 0 0 auto; white-space: nowrap; }
.permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.permission-option {
    min-height: 112px;
    overflow: hidden;
}
.permission-option > span { align-content: start; }
.permission-option strong,
.permission-option small,
.permission-option code { overflow-wrap: anywhere; }
.permission-option small { display: block; }

.member-toolbar { align-items: center; }
.member-toolbar input {
    width: auto;
    min-width: min(420px, 100%);
}
.server-member-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.server-member-option {
    min-height: 88px;
    overflow: hidden;
}
.server-member-option > span { align-content: start; }
.server-member-option strong,
.server-member-option code,
.server-member-option small { min-width: 0; overflow-wrap: anywhere; }
.server-member-option small { white-space: normal; }

@media (max-width: 1100px) {
    .access-form-card,
    .access-editor-card,
    .access-settings-form,
    .access-settings-info { max-width: none; }
}

@media (max-width: 900px) {
    .nav-section-label { grid-column: 1 / -1; }
    .permission-grid { grid-template-columns: 1fr; }
    .permission-option { min-height: 0; }
    .assignment-row { grid-template-columns: 1fr; align-items: stretch; }
    .assignment-remove { justify-self: start; }
}

@media (max-width: 768px) {
    .access-table-card {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .access-table-card .table-scroll { overflow: visible; }
    .access-table,
    .access-table tbody { display: block; width: 100%; }
    .access-table thead { display: none; }
    .access-table tbody {
        display: grid;
        gap: 12px;
    }
    .access-table tbody tr {
        display: block;
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 8px 22px rgba(20, 32, 55, .055);
    }
    .access-table tbody tr:hover { background: #fff; }
    .access-table tbody td {
        display: grid;
        width: 100%;
        min-width: 0;
        grid-template-columns: 108px minmax(0, 1fr);
        gap: 12px;
        padding: 9px 0;
        border-bottom: 1px solid var(--line);
        text-align: left;
        white-space: normal;
    }
    .access-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 700;
    }
    .access-table tbody td:first-child {
        display: block;
        min-width: 0;
        padding-top: 0;
    }
    .access-table tbody td:first-child::before { display: none; }
    .access-table tbody td:last-child { border-bottom: 0; }
    .access-table tbody td.actions {
        display: flex;
        width: 100%;
        min-width: 0;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 12px;
        text-align: left;
    }
    .access-table tbody td.actions::before { display: none; }
    .access-table td.actions > * + * { margin-left: 0; }
    .access-table td.actions > a,
    .access-table td.actions > .inline-form {
        flex: 1 1 128px;
        min-width: 0;
    }
    .access-table td.actions > a,
    .access-table td.actions .inline-form .link-button {
        display: inline-flex;
        width: 100%;
        min-height: 40px;
        align-items: center;
        justify-content: center;
        padding: 8px 12px;
        border: 1px solid #cfd6e2;
        border-radius: 8px;
        color: #334155;
        background: #fff;
        font-weight: 650;
        text-decoration: none;
    }
    .access-table td.actions > a:hover,
    .access-table td.actions .inline-form .link-button:hover {
        border-color: #aeb8c8;
        background: #f8fafc;
        text-decoration: none;
    }
    .access-table td.actions .inline-form .danger-text {
        color: var(--danger);
        border-color: #f0b5af;
        background: #fff7f6;
    }
    .access-table td.actions > span { width: 100%; }
    .access-table .table-subtext { max-width: none; }

    .member-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .member-toolbar input {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
    }
    .member-toolbar .button { width: 100%; }
    .server-member-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 460px;
    }
}

@media (max-width: 640px) {
    .check-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .quota-options .quota-custom {
        grid-template-columns: 18px minmax(0, 1fr) auto;
        align-items: center;
    }
    .quota-options .quota-custom input[type="number"] {
        grid-column: 2 / 3;
        grid-row: 2;
        width: 100%;
    }
    .quota-options .quota-custom > span:last-child {
        grid-column: 3;
        grid-row: 2;
    }
    .server-member-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .access-table tbody td {
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 9px;
    }
    .member-toolbar { grid-template-columns: 1fr; }
    .member-toolbar input { grid-column: 1; }
}

/* Final access-table alignment pass */
@media (min-width: 769px) {
    .access-table td[data-label="状态"],
    .access-table td[data-label="分类"],
    .access-table td[data-label="风险"],
    .access-table td[data-label="角色"],
    .access-table td[data-label="成员"],
    .access-table td[data-label="交换机"],
    .access-table td[data-label="直接服务器"],
    .access-table td[data-label="用户授权"] {
        white-space: nowrap;
    }
}
@media (min-width: 769px) and (max-width: 900px) {
    .sidebar nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sidebar nav a { min-width: 0; padding-right: 9px; padding-left: 9px; }
}

/* Audit workspace and shared section headings. */
:root {
    --audit-blue: #155eef;
    --audit-blue-soft: #eff4ff;
    --audit-navy: #061d3b;
    --audit-navy-2: #082a55;
}

/* Legacy heading typography only. Accent bars are owned by the canonical v2 wrappers below. */
.section-title strong,
.card-title strong,
.panel-heading strong,
.compact-section-head strong,
.card-section-head strong,
.notes-card-head strong,
.server-section-heading strong {
    color: #10213b;
    font-weight: 760;
    letter-spacing: -.01em;
}
.section-title span,
.card-title span,
.panel-heading span,
.compact-section-head span,
.card-section-head span,
.notes-card-head span,
.server-section-heading span {
    margin-top: 2px;
    color: #71809a;
    font-size: 11px;
    line-height: 1.35;
}

/* Sidebar modeled after the approved mockup. */
.sidebar {
    width: 238px;
    padding: 22px 14px 18px;
    background: linear-gradient(180deg, var(--audit-navy) 0%, #071a34 58%, #06182f 100%);
    box-shadow: 10px 0 34px rgba(4, 24, 52, .08);
}
.main { margin-left: 238px; padding: 30px 30px 56px; }
.brand { gap: 11px; padding: 0 7px; }
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(145deg, #2e7cff, #155eef);
    box-shadow: 0 8px 22px rgba(21, 94, 239, .30);
}
.brand-mark svg { width: 21px; height: 21px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { color: #fff; font-size: 14px; }
.brand span { color: #7f96b7; font-size: 10px; }
.sidebar nav { gap: 4px; margin-top: 26px; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 48px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #bcc9dc;
    transition: color .15s ease, background .15s ease, border-color .15s ease, transform .15s ease;
}
.sidebar nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .04);
    transform: translateX(1px);
}
.sidebar nav a.active {
    color: #fff;
    background: linear-gradient(90deg, #155eef, #1769f8);
    border-color: rgba(255, 255, 255, .10);
    box-shadow: 0 8px 18px rgba(21, 94, 239, .24);
}
.nav-icon {
    display: inline-grid;
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    place-items: center;
    color: currentColor;
}
.nav-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-copy { min-width: 0; }
.nav-copy strong,
.nav-copy small { display: block; }
.nav-copy strong { font-size: 13px; line-height: 1.25; }
.nav-copy small { margin-top: 1px; color: #758baa; font-size: 9px; font-weight: 500; line-height: 1.2; }
.sidebar nav a.active .nav-copy small,
.sidebar nav a:hover .nav-copy small { color: rgba(255, 255, 255, .73); }
.nav-section-label {
    margin: 13px 10px 4px;
    color: #617897;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.sidebar-footer { margin-top: 15px; padding: 14px 10px 0; border-color: rgba(255, 255, 255, .08); }
.signed-in { color: #8297b4; }
.sidebar-footer .link-button { color: #c5d1e2; }

/* Panel heading primitive used by the redesigned audit page. */
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 66px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.panel-heading strong,
.panel-heading span { display: block; }
.panel-heading strong { font-size: 16px; }
.panel-actions { display: flex; align-items: center; gap: 7px; }
.button.small { min-height: 32px; padding: 5px 10px; border-radius: 7px; font-size: 12px; }

/* Audit dashboard */
.audit-page { display: grid; gap: 14px; }
.audit-filter-card,
.audit-log-card,
.audit-alert-card,
.audit-detail-card,
.quota-summary-card,
.audit-integrity-card { overflow: hidden; }
.audit-filter-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 14px 16px;
    padding: 18px 20px 20px;
}
.audit-filter-grid .field label { margin-bottom: 6px; font-size: 12px; }
.audit-keyword-field { grid-column: span 2; }
.audit-filter-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
}
.audit-filter-actions .button { min-width: 76px; }
.audit-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
.audit-secondary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(240px, .65fr) minmax(240px, .65fr);
    gap: 14px;
    align-items: start;
    min-width: 0;
}
.audit-secondary-grid > .card { min-width: 0; }
.audit-table { table-layout: fixed; }
.audit-table th,
.audit-table td { padding: 11px 12px; }
.audit-table th:nth-child(1) { width: 142px; }
.audit-table th:nth-child(2) { width: 105px; }
.audit-table th:nth-child(3) { width: 155px; }
.audit-table th:nth-child(4) { width: auto; }
.audit-table th:nth-child(5) { width: 92px; }
.audit-table th:nth-child(6) { width: 68px; }
.audit-table th:nth-child(7) { width: 112px; }
.audit-table th:nth-child(8) { width: 42px; }
.audit-table tbody tr { transition: background-color .12s ease; }
.audit-table tbody tr.is-selected { background: #edf4ff; }
.audit-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--audit-blue); }
.audit-row-link,
.audit-action-link { color: var(--text); text-decoration: none; }
.audit-row-link:hover,
.audit-action-link:hover { color: var(--audit-blue); text-decoration: none; }
.audit-action-link { display: block; font-weight: 700; }
.audit-table small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.audit-resource-name { display: block; overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.audit-result { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.audit-result i { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.audit-result.success { color: #079455; }
.audit-result.success i { background: #12b76a; }
.audit-result.failed { color: #d92d20; }
.audit-result.failed i { background: #f04438; }
.audit-result.denied { color: #c4320a; }
.audit-result.denied i { background: #f79009; }
.risk-badge {
    display: inline-flex;
    min-width: 31px;
    justify-content: center;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
}
.risk-badge.low { color: #087a45; background: #e9f8ef; }
.risk-badge.medium { color: #b54708; background: #fff1dc; }
.risk-badge.high { color: #b42318; background: #fee4e2; }
.risk-badge.critical { color: #fff; background: #b42318; }
.audit-more a { color: #71809a; letter-spacing: 1px; text-decoration: none; }
.audit-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}
.audit-pagination > div { display: flex; gap: 7px; }

.audit-detail-list { margin: 0; padding: 6px 18px 12px; }
.audit-detail-list > div {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #edf0f5;
}
.audit-detail-list > div:last-child { border-bottom: 0; }
.audit-detail-list dt { color: var(--muted); font-size: 11px; }
.audit-detail-list dd { min-width: 0; margin: 0; font-size: 12px; }
.audit-detail-list code { overflow-wrap: anywhere; }
.audit-wrap-text { overflow-wrap: anywhere; line-height: 1.55; }
.audit-json-block { padding: 0 18px 18px; }
.audit-json-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.audit-json-title strong { font-size: 12px; }
.audit-json-title span { color: var(--muted); font-size: 10px; }
.audit-json-block pre,
.audit-metadata pre {
    margin: 0;
    max-height: 300px;
    overflow: auto;
    padding: 13px 14px;
    border: 1px solid #dbe2ec;
    border-radius: 8px;
    color: #3b4454;
    background: #f8fafc;
    font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.audit-metadata { margin: 0 18px 18px; }
.audit-metadata summary { cursor: pointer; color: var(--audit-blue); font-size: 12px; }
.audit-metadata[open] summary { margin-bottom: 8px; }

.audit-alert-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px 16px 18px; }
.audit-alert-empty { padding: 24px 20px; color: var(--muted); }
.security-alert-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    align-items: start;
    min-width: 0;
    padding: 13px;
    border: 1px solid #e6eaf0;
    border-radius: 9px;
    background: #fff;
}
.security-alert-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 9px;
    color: #fff;
    background: #f79009;
    font-size: 18px;
    font-weight: 900;
}
.security-alert-item.critical .security-alert-icon { background: #d92d20; }
.security-alert-item strong,
.security-alert-item span,
.security-alert-item small { display: block; }
.security-alert-item strong { overflow-wrap: anywhere; font-size: 12px; }
.security-alert-item span { margin-top: 3px; color: #475467; font-size: 11px; }
.security-alert-item small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.quota-summary-body { padding: 16px 18px 18px; }
.quota-summary-body > strong,
.quota-summary-body > span { display: block; }
.quota-summary-body > strong { margin-top: 0; font-size: 19px; }
.quota-summary-body > span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.quota-summary-body > a { display: inline-block; margin-top: 13px; font-size: 11px; }
.audit-integrity-body { padding: 15px 18px 18px; }
.audit-integrity-body strong,
.audit-integrity-body span,
.audit-integrity-body small { display: block; }
.audit-integrity-body strong { color: #067647; }
.audit-integrity-card.is-broken .audit-integrity-body strong { color: #b42318; }
.audit-integrity-body span { margin-top: 3px; font-size: 12px; }
.audit-integrity-body small { margin-top: 5px; color: var(--muted); font-size: 10px; }

/* Security settings summary cards */
.security-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 920px; margin-top: 14px; }
.security-summary-card { padding: 20px; }
.security-summary-card .card-title { margin-bottom: 16px; }
.security-metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.security-metric-grid > div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.security-metric-grid span,
.security-metric-grid strong { display: block; }
.security-metric-grid span { color: var(--muted); font-size: 10px; }
.security-metric-grid strong { margin-top: 2px; font-size: 17px; }
.integrity-summary strong { color: #067647; font-size: 17px; }
.integrity-bad .integrity-summary strong { color: #b42318; }
.integrity-summary p { margin: 5px 0; font-size: 12px; }
.integrity-summary span { display: block; color: var(--muted); font-size: 10px; }
.audit-maintenance-card { max-width: 920px; margin-top: 14px; overflow: hidden; }
.audit-maintenance-body { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; }
.audit-maintenance-body strong { display: block; }
.audit-maintenance-body p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.audit-maintenance-body form { flex: 0 0 auto; margin: 0; }
.audit-setting-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1280px) {
    .audit-filter-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
    .audit-keyword-field { grid-column: span 2; }
    .audit-secondary-grid { grid-template-columns: minmax(0, 1.45fr) minmax(220px, .7fr) minmax(220px, .7fr); }
    .audit-alert-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1050px) {
    .audit-secondary-grid { grid-template-columns: 1fr 1fr; }
    .audit-detail-card { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .sidebar { width: min(310px, 86vw); }
    .main { margin-left: 0; padding: 24px 18px 44px; }
    .sidebar nav { display: grid; grid-template-columns: 1fr; }
    .audit-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .audit-keyword-field { grid-column: span 2; }
    .audit-filter-actions { grid-column: span 2; }
    .security-summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .audit-filter-grid { grid-template-columns: 1fr; padding: 15px; }
    .audit-keyword-field,
    .audit-filter-actions { grid-column: auto; }
    .audit-filter-actions { justify-content: stretch; }
    .audit-filter-actions .button { flex: 1; }
    .panel-heading { align-items: stretch; flex-direction: column; min-height: 0; padding: 14px 15px; }
    .panel-actions { width: 100%; }
    .panel-actions .button { flex: 1; }
    .audit-secondary-grid { grid-template-columns: 1fr; }
    .audit-detail-card { grid-column: auto; }
    .audit-table thead { display: none; }
    .audit-table,
    .audit-table tbody,
    .audit-table tr,
    .audit-table td { display: block; width: 100%; }
    .audit-table tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .audit-table tr:last-child { border-bottom: 0; }
    .audit-table td { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 9px; padding: 4px 0; border: 0; }
    .audit-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; }
    .audit-table td.audit-more { display: none; }
    .audit-table tbody tr.is-selected td:first-child { box-shadow: none; }
    .audit-table tbody tr.is-selected { box-shadow: inset 3px 0 0 var(--audit-blue); }
    .audit-action-link,
    .audit-resource-name { white-space: normal; }
    .audit-pagination { align-items: stretch; flex-direction: column; }
    .audit-pagination > div .button { flex: 1; }
    .audit-alert-grid { padding: 12px 14px 15px; }
    .audit-detail-list > div { grid-template-columns: 82px minmax(0, 1fr); }
    .security-summary-grid,
    .audit-maintenance-card { max-width: none; }
    .audit-maintenance-body { align-items: stretch; flex-direction: column; }
    .audit-maintenance-body .button { width: 100%; }
    .audit-setting-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .main { padding: 18px 12px 36px; }
    .page-head h1 { font-size: 24px; }
    .audit-filter-actions { flex-direction: column; }
    .audit-filter-actions .button { width: 100%; }
    .panel-actions { flex-direction: column; }
    .panel-actions .button { width: 100%; }
    .audit-detail-list > div { grid-template-columns: 1fr; gap: 3px; }
    .security-metric-grid { grid-template-columns: 1fr; }
}


/* Authentication and DCIM branding. */
.main.main-auth {
    min-height: 100vh;
    margin-left: 0;
    padding: 0;
}
.main.main-auth .auth-wrap,
.main.main-auth .install-wrap {
    width: 100%;
    min-height: 100vh;
}
.auth-brand,
.install-brand {
    padding: 0;
}
.auth-brand strong,
.install-brand strong {
    color: var(--text);
    font-size: 15px;
    letter-spacing: .01em;
}
.auth-brand span,
.install-brand span {
    color: var(--muted);
    font-size: 10px;
}
.auth-brand .brand-mark,
.install-brand .brand-mark {
    flex: 0 0 38px;
}
.auth-brand .brand-mark svg,
.install-brand .brand-mark svg,
.mobile-brand-mark svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: #fff;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mobile-brand-mark svg {
    width: 18px;
    height: 18px;
}
@media (max-width: 640px) {
    .main.main-auth .auth-wrap,
    .main.main-auth .install-wrap {
        min-height: 100svh;
    }
}

/* Audit hash-chain compatibility states */
.audit-integrity-card.is-legacy .audit-integrity-body strong,
.integrity-warning .integrity-summary strong { color: #b54708; }
.audit-integrity-card.is-legacy,
.security-summary-card.integrity-warning { border-color: #f5d08a; background: #fffcf5; }


/* Management lists, security settings and audit tables. */
.button-en { margin-left: 3px; opacity: .78; font-size: .92em; font-weight: 600; }

/* User management: five stable columns with compact, aligned content. */
.users-card { overflow: hidden; }
.users-table { width: 100%; table-layout: fixed; }
.users-table th,
.users-table td { padding: 13px 15px; vertical-align: middle; }
.users-table th:nth-child(1) { width: 23%; }
.users-table th:nth-child(2) { width: 30%; }
.users-table th:nth-child(3) { width: 17%; }
.users-table th:nth-child(4) { width: 19%; }
.users-table th:nth-child(5) { width: 11%; }
.users-table td:first-child { min-width: 0; }
.user-identity { display: grid; justify-items: start; gap: 5px; min-width: 0; }
.user-name-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.user-name-line > strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.user-name-line .status-pill { min-height: 21px; padding: 2px 7px; font-size: 10px; }
.user-display-name { color: var(--muted); font-size: 11px; }
.user-identity .access-badge { margin: 0; }
.scope-summary { color: #526075; white-space: nowrap; }
.user-assignments { gap: 5px; }
.user-assignments > div { display: flex; min-width: 0; align-items: baseline; gap: 7px; }
.user-assignments > div strong { flex: 0 0 auto; }
.user-assignments > div span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.quota-cell,
.last-login-cell { display: grid; gap: 3px; min-width: 0; }
.quota-cell strong,
.last-login-cell strong { font-size: 12px; font-weight: 650; }
.quota-cell span,
.last-login-cell code { color: var(--muted); font-size: 10px; }
.last-login-cell code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.users-table td.actions { width: 11%; min-width: 0; }
.user-action-group { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px; white-space: nowrap; }
.user-action-group .inline-form { margin: 0; }
.table-action-link { display: inline-flex; align-items: center; padding: 3px 0; color: var(--primary); font-size: 12px; font-weight: 650; text-decoration: none; }
.table-action-link:hover { text-decoration: underline; }
.user-action-group .link-button.table-action-link { line-height: inherit; }

/* Security settings: every section shares exactly the same width. */
.security-settings-page { width: 100%; max-width: 920px; }
.security-settings-page .access-settings-form,
.security-settings-page .security-summary-grid,
.security-settings-page .audit-maintenance-card { width: 100%; max-width: none; }
.security-settings-page .access-settings-form { margin: 0; }
.security-settings-page .security-summary-grid { margin-top: 14px; }

/* Audit list: single-line rows and tighter chrome. Details remain available on click. */
.audit-log-compact .panel-heading { min-height: 58px; padding: 12px 16px; }
.audit-table-compact th,
.audit-table-compact td { height: 42px; padding: 7px 10px; }
.audit-table-compact th { font-size: 11px; }
.audit-table-compact td { font-size: 12px; }
.audit-table-compact th:nth-child(1) { width: 136px; }
.audit-table-compact th:nth-child(2) { width: 86px; }
.audit-table-compact th:nth-child(3) { width: 142px; }
.audit-table-compact th:nth-child(5) { width: 78px; }
.audit-table-compact th:nth-child(6) { width: 58px; }
.audit-table-compact th:nth-child(7) { width: 108px; }
.audit-table-compact th:nth-child(8) { width: 34px; }
.audit-table-compact .audit-action-link,
.audit-table-compact .audit-resource-name,
.audit-table-compact td > strong,
.audit-table-compact td code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-table-compact .audit-action-link { font-weight: 650; }
.audit-table-compact .audit-result { gap: 5px; font-size: 11px; }
.audit-table-compact .risk-badge { min-width: 28px; padding: 2px 6px; border-radius: 5px; font-size: 9px; }
.audit-table-compact .audit-more { text-align: center; }
.audit-log-compact .audit-pagination { padding: 9px 14px; }

@media (max-width: 1180px) and (min-width: 769px) {
    .users-table th:nth-child(1) { width: 20%; }
    .users-table th:nth-child(2) { width: 31%; }
    .users-table th:nth-child(3) { width: 17%; }
    .users-table th:nth-child(4) { width: 20%; }
    .users-table th:nth-child(5) { width: 12%; }
    .user-action-group { gap: 7px; }
}

@media (max-width: 768px) {
    .users-table { table-layout: auto; }
    .users-table tbody td:first-child { display: block; }
    .user-name-line { justify-content: space-between; }
    .user-assignments > div { align-items: flex-start; flex-direction: column; gap: 1px; }
    .user-assignments > div span { white-space: normal; }
    .user-action-group { width: 100%; justify-content: stretch; }
    .user-action-group > a,
    .user-action-group > form { flex: 1 1 120px; }
    .user-action-group .table-action-link { width: 100%; min-height: 38px; justify-content: center; padding: 7px 10px; border: 1px solid #cfd6e2; border-radius: 8px; background: #fff; text-decoration: none; }
    .audit-table-compact tr { padding-top: 9px; padding-bottom: 9px; }
    .audit-table-compact td { height: auto; padding: 3px 0; }
}

/* User rows, LibreNMS forms and mobile header clearance. */

/* User management uses a compact identity block instead of stacked badges. */
.users-table th,
.users-table td { padding-top: 14px; padding-bottom: 14px; }
.users-table tbody tr { min-height: 76px; }
.users-table th:nth-child(1) { width: 24%; }
.users-table th:nth-child(2) { width: 29%; }
.users-table th:nth-child(3) { width: 17%; }
.users-table th:nth-child(4) { width: 19%; }
.users-table th:nth-child(5) { width: 11%; }
.user-profile-cell {
    display: flex;
    min-width: 0;
    align-items: center;
}
.user-profile-copy { min-width: 0; }
.user-profile-title {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}
.user-profile-title > strong {
    max-width: 180px;
    overflow: hidden;
    color: #10213b;
    font-size: 14px;
    font-weight: 760;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #667085;
    font-size: 10px;
    font-weight: 650;
    white-space: nowrap;
}
.user-state i {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: #98a2b3;
}
.user-state.is-active { color: #067647; }
.user-state.is-active i { background: #12b76a; box-shadow: 0 0 0 3px rgba(18, 183, 106, .10); }
.user-state.is-disabled { color: #667085; }
.user-profile-meta {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 8px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}
.user-profile-meta > span:first-child {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-admin-flag {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 1px 7px;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    color: #b54708;
    background: #fff8eb;
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
}
.user-assignments { display: grid; gap: 6px; }
.assignment-chip-row {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.role-chip,
.scope-chip {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    white-space: nowrap;
    box-shadow: none;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.role-chip {
    max-width: 170px;
    overflow: hidden;
    color: #284b86;
    background: #e8f0ff;
    text-overflow: ellipsis;
}
.role-chip-admin { color: #75400e; background: #feead6; }
.scope-chip {
    max-width: 210px;
    overflow: hidden;
    color: #3f4754;
    background: #eef0f3;
    text-overflow: ellipsis;
}
.role-chip:hover,
.scope-chip:hover {
    border-color: rgba(15, 23, 42, .06);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.role-chip:hover { background: #dce8ff; }
.role-chip-admin:hover { background: #f9dfc3; }
.scope-chip:hover { background: #e4e7eb; }
.assignment-more { color: var(--muted); font-size: 10px; }
.empty-assignment { color: #98a2b3; font-size: 11px; }
.quota-cell strong { color: #10213b; font-size: 14px; font-variant-numeric: tabular-nums; }
.quota-cell span { line-height: 1.45; }
.quota-cell .quota-source { color: #71809a; }
.last-login-cell strong { color: #344054; font-variant-numeric: tabular-nums; }
.user-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}
.user-row-actions form { margin: 0; }
.user-row-button {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border: 1px solid #cddcff;
    border-radius: 7px;
    color: #155eef;
    background: #fff;
    font-size: 11px;
    font-weight: 680;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.user-row-button:hover { border-color: #9db8f5; background: #f5f8ff; text-decoration: none; }
.user-row-button.is-muted { color: #667085; border-color: #d8dee8; background: #fff; }
.user-row-button.is-muted:hover { color: #344054; border-color: #bfc7d4; background: #f8fafc; }

/* LibreNMS create form now uses the same full-width panel anatomy as the other cards. */
.librenms-create-card {
    width: 100%;
    max-width: none;
    overflow: hidden;
    padding: 0;
}
.librenms-create-heading { min-height: 64px; }
.librenms-create-form { display: block; }
.librenms-create-body { padding: 20px; }
.librenms-create-grid { gap: 16px 18px; }
.librenms-create-actions { border-top: 1px solid var(--line); }
.librenms-new-instance { margin-top: 16px; }

/* A later tablet rule previously removed the space reserved for the fixed mobile bar. */
@media (max-width: 768px) {
    .mobile-topbar {
        height: calc(58px + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 14px 0;
    }
    .mobile-sidebar-close { top: calc(17px + env(safe-area-inset-top)); }
    .main:not(.main-auth) {
        padding-top: calc(78px + env(safe-area-inset-top));
    }
    .users-table tbody td:first-child {
        display: flex;
        padding: 0 0 13px;
    }
    .user-profile-cell { width: 100%; }
    .user-profile-title > strong { max-width: calc(100vw - 170px); }
    .assignment-chip-row { align-items: flex-start; }
    .role-chip,
    .scope-chip { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .user-row-actions { width: 100%; justify-content: stretch; }
    .user-row-actions > a,
    .user-row-actions > form { flex: 1 1 120px; }
    .user-row-actions .user-row-button { width: 100%; min-height: 38px; }
    .librenms-create-body { padding: 16px 14px; }
    .librenms-create-grid { grid-template-columns: 1fr; gap: 15px; }
    .librenms-create-grid .full-span { grid-column: auto; }
    .librenms-create-actions { display: grid; grid-template-columns: 1fr 1fr; padding: 14px; }
    .librenms-create-actions .button { width: 100%; }
}

@media (max-width: 420px) {
    .main:not(.main-auth) {
        padding-top: calc(74px + env(safe-area-inset-top));
    }
    .user-profile-title > strong { max-width: calc(100vw - 156px); }
    .librenms-create-actions { grid-template-columns: 1fr; }
}
.user-row-actions form { display: inline-flex; }

/* Feishu-style messages, navigation and audit pagination. */

/* Feishu message toast: compact, floating, neutral white surface. */
.feishu-toast-stack {
    position: fixed;
    z-index: 1200;
    top: 22px;
    right: 24px;
    display: grid;
    width: min(420px, calc(100vw - 32px));
    gap: 10px;
    pointer-events: none;
}
.feishu-toast {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 24px;
    align-items: start;
    gap: 10px;
    min-height: 52px;
    padding: 12px 12px 12px 14px;
    border: 1px solid #dee0e3;
    border-radius: 8px;
    color: #1f2329;
    background: #fff;
    box-shadow: 0 8px 24px rgba(31, 35, 41, .14), 0 2px 6px rgba(31, 35, 41, .06);
    opacity: 0;
    pointer-events: auto;
    transform: translateY(-8px) scale(.985);
    transition: opacity .16s ease, transform .16s ease;
}
.feishu-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.feishu-toast.is-leaving { opacity: 0; transform: translateY(-6px) scale(.985); }
.feishu-toast-icon {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    margin-top: 1px;
    border-radius: 50%;
    color: #fff;
    background: #3370ff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
}
.feishu-toast-icon::before { content: "i"; }
.feishu-toast.is-success .feishu-toast-icon { background: #34c724; }
.feishu-toast.is-success .feishu-toast-icon::before { content: "✓"; }
.feishu-toast.is-error .feishu-toast-icon { background: #f54a45; }
.feishu-toast.is-error .feishu-toast-icon::before { content: "!"; }
.feishu-toast.is-warning .feishu-toast-icon { background: #ff8800; }
.feishu-toast.is-warning .feishu-toast-icon::before { content: "!"; }
.feishu-toast-content { min-width: 0; }
.feishu-toast-content strong,
.feishu-toast-content span { display: block; }
.feishu-toast-content strong { margin-bottom: 2px; font-size: 13px; font-weight: 600; line-height: 1.45; }
.feishu-toast-content span { color: #646a73; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.feishu-toast-close,
.feishu-banner-close,
.feishu-dialog-x {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    color: #8f959e;
    background: transparent;
    cursor: pointer;
    font-size: 19px;
    line-height: 1;
}
.feishu-toast-close:hover,
.feishu-banner-close:hover,
.feishu-dialog-x:hover { color: #1f2329; background: #f2f3f5; }

/* Existing validation and setup messages use the same Feishu visual language. */
.alert.feishu-banner,
.alert {
    position: relative;
    min-height: 46px;
    margin-bottom: 16px;
    padding: 11px 42px 11px 42px;
    border: 1px solid #dee0e3;
    border-radius: 8px;
    color: #1f2329;
    background: #fff;
    box-shadow: 0 2px 8px rgba(31, 35, 41, .06);
}
.alert.success { color: #1f2329; background: #f0fbef; border-color: #b7eab1; }
.alert.error { color: #1f2329; background: #fff3f2; border-color: #f6c1be; }
.feishu-banner-icon {
    position: absolute;
    top: 12px;
    left: 14px;
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #3370ff;
    font-size: 12px;
    font-weight: 800;
}
.alert.success .feishu-banner-icon { background: #34c724; }
.alert.success .feishu-banner-icon::before { content: "✓"; }
.alert.error .feishu-banner-icon { background: #f54a45; }
.alert.error .feishu-banner-icon::before { content: "!"; }
.feishu-banner-close { position: absolute; top: 10px; right: 10px; }
.error-list > div + div { margin-top: 5px; }

/* Informational callouts and hover bubbles. */
.inline-notice,
.security-note,
.console-notice {
    position: relative;
    padding: 11px 14px 11px 39px;
    border: 1px solid #dee0e3;
    border-radius: 8px;
    color: #373c43;
    background: #f5f6f7;
    box-shadow: none;
    font-size: 12px;
}
.inline-notice::before,
.security-note::before,
.console-notice::before {
    content: "i";
    position: absolute;
    top: 11px;
    left: 13px;
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #3370ff;
    font-size: 11px;
    font-weight: 800;
}
.security-note,
.console-notice { color: #6c4c13; background: #fff8e6; border-color: #f4d49b; }
.security-note::before,
.console-notice::before { content: "!"; background: #ff8800; }
.console-notice.error { color: #5f2320; background: #fff3f2; border-color: #f6c1be; }
.console-notice.error::before { background: #f54a45; }
.status-help-popover {
    padding: 12px 14px;
    border-color: #dee0e3;
    border-radius: 8px;
    color: #1f2329;
    background: #fff;
    box-shadow: 0 8px 24px rgba(31, 35, 41, .14), 0 2px 6px rgba(31, 35, 41, .06);
    font-size: 12px;
    line-height: 1.55;
}
.status-help-popover::before { border-color: #dee0e3; background: #fff; }
.status-help-popover span { color: #646a73; }

/* Feishu-style confirmation dialog replaces browser-native bubbles. */
body.dialog-open { overflow: hidden; }
.feishu-dialog-backdrop {
    position: fixed;
    z-index: 1300;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(31, 35, 41, .38);
    opacity: 0;
    transition: opacity .15s ease;
}
.feishu-dialog-backdrop[hidden] { display: none; }
.feishu-dialog-backdrop.is-open { opacity: 1; }
.feishu-dialog {
    position: relative;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 14px;
    width: min(440px, 100%);
    padding: 24px;
    border: 1px solid #dee0e3;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(31, 35, 41, .22);
    transform: translateY(8px) scale(.985);
    transition: transform .15s ease;
}
.feishu-dialog-backdrop.is-open .feishu-dialog { transform: translateY(0) scale(1); }
.feishu-dialog-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #3370ff;
    font-weight: 800;
}
.feishu-dialog.is-danger .feishu-dialog-icon { background: #f54a45; }
.feishu-dialog-copy { padding-right: 24px; }
.feishu-dialog-copy strong { display: block; margin: 1px 0 7px; font-size: 16px; font-weight: 600; }
.feishu-dialog-copy p { margin: 0; color: #646a73; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.feishu-dialog-x { position: absolute; top: 12px; right: 12px; }
.feishu-dialog-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}
.feishu-dialog-actions .button { min-width: 78px; }

/* Audit list: balanced card insets, rational column distribution and 10-row pagination. */
.audit-log-compact .panel-heading { padding-right: 20px; padding-left: 20px; }
.audit-table-shell {
    margin: 0 18px;
    overflow: hidden;
    border: 1px solid #e4e6e8;
    border-radius: 8px;
    background: #fff;
}
.audit-table-shell .table-scroll { width: 100%; }
.audit-table-shell .audit-table { min-width: 900px; table-layout: fixed; }
.audit-table-shell .audit-table th,
.audit-table-shell .audit-table td { padding-right: 14px; padding-left: 14px; }
.audit-table-compact th:nth-child(1) { width: 152px; }
.audit-table-compact th:nth-child(2) { width: 104px; }
.audit-table-compact th:nth-child(3) { width: 164px; }
.audit-table-compact th:nth-child(4) { width: auto; }
.audit-table-compact th:nth-child(5) { width: 88px; }
.audit-table-compact th:nth-child(6) { width: 66px; }
.audit-table-compact th:nth-child(7) { width: 126px; }
.audit-table-compact th:nth-child(8) { width: 42px; }
.audit-table-shell .audit-table thead th { background: #f7f8fa; }
.audit-table-shell .audit-table tbody tr:last-child td { border-bottom: 0; }
.audit-log-compact .audit-pagination {
    min-height: 58px;
    margin-top: 14px;
    padding: 10px 18px 14px;
    border-top: 0;
}
.audit-page-links { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.audit-page-button {
    display: inline-flex;
    min-width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0 9px;
    border: 1px solid #d9dce0;
    border-radius: 6px;
    color: #373c43;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}
.audit-page-button:hover { border-color: #8fadff; color: #245bdb; background: #f5f8ff; text-decoration: none; }
.audit-page-button.is-current { border-color: #3370ff; color: #fff; background: #3370ff; }
.audit-page-button.is-nav { min-width: 58px; }
.audit-page-button.is-disabled { color: #bbbfc4; background: #f5f6f7; cursor: not-allowed; }
.audit-page-ellipsis { display: inline-grid; width: 28px; height: 32px; place-items: center; color: #8f959e; }

@media (max-width: 768px) {
    .feishu-toast-stack {
        top: calc(70px + env(safe-area-inset-top, 0px));
        right: 12px;
        left: 12px;
        width: auto;
    }
    .feishu-toast { grid-template-columns: 22px minmax(0, 1fr) 24px; padding-left: 12px; }
    .feishu-dialog { padding: 20px; }
    .audit-table-shell { margin: 0 12px; border: 0; border-radius: 0; }
    .audit-table-shell .audit-table { min-width: 0; }
    .audit-log-compact .audit-pagination { align-items: flex-start; margin-top: 8px; padding: 10px 12px 14px; }
    .audit-page-links { width: 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: 2px; }
    .audit-page-button { flex: 0 0 auto; }
}

@media (max-width: 480px) {
    .feishu-dialog { grid-template-columns: 30px minmax(0, 1fr); gap: 11px; padding: 18px; }
    .feishu-dialog-icon { width: 28px; height: 28px; }
    .feishu-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .audit-page-button:not(.is-nav):not(.is-current) { display: none; }
    .audit-page-ellipsis { display: none; }
    .audit-page-links { justify-content: space-between; overflow: visible; }
}

/* Feishu notifications are centered at the top on desktop. */
@media (min-width: 769px) {
    .feishu-toast-stack { right: auto; left: 50%; transform: translateX(-50%); }
}

/* Installer loads CSS without app.js; keep its banners complete as well. */
.alert:not(.feishu-banner)::before {
    content: "i";
    position: absolute;
    top: 12px;
    left: 14px;
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #3370ff;
    font-size: 12px;
    font-weight: 800;
}
.alert.success:not(.feishu-banner)::before { content: "✓"; background: #34c724; }
.alert.error:not(.feishu-banner)::before { content: "!"; background: #f54a45; }


/* Tag table alignment and audit table proportions. */
.tag-management-table {
    width: 100%;
    min-width: 1080px;
    table-layout: fixed;
}
.tag-management-table col.tag-col-preview { width: 110px; }
.tag-management-table col.tag-col-name { width: 210px; }
.tag-management-table col.tag-col-color { width: 175px; }
.tag-management-table col.tag-col-order { width: 110px; }
.tag-management-table col.tag-col-quick { width: 86px; }
.tag-management-table col.tag-col-active { width: 86px; }
.tag-management-table col.tag-col-usage { width: 104px; }
.tag-management-table col.tag-col-actions { width: 156px; }
.tag-management-table th,
.tag-management-table td {
    box-sizing: border-box;
    padding-right: 14px;
    padding-left: 14px;
    vertical-align: middle;
}
.tag-management-table th.tag-cell-center,
.tag-management-table td.tag-check-cell,
.tag-management-table td.tag-usage-cell { text-align: center; }
.tag-management-table td.tag-order-cell,
.tag-management-table td.tag-actions-cell { text-align: left; }
.tag-management-table input:not([type="checkbox"]),
.tag-management-table select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.tag-management-table .order-input {
    width: 76px;
    min-width: 0;
    margin: 0;
    text-align: left;
}
.tag-management-table .table-check {
    display: inline-flex;
    width: 30px;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
}
.tag-management-table .table-check:hover { background: #f2f5ff; }
.tag-management-table .table-check input {
    width: 16px;
    height: 16px;
    margin: 0;
}
.tag-management-table td.tag-actions-cell {
    white-space: nowrap;
}
.tag-management-table td.tag-actions-cell .button + .button { margin-left: 6px; }

.audit-table-shell {
    margin-top: 14px;
}
.audit-table-shell .audit-table {
    width: 100%;
    min-width: 960px;
    table-layout: fixed;
}
.audit-table-shell .audit-table col.audit-col-time { width: 14%; }
.audit-table-shell .audit-table col.audit-col-user { width: 8.5%; }
.audit-table-shell .audit-table col.audit-col-action { width: 15%; }
.audit-table-shell .audit-table col.audit-col-resource { width: 25%; }
.audit-table-shell .audit-table col.audit-col-result { width: 9%; }
.audit-table-shell .audit-table col.audit-col-risk { width: 8%; }
.audit-table-shell .audit-table col.audit-col-ip { width: 14%; }
.audit-table-shell .audit-table col.audit-col-more { width: 6.5%; }
.audit-table-shell .audit-table th,
.audit-table-shell .audit-table td {
    width: auto;
    padding-right: 13px;
    padding-left: 13px;
}
.audit-table-shell .audit-table th:nth-child(6),
.audit-table-shell .audit-table td:nth-child(6) { text-align: center; }
.audit-table-shell .audit-table th:last-child,
.audit-table-shell .audit-table td:last-child {
    padding-right: 20px;
    padding-left: 8px;
    text-align: right;
}
.audit-table-compact .risk-badge {
    display: inline-flex;
    min-width: 34px;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    word-break: keep-all;
    writing-mode: horizontal-tb;
}
.audit-table-compact .audit-more a {
    display: inline-flex;
    min-width: 30px;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    letter-spacing: 1px;
}
.audit-table-compact .audit-more a:hover { background: #f2f5ff; text-decoration: none; }
.audit-action-header {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .audit-table-shell { margin-top: 10px; }
}


/* Management page widths and account state. */
.management-list-page {
    width: 100%;
    max-width: 1120px;
}
.management-list-page > .page-head,
.management-list-page > .access-table-card,
.management-list-page > .inline-notice,
.management-list-page > .alert {
    width: 100%;
}
.compact-management-page { max-width: 920px; }
.management-list-page .page-head { align-items: flex-end; }
.management-list-page .access-table-card { margin-top: 0; }
.roles-management-page .roles-table,
.server-groups-management-page .server-groups-table { table-layout: fixed; }
.roles-management-page .roles-table th:nth-child(1) { width: 43%; }
.roles-management-page .roles-table th:nth-child(2) { width: 12%; }
.roles-management-page .roles-table th:nth-child(3) { width: 15%; }
.roles-management-page .roles-table th:nth-child(4) { width: 12%; }
.roles-management-page .roles-table th:nth-child(5) { width: 18%; }
.server-groups-management-page .server-groups-table th:nth-child(1) { width: 43%; }
.server-groups-management-page .server-groups-table th:nth-child(2) { width: 12%; }
.server-groups-management-page .server-groups-table th:nth-child(3) { width: 15%; }
.server-groups-management-page .server-groups-table th:nth-child(4) { width: 12%; }
.server-groups-management-page .server-groups-table th:nth-child(5) { width: 18%; }
.roles-management-page .access-table td.actions,
.server-groups-management-page .access-table td.actions { white-space: nowrap; }

/* Keep username and account state on one optical baseline. */
.user-profile-title {
    min-height: 24px;
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
}
.user-profile-title > strong {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    line-height: 22px;
}
.user-state {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 2px 7px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    color: #667085;
    background: #f2f4f7;
    font-size: 10px;
    font-weight: 650;
    line-height: 16px;
    vertical-align: middle;
    white-space: nowrap;
}
.user-state i {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: none;
}
.user-state.is-active {
    border-color: #abefc6;
    color: #067647;
    background: #ecfdf3;
}
.user-state.is-active i {
    background: #12b76a;
    box-shadow: none;
}
.user-state.is-disabled {
    border-color: #d0d5dd;
    color: #667085;
    background: #f2f4f7;
}

@media (max-width: 1180px) {
    .management-list-page,
    .compact-management-page { max-width: none; }
}
@media (max-width: 768px) {
    .management-list-page .page-head { align-items: stretch; }
    .roles-management-page .roles-table,
    .server-groups-management-page .server-groups-table { table-layout: auto; }
    .user-profile-title { min-height: 22px; }
}

/* ========================================================================
   DCIM 2.0 UI FOUNDATION
   Shared spacing, cards, headings, tables, dialogs and responsive rules.
   ======================================================================== */
:root {
    --ui-space-1: 4px;
    --ui-space-2: 8px;
    --ui-space-3: 12px;
    --ui-space-4: 16px;
    --ui-space-5: 20px;
    --ui-space-6: 24px;
    --ui-space-8: 32px;
    --ui-radius-sm: 7px;
    --ui-radius: 10px;
    --ui-radius-lg: 14px;
    --ui-blue-50: #eef4ff;
    --ui-blue-100: #dbe8ff;
    --ui-blue-500: #3370ff;
    --ui-blue-600: #245bdb;
    --ui-green: #12b76a;
    --ui-amber: #f79009;
    --ui-red: #f04438;
    --ui-slate: #667085;
    --ui-card-padding: 20px;
}
.main { max-width: 1920px; }
.ui-page-head {
    display: flex;
    min-height: 66px;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--ui-space-6);
    margin-bottom: var(--ui-space-5);
}
.ui-page-title-wrap { min-width: 0; }
.ui-page-title-wrap h1 { margin: 3px 0 3px; font-size: 28px; line-height: 1.25; letter-spacing: -.025em; }
.ui-page-title-wrap p { margin: 0; color: var(--muted); }
.ui-page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--ui-space-2); }
.ui-page-actions form, .inline-form { margin: 0; }
.ui-card { overflow: hidden; }
.ui-card-body { padding: var(--ui-card-padding); }
.ui-section-head,
.panel-heading,
.server-section-head,
.compact-section-head,
.card-section-head,
.notes-card-head {
    position: relative;
    display: flex;
    min-height: 66px;
    align-items: center;
    justify-content: space-between;
    gap: var(--ui-space-4);
    margin: 0;
    padding: 15px var(--ui-card-padding) 14px 34px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.form-section > .section-title,
.card > .card-title {
    position: relative;
    display: block;
    min-height: 0;
    margin: 0 0 18px;
    padding: 0 0 0 14px;
    border: 0;
    background: transparent;
}
.ui-section-head::before,
.panel-heading::before,
.server-section-head::before,
.compact-section-head::before,
.card-section-head::before,
.notes-card-head::before {
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 20px;
    width: 3px;
    border-radius: 3px;
    background: var(--ui-blue-500);
    content: "";
}
.form-section > .section-title::before,
.card > .card-title::before {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 0;
    width: 3px;
    border-radius: 3px;
    background: var(--ui-blue-500);
    content: "";
}
.ui-section-title,
.panel-heading > div:first-child,
.server-section-heading,
.compact-section-head > div:first-child,
.card-section-head > div:first-child,
.notes-card-head > div:first-child {
    position: static;
    min-width: 0;
    padding-left: 0;
}
.panel-heading > div:first-child::before,
.server-section-heading::before,
.compact-section-head > div:first-child::before,
.card-section-head > div:first-child::before,
.notes-card-head > div:first-child::before,
.server-action-title::before {
    display: none !important;
    content: none !important;
}
.card-section-head > .card-title,
.compact-section-head > .card-title,
.notes-card-head > .card-title {
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.ui-section-title strong,
.ui-section-title span,
.panel-heading > div > strong,
.panel-heading > div > span,
.server-section-heading strong,
.server-section-heading span,
.compact-section-head > div > strong,
.compact-section-head > div > span,
.card-section-head > div > strong,
.card-section-head > div > span,
.notes-card-head > div > strong,
.notes-card-head > div > span,
.section-title strong,
.section-title span,
.card-title strong,
.card-title span { display: block; }
.ui-section-title strong,
.panel-heading > div > strong,
.server-section-heading strong,
.compact-section-head > div > strong,
.card-section-head > div > strong,
.notes-card-head > div > strong,
.section-title strong,
.card-title strong { color: #101828; font-size: 16px; line-height: 1.35; }
.ui-section-title span,
.panel-heading > div > span,
.server-section-heading span,
.compact-section-head > div > span,
.card-section-head > div > span,
.notes-card-head > div > span,
.section-title span,
.card-title span { margin-top: 2px; color: #7b8798; font-size: 12px; font-weight: 500; }
.ui-section-actions,
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--ui-space-2); }
.form-section { padding-top: 24px; }
.server-section-body { padding: var(--ui-card-padding); }

.ui-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ui-space-3); margin-bottom: var(--ui-space-4); }
.ui-metric-card {
    position: relative;
    min-width: 0;
    padding: 17px 18px;
    border: 1px solid var(--line);
    border-radius: var(--ui-radius);
    background: #fff;
    box-shadow: 0 5px 18px rgba(20, 32, 55, .035);
}
.ui-metric-card::after { position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #98a2b3; content: ""; }
.ui-metric-card.is-success::after { background: var(--ui-green); }
.ui-metric-card.is-warning::after { background: var(--ui-amber); }
.ui-metric-card.is-danger::after { background: var(--ui-red); }
.ui-metric-card.is-info::after { background: var(--ui-blue-500); }
.ui-metric-card span, .ui-metric-card small { display: block; color: var(--muted); }
.ui-metric-card strong { display: block; margin: 6px 0 2px; color: #101828; font-size: 25px; line-height: 1.1; }
.ui-metric-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ui-status-badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    color: #475467;
    background: #f9fafb;
    font-size: 11px;
    font-weight: 650;
    line-height: 18px;
    white-space: nowrap;
}
.ui-status-badge i { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; }
.ui-status-badge.is-ok, .ui-status-badge.is-success { border-color: #abefc6; color: #067647; background: #ecfdf3; }
.ui-status-badge.is-warning { border-color: #fedf89; color: #b54708; background: #fffaeb; }
.ui-status-badge.is-error, .ui-status-badge.is-danger { border-color: #fecdca; color: #b42318; background: #fef3f2; }
.ui-status-badge.is-info { border-color: #b2ccff; color: #245bdb; background: #eff4ff; }

.ui-table { table-layout: fixed; }
.ui-table th, .ui-table td { padding: 12px 14px; }
.ui-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.ui-table tbody tr { transition: background .12s ease; }
.ui-table tbody tr:hover { background: #f8faff; }
.ui-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 5px; margin: 0; }
.ui-page-button {
    display: inline-flex;
    min-width: 32px;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border: 1px solid #d9dee8;
    border-radius: 7px;
    color: #344054;
    background: #fff;
    font-size: 12px;
    text-decoration: none;
}
.ui-page-button:hover { border-color: #9bb7ff; color: var(--ui-blue-600); background: #f7f9ff; text-decoration: none; }
.ui-page-button.is-current { border-color: var(--ui-blue-500); color: #fff; background: var(--ui-blue-500); }
.ui-page-button.is-disabled { opacity: .45; pointer-events: none; }
.ui-page-ellipsis { padding: 0 3px; color: var(--muted); }

.ui-dialog { width: min(560px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--ui-radius-lg); background: transparent; box-shadow: 0 24px 80px rgba(16, 24, 40, .24); }
.ui-dialog::backdrop { background: rgba(15, 23, 42, .42); backdrop-filter: blur(2px); }
.ui-dialog-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--ui-radius-lg); background: #fff; }
.ui-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.ui-dialog-head strong, .ui-dialog-head span { display: block; }
.ui-dialog-head span { color: var(--muted); font-size: 12px; }
.ui-dialog-body { padding: 20px; }
.ui-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfc; }

/* Server list v2 */
.server-stat-grid { margin-bottom: 16px; }
.server-filter-card { margin-bottom: 16px; }
.server-filter-form { display: grid; grid-template-columns: minmax(220px, 320px) minmax(160px, 1.2fr) repeat(2, minmax(135px, 1fr)) minmax(176px, .95fr) minmax(92px, .55fr) auto; gap: 14px; align-items: end; }
.server-filter-form .field label { margin-bottom: 5px; font-size: 12px; }
.server-search-field { min-width: 0; max-width: 320px; }
.server-tag-mode { min-width: 176px; }
.server-per-page { min-width: 92px; }
.server-filter-actions { padding-bottom: 1px; }
.server-tag-filter { padding-top: 0; border-top: 0; }
.server-tag-filter-head { display: flex; align-items: baseline; justify-content: flex-start; gap: 8px; margin-bottom: 10px; }
.server-tag-filter-head strong { color: var(--text); font-size: 12px; font-weight: 700; line-height: 1.35; }
.server-tag-filter-head small { color: var(--muted); font-size: 11px; }
.server-list-card { margin-bottom: 18px; }
.server-list-range { color: var(--muted); font-size: 12px; }
.server-table-scroll { max-height: calc(100vh - 330px); min-height: 260px; }
.server-table-v2 { min-width: 1180px; }
.server-table-v2 thead { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--line); }
.server-table-v2 th:nth-child(2) { width: 17%; }
.server-table-v2 th:nth-child(3) { width: 12%; }
.server-table-v2 th:nth-child(4) { width: 12%; }
.server-table-v2 th:nth-child(5) { width: 15%; }
.server-table-v2 th:nth-child(6) { width: 10%; }
.server-table-v2 th:nth-child(7) { width: 16%; }
.server-table-v2 th:nth-child(8) { width: 13%; }
.select-column { width: 42px; text-align: center !important; }
.row-actions-column { width: 64px; text-align: center !important; }
.server-identity { display: flex; min-width: 0; align-items: center; }
.server-identity > div, .server-table-v2 td { min-width: 0; }
.server-table-v2 td > strong, .server-table-v2 td > span, .server-table-v2 td > code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-table-v2 .server-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-status-stack { display: grid; justify-items: start; gap: 2px; }
.server-list-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.server-bulk-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid #b2ccff; background: #eff4ff; }
.server-bulk-toolbar[hidden] { display: none; }
.server-bulk-toolbar select { width: 180px; min-height: 34px; padding: 5px 9px; }
.ui-row-menu { position: relative; display: inline-block; }
.ui-row-menu summary { display: inline-grid; width: 34px; height: 30px; place-items: center; border-radius: 7px; color: #667085; cursor: pointer; list-style: none; letter-spacing: 2px; }
.ui-row-menu summary::-webkit-details-marker { display: none; }
.ui-row-menu summary:hover, .ui-row-menu[open] summary { color: var(--ui-blue-600); background: var(--ui-blue-50); }
.ui-row-menu-panel { position: absolute; top: 34px; right: 0; z-index: 20; display: grid; min-width: 170px; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 14px 36px rgba(16, 24, 40, .16); text-align: left; }
.ui-row-menu-panel a, .ui-row-menu-panel button { width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; color: #344054; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.ui-row-menu-panel a:hover, .ui-row-menu-panel button:hover { color: #245bdb; background: #f2f5ff; text-decoration: none; }
.column-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Server detail v2 */
.server-detail-v2 { display: grid; gap: 16px; }
.server-overview-card { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(520px, 1.5fr); }
.server-overview-main { padding: 20px; border-right: 1px solid var(--line); }
.server-overview-identity { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.server-overview-identity strong, .server-overview-identity span { display: block; }
.server-overview-identity strong { font-size: 18px; }
.server-overview-identity span { color: var(--muted); }
.server-overview-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.server-overview-facts > div { min-width: 0; padding: 20px; border-right: 1px solid var(--line); }
.server-overview-facts > div:last-child { border-right: 0; }
.server-overview-facts span, .server-overview-facts strong { display: block; }
.server-overview-facts span { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.server-overview-facts strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-detail-grid { gap: 16px; }
.server-detail-tags-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.server-detail-tags-row > strong { width: 80px; flex: 0 0 80px; padding-top: 2px; }
.server-detail-tags-row .tag-badge-list { flex: 1; }
.server-activity-list { display: grid; }
.server-activity-list > a { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.server-activity-list > a:last-child { border-bottom: 0; }
.server-activity-list > a:hover { background: #f8faff; }
.server-activity-list strong, .server-activity-list small { display: block; }
.server-activity-list small { margin-top: 2px; color: var(--muted); }
.activity-risk { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.activity-risk.is-medium { background: #f79009; }
.activity-risk.is-high { background: #f04438; }
.activity-risk.is-critical { background: #b42318; box-shadow: 0 0 0 3px #fee4e2; }

/* Permission preview */
.permission-preview-section { background: #fbfcff; }
.permission-preview-section.is-loading { opacity: .72; }
.permission-preview-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.permission-preview-metrics > div { padding: 13px; border: 1px solid #dce4f3; border-radius: 8px; background: #fff; }
.permission-preview-metrics span, .permission-preview-metrics strong { display: block; }
.permission-preview-metrics span { color: var(--muted); font-size: 11px; }
.permission-preview-metrics strong { margin-top: 4px; font-size: 20px; }
.permission-preview-warnings { display: grid; gap: 6px; margin-top: 12px; }
.permission-preview-warnings > div { padding: 8px 10px; border: 1px solid #fedf89; border-radius: 7px; color: #93370d; background: #fffaeb; font-size: 12px; }
.permission-preview-details { margin-top: 12px; }
.permission-preview-details summary { color: var(--ui-blue-600); cursor: pointer; }
.permission-code-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.permission-code-cloud code { padding: 3px 7px; border-radius: 5px; color: #344054; background: #f2f4f7; }

/* Diagnostics */
.diagnostics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.diagnostics-card { min-width: 0; }
.diagnostics-list { display: grid; }
.diagnostic-row { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.diagnostic-row:last-child { border-bottom: 0; }
.diagnostic-row strong, .diagnostic-row small { display: block; }
.diagnostic-row small { max-width: 600px; margin-top: 2px; color: var(--muted); word-break: break-word; }
.diagnostic-value { flex: 0 0 auto; }
.diagnostics-help-card { grid-column: 1 / -1; margin-top: 16px; }
.ui-note-list { padding: 18px 20px; }
.ui-note-list p { margin: 0; }
.ui-note-list p + p { margin-top: 10px; }

/* Backups */
.backup-layout { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(420px, 1.2fr); gap: 16px; margin-bottom: 16px; }
.backup-policy-form { display: grid; gap: 16px; }
.ui-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.ui-switch-row span, .ui-switch-row strong, .ui-switch-row small { display: block; }
.ui-switch-row small { color: var(--muted); }
.ui-switch-row input { width: 18px; height: 18px; }
.backup-policy-meta { color: var(--muted); font-size: 12px; }
.backup-list-card { margin-bottom: 14px; }
.backup-table { min-width: 980px; }
.backup-table th:nth-child(1) { width: 16%; }
.backup-table th:nth-child(2) { width: 9%; }
.backup-table th:nth-child(3) { width: 9%; }
.backup-table th:nth-child(4), .backup-table th:nth-child(5) { width: 10%; }
.backup-table th:nth-child(6) { width: 24%; }
.backup-table th:nth-child(7) { width: 22%; }
.backup-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-actions { display: flex; align-items: center; gap: 6px; }
.backup-actions form { margin: 0; }
.backup-warning { margin-top: 14px; }

@media (max-width: 1280px) {
    .server-filter-form { grid-template-columns: minmax(220px, 1.35fr) repeat(2, minmax(150px, 1fr)); }
    .server-search-field { max-width: none; }
    .server-filter-actions { grid-column: auto; }
    .permission-preview-metrics { grid-template-columns: repeat(3, 1fr); }
    .server-overview-card { grid-template-columns: 1fr; }
    .server-overview-main { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 1024px) {
    .ui-metric-grid { grid-template-columns: 1fr 1fr; }
    .server-filter-form { grid-template-columns: 1fr 1fr; }
    .server-filter-actions { align-self: end; }
    .server-overview-facts { grid-template-columns: 1fr 1fr; }
    .server-overview-facts > div:nth-child(2) { border-right: 0; }
    .server-overview-facts > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .diagnostics-grid, .backup-layout { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .ui-page-head { min-height: 0; align-items: stretch; flex-direction: column; gap: 12px; }
    .ui-page-title-wrap h1 { font-size: 24px; }
    .ui-page-actions { justify-content: flex-start; }
    .ui-page-actions .button, .ui-page-actions form { flex: 1 1 auto; }
    .ui-page-actions form .button { width: 100%; }
    .ui-section-head, .panel-heading, .server-section-head, .compact-section-head, .card-section-head, .notes-card-head { min-height: 60px; padding-right: 16px; padding-left: 30px; }
    .ui-section-head::before, .panel-heading::before, .server-section-head::before, .compact-section-head::before, .card-section-head::before, .notes-card-head::before { left: 16px; }
    .ui-metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .ui-metric-card { padding: 14px; }
    .server-filter-form { grid-template-columns: 1fr; }
    .server-filter-actions .button { width: 100%; }

    .server-table-scroll { max-height: none; }
    .server-table-v2 { min-width: 0; }
    .server-table-v2 thead { display: none; }
    .server-table-v2 tbody { display: grid; gap: 10px; padding: 12px; }
    .server-table-v2 tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; overflow: visible; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
    .server-table-v2 td { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
    .server-table-v2 td::before { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; content: attr(data-mobile-label); }
    .server-table-v2 .select-column { position: absolute; top: 12px; right: 46px; z-index: 2; width: auto; padding: 0; border: 0; }
    .server-table-v2 .select-column::before { display: none; }
    .server-table-v2 .row-actions-column { position: absolute; top: 8px; right: 8px; z-index: 3; width: auto; padding: 0; border: 0; }
    .server-table-v2 td[data-server-column="server"] { grid-column: 1 / -1; padding-right: 84px; }
    .server-table-v2 td[data-server-column="tags"], .server-table-v2 td[data-server-column="checked"] { grid-column: 1 / -1; }
    .server-list-footer { align-items: stretch; flex-direction: column; }
    .ui-pagination { justify-content: flex-start; }
    .server-bulk-toolbar { align-items: stretch; flex-wrap: wrap; }
    .server-bulk-toolbar strong { width: 100%; }
    .server-bulk-toolbar select { width: 100%; }
    .column-choice-grid { grid-template-columns: 1fr; }
    .server-overview-facts { grid-template-columns: 1fr; }
    .server-overview-facts > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .server-overview-facts > div:last-child { border-bottom: 0; }
    .permission-preview-metrics { grid-template-columns: 1fr 1fr; }
    .diagnostics-grid { gap: 12px; }
    .diagnostic-row { align-items: flex-start; flex-direction: column; gap: 8px; }
    .backup-actions { align-items: stretch; flex-direction: column; }
    .backup-actions .button { width: 100%; }
}
@media (max-width: 480px) {
    .ui-metric-grid { grid-template-columns: 1fr; }
    .permission-preview-metrics { grid-template-columns: 1fr; }
    .server-table-v2 tr { grid-template-columns: 1fr; }
    .server-table-v2 td[data-server-column] { grid-column: 1; }
}
/* Legacy direct-title markup has title/subtitle children; nested card titles stay plain. */
.form-section > .section-title,
.card > .card-title,
.card-section-head > .card-title,
.compact-section-head > .card-title,
.notes-card-head > .card-title { display: block; }

/* Canonical heading guard: exactly one blue accent bar per section. */
.panel-heading > div:first-child,
.server-section-heading,
.compact-section-head > div:first-child,
.card-section-head > div:first-child,
.notes-card-head > div:first-child { padding-left: 0 !important; }
.panel-heading > div:first-child::before,
.server-section-heading::before,
.compact-section-head > div:first-child::before,
.card-section-head > div:first-child::before,
.notes-card-head > div:first-child::before { display: none !important; content: none !important; }


/* Server detail spacing and avatar-free identity rows. */
.server-detail-head + .server-action-bar.server-section-card { margin-bottom: 16px; }
.user-profile-cell, .server-identity { gap: 0; }

/* Adaptive server-list tag visibility. */


/* Fluid tag column, canonical audit headings and audit maintenance. */
.server-table-v2 {
    width: 100%;
    min-width: 1120px;
    table-layout: fixed;
}
.server-table-v2 th[data-server-column="server"] { width: 170px; }
.server-table-v2 th[data-server-column="public_ip"] { width: 130px; }
.server-table-v2 th[data-server-column="ipmi"] { width: 130px; }
.server-table-v2 th[data-server-column="network"] { width: 160px; }
.server-table-v2 th[data-server-column="monitor"] { width: 105px; }
.server-table-v2 th[data-server-column="tags"],
.server-table-v2 td[data-server-column="tags"] { width: auto; min-width: 164px; }
.server-table-v2 th[data-server-column="checked"] { width: 155px; }
.server-table-v2 td[data-server-column="tags"] { max-width: none; }
.monitor-match-link {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}
.monitor-match-link:hover { text-decoration: none; }
.monitor-match-link:hover .ui-status-badge { border-color: #84adff; background: #e4edff; }
#traffic-monitor { scroll-margin-top: 82px; }

.audit-log-compact > .ui-section-head {
    min-height: 58px;
    padding-top: 12px;
    padding-bottom: 12px;
}
.audit-log-compact > .ui-section-head::before { top: 13px; bottom: 13px; }

.audit-maintenance-list { display: grid; }
.audit-maintenance-list .audit-maintenance-body + .audit-maintenance-body { border-top: 1px solid var(--line); }
.audit-clear-all-row { background: #fffafa; }
.audit-clear-all-form {
    display: grid;
    grid-template-columns: auto minmax(190px, 250px) auto;
    align-items: center;
    gap: 8px;
}
.audit-clear-all-form label { color: #475467; font-size: 12px; font-weight: 650; white-space: nowrap; }
.audit-clear-all-form input { min-height: 36px; }

@media (max-width: 1180px) {
    .server-table-v2 { min-width: 1080px; }
    .server-table-v2 th[data-server-column="server"] { width: 160px; }
    .server-table-v2 th[data-server-column="network"] { width: 150px; }
    .server-table-v2 th[data-server-column="checked"] { width: 148px; }
}
@media (max-width: 768px) {
    .server-table-v2 { min-width: 0; table-layout: fixed; }
    .audit-clear-all-form { grid-template-columns: 1fr; width: 100%; }
    .audit-clear-all-form .button { width: 100%; }
}

/* Server detail recent-activity cards. */
.server-activity-card { overflow: hidden; }
.server-activity-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--line);
    background: #fbfcff;
}
.server-activity-item {
    position: relative;
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 14px 14px 14px 16px;
    border: 1px solid #e4e9f2;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .025);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.server-activity-item:hover {
    border-color: #b9ccff;
    box-shadow: 0 5px 16px rgba(38, 78, 156, .08);
    transform: translateY(-1px);
    text-decoration: none;
}
.server-activity-mark {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #98a2b3;
    box-shadow: 0 0 0 3px #f2f4f7;
}
.server-activity-mark.is-medium { background: #f79009; box-shadow: 0 0 0 3px #fef0c7; }
.server-activity-mark.is-high { background: #f04438; box-shadow: 0 0 0 3px #fee4e2; }
.server-activity-mark.is-critical { background: #b42318; box-shadow: 0 0 0 3px #fecdca; }
.server-activity-content { min-width: 0; }
.server-activity-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.server-activity-title-row strong {
    min-width: 0;
    overflow: hidden;
    color: #182230;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.server-activity-title-row .risk-badge { flex: 0 0 auto; }
.server-activity-detail {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: #667085;
    font-size: 12px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.server-activity-content small {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    overflow: hidden;
    color: #98a2b3;
    font-size: 11px;
    white-space: nowrap;
}
.server-activity-content small span,
.server-activity-content small time { overflow: hidden; text-overflow: ellipsis; }
.server-activity-content small i { flex: 0 0 auto; font-style: normal; }
.server-activity-item > .audit-result { align-self: start; margin-top: 1px; white-space: nowrap; }

@media (max-width: 980px) {
    .server-activity-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .server-activity-grid { gap: 10px; padding: 12px; }
    .server-activity-item { grid-template-columns: 8px minmax(0, 1fr); padding: 13px; }
    .server-activity-item > .audit-result { grid-column: 2; justify-self: start; margin-top: 2px; }
    .server-activity-title-row { align-items: flex-start; }
}

/* Recent-activity alignment with the server-detail grid. */
.server-activity-card {
    width: 100%;
    min-width: 0;
    padding: 0;
}
.server-activity-card > .server-section-head {
    width: 100%;
    box-sizing: border-box;
}
.server-activity-card > .server-activity-grid,
.server-activity-card > .empty-state {
    width: 100%;
    box-sizing: border-box;
}

/* Merged module navigation for switches/LibreNMS and users/roles. */
.module-tabs {
    display: inline-flex;
    max-width: 100%;
    gap: 4px;
    margin: -6px 0 18px;
    padding: 4px;
    overflow-x: auto;
    border: 1px solid #e1e6ee;
    border-radius: 10px;
    background: #f3f5f8;
    scrollbar-width: none;
}
.module-tabs::-webkit-scrollbar { display: none; }
.module-tab {
    display: inline-flex;
    min-width: 138px;
    min-height: 48px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #667085;
    background: transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.module-tab:hover {
    color: #344054;
    background: rgba(255, 255, 255, .72);
    text-decoration: none;
}
.module-tab strong { color: inherit; font-size: 13px; font-weight: 700; }
.module-tab span { color: #98a2b3; font-size: 11px; font-weight: 500; }
.module-tab.is-active {
    border-color: #d7deea;
    color: #175cd3;
    background: #fff;
    box-shadow: 0 2px 5px rgba(16, 24, 40, .06);
}
.module-tab.is-active span { color: #5284d8; }
.management-list-page > .module-tabs { align-self: flex-start; }

@media (max-width: 640px) {
    .module-tabs {
        display: flex;
        width: 100%;
        margin-top: -2px;
    }
    .module-tab {
        min-width: max-content;
        flex: 1 0 auto;
        min-height: 44px;
        padding: 7px 12px;
    }
}


/* Persistent signed-in account panel at the bottom of the sidebar. */
.sidebar nav {
    flex: 1 1 auto;
    min-height: 0;
}
.sidebar-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding: 14px 6px 0;
    border-top: 1px solid rgba(255, 255, 255, .09);
}
.sidebar-account-summary {
    min-width: 0;
    padding: 0 6px 10px;
}
.sidebar-account-label {
    display: block;
    color: #6f86a7;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.sidebar-account-name {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: #f4f7fb;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-signout-form { margin: 0; }
.sidebar-signout-button {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 9px;
    color: #c8d4e5;
    background: rgba(255, 255, 255, .035);
    cursor: pointer;
    text-align: left;
    transition: color .15s ease, background .15s ease, border-color .15s ease, transform .15s ease;
}
.sidebar-signout-button:hover,
.sidebar-signout-button:focus-visible {
    color: #fff;
    border-color: rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .075);
    outline: none;
    transform: translateY(-1px);
}
.sidebar-signout-button svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sidebar-signout-button span,
.sidebar-signout-button strong,
.sidebar-signout-button small { display: block; }
.sidebar-signout-button strong { font-size: 12px; line-height: 1.25; }
.sidebar-signout-button small {
    margin-top: 1px;
    color: #7187a5;
    font-size: 9px;
    font-weight: 500;
    line-height: 1.2;
}
.sidebar-signout-button:hover small,
.sidebar-signout-button:focus-visible small { color: rgba(255, 255, 255, .70); }

@media (max-width: 900px) {
    .sidebar-footer {
        display: block;
        margin-top: auto;
        padding: 14px 6px calc(2px + env(safe-area-inset-bottom));
    }
}

/* DCIM 2.1 stable UI contract -------------------------------------------------
   This block is the single final authority for shared geometry. Page-specific
   styles may change content layout, but must not override these component rules. */
:root {
    --ui-page-max: 1440px;
    --ui-card-radius: 12px;
    --ui-card-gap: 18px;
    --ui-card-padding: 20px;
    --ui-section-bar-width: 4px;
    --ui-section-bar-height: 32px;
}
.main > .ui-page-head,
.main > .ui-metric-grid,
.main > .ui-card,
.main > .import-layout,
.main > .management-list-page,
.main > .detail-grid,
.main > .module-tabs {
    box-sizing: border-box;
}
.ui-page-head { align-items: flex-start; }
.ui-page-actions { flex-wrap: wrap; }
.ui-section-head {
    min-height: 66px;
    align-items: center;
    padding: 14px 20px 14px 34px;
}
.ui-section-head::before {
    top: 16px;
    bottom: 16px;
    left: 20px;
    width: var(--ui-section-bar-width);
    height: auto;
}
.ui-section-title { min-width: 0; }
.ui-section-title strong,
.ui-section-title span { overflow-wrap: anywhere; }
.ui-section-actions { flex-wrap: wrap; }
.ui-card-body { padding: var(--ui-card-padding); }
.ui-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--line);
    background: #fbfcfd;
}
.ui-card-actions form { margin: 0; }
.alert.warning {
    color: #8a4b08;
    border: 1px solid #fedf89;
    background: #fffaeb;
}
.button:disabled,
.button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }

/* Server CSV import/export. */
.import-layout { display: grid; gap: var(--ui-card-gap); }
.import-guide-card,
.import-upload-card,
.import-preview-card { overflow: hidden; }
.import-rule-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.import-rule-grid article {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 11px;
    padding: 14px;
    border: 1px solid #e5eaf1;
    border-radius: 10px;
    background: #fbfcfe;
}
.import-rule-grid article > span {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    color: #175cd3;
    background: #eaf2ff;
    font-weight: 800;
}
.import-rule-grid strong { display: block; margin-bottom: 3px; }
.import-rule-grid p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.import-security-note {
    display: grid;
    gap: 3px;
    margin-top: 14px;
    padding: 13px 15px;
    border: 1px solid #b2ccff;
    border-radius: 10px;
    color: #1849a9;
    background: #eff4ff;
}
.import-security-note span { font-size: 12px; line-height: 1.6; }
.import-upload-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .65fr); gap: 18px; align-items: end; }
.import-upload-form input[type="file"] {
    min-height: 46px;
    padding: 8px 10px;
    border: 1px dashed #b8c2d1;
    border-radius: 9px;
    background: #fbfcfe;
}
.import-capability-list { display: flex; flex-wrap: wrap; gap: 8px; align-self: center; }
.import-upload-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; grid-column: 1 / -1; }
.import-message-list strong { display: block; margin-bottom: 5px; }
.import-message-list > div + div { margin-top: 3px; }
.import-preview-expiry { color: var(--muted); font-size: 11px; white-space: nowrap; }
.import-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.import-summary-grid article {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e5eaf1;
    border-radius: 9px;
    background: #fbfcfe;
}
.import-summary-grid span { color: var(--muted); font-size: 12px; }
.import-summary-grid strong { font-size: 22px; line-height: 1; }
.import-summary-grid .is-create strong { color: #067647; }
.import-summary-grid .is-update strong { color: #175cd3; }
.import-summary-grid .is-error strong { color: #b42318; }
.import-preview-scroll { margin: 14px 20px 20px; border: 1px solid var(--line); border-radius: 10px; }
.import-preview-table { min-width: 1040px; }
.import-preview-table th,
.import-preview-table td { padding: 10px 12px; }
.import-preview-table tr.has-error { background: #fff8f7; }
.import-operation {
    display: inline-flex;
    min-width: 58px;
    justify-content: center;
    padding: 3px 7px;
    border-radius: 6px;
    color: #475467;
    background: #f2f4f7;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.import-operation.is-create { color: #067647; background: #ecfdf3; }
.import-operation.is-update { color: #175cd3; background: #eff4ff; }
.import-row-errors { max-width: 320px; margin-top: 5px; color: #b42318; font-size: 11px; line-height: 1.45; }
.import-preview-actions { justify-content: space-between; }
.import-preview-actions > form:last-child { margin-left: auto; }

/* Sidebar geometry: fixed visual size with content-sized grid rows. */
.sidebar nav {
    flex: 1 1 auto;
    min-height: 0;
    align-content: start;
    grid-auto-rows: max-content;
    overflow-y: auto;
}
.sidebar nav a {
    height: 48px;
    min-height: 48px;
    max-height: 48px;
}

@media (max-width: 900px) {
    .ui-page-head { gap: 14px; }
    .ui-page-actions { width: 100%; }
    .import-rule-grid { grid-template-columns: 1fr; }
    .import-upload-form { grid-template-columns: 1fr; }
    .import-capability-list,
    .import-upload-actions { grid-column: 1; }
    .import-upload-actions { justify-content: stretch; }
    .import-upload-actions .button { flex: 1 1 auto; }
    .import-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .ui-section-head { min-height: 60px; padding: 12px 14px 12px 30px; }
    .ui-section-head::before { top: 14px; bottom: 14px; left: 14px; }
    .ui-card-body { padding: 14px; }
    .ui-card-actions { padding: 13px 14px; }
    .import-summary-grid { gap: 8px; padding: 12px 14px; }
    .import-summary-grid article { min-height: 54px; padding: 10px 12px; }
    .import-preview-scroll { margin: 10px 14px 14px; }
    .import-preview-actions { align-items: stretch; flex-direction: column; }
    .import-preview-actions form,
    .import-preview-actions .button { width: 100%; }
    .import-preview-actions > form:last-child { margin-left: 0; }
}

/* Network connection empty state. */
.network-empty-state {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 78px;
    padding: 14px 16px;
    border: 1px dashed #c9d5e6;
    border-radius: 10px;
    background: linear-gradient(180deg, #fcfdff 0%, #f8faff 100%);
}
.network-empty-state-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid #d6e4ff;
    border-radius: 9px;
    color: #175cd3;
    background: #eff4ff;
}
.network-empty-state-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.network-empty-state-copy { min-width: 0; }
.network-empty-state-copy strong,
.network-empty-state-copy span { display: block; }
.network-empty-state-copy strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
}
.network-empty-state-copy span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}
.network-empty-state-action {
    min-width: 76px;
    white-space: nowrap;
}
@media (max-width: 560px) {
    .network-empty-state {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 10px;
        padding: 13px 14px;
    }
    .network-empty-state-icon { width: 36px; height: 36px; }
    .network-empty-state-action {
        grid-column: 1 / -1;
        width: 100%;
        margin-top: 2px;
    }
}

/* Network empty-state continuity.
 * When no switch port is associated, the following additional-IP block must
 * not draw a separator that visually looks like a second bottom border.
 */
.network-empty-state + .network-additional-ip {
    margin-top: 14px;
    padding-top: 0;
    border-top: 0;
}

/* Server-list IPMI address and switch-port font size only. */
.server-table-v2 .server-list-ipmi-address,
.server-table-v2 .server-list-switch-port {
    font-size: 11px;
}
.server-table-v2 .server-list-ipmi-address code,
.server-table-v2 .server-list-switch-port code {
    font-size: inherit;
}

/* Server list column flow and inline quick-tag action. */
.server-table-v2 td[data-server-column="checked"] {
    white-space: normal;
}
.server-table-v2 td[data-server-column="checked"] > span,
.server-table-v2 td[data-server-column="checked"] > small {
    display: block;
    white-space: nowrap;
}
.server-table-v2 td[data-server-column="checked"] > small {
    margin-top: 2px;
}
.server-table-v2 td[data-server-column="tags"] {
    padding-right: 12px;
}
.server-tags-wrap {
    gap: 4px;
}
.server-tags-wrap .quick-tag-button {
    opacity: .72;
}
.server-tags-wrap:hover .quick-tag-button,
.server-tags-wrap .quick-tag-button:focus-visible {
    opacity: 1;
}
@media (max-width: 768px) {
    .server-table-v2 td[data-server-column="checked"] { grid-column: 1 / -1; }
    .server-table-v2 td[data-server-column="tags"] { grid-column: 1 / -1; }
    .server-tags-wrap .quick-tag-button { opacity: 1; }
}

/* Server-list checked column and inline tag editor alignment. */
.server-table-v2 th[data-server-column="checked"] {
    width: 188px;
}
.server-table-v2 td[data-server-column="checked"] {
    min-width: 188px;
}
.server-tags-wrap {
    justify-content: flex-start;
    gap: 5px;
}
.server-tags-wrap .server-tag-cell {
    flex: 0 1 auto;
    width: auto;
    max-width: calc(100% - 27px);
}
.server-tags-wrap .adaptive-server-tags {
    width: auto;
}
.server-tags-wrap .quick-tag-button {
    margin-left: 1px;
}
@media (max-width: 768px) {
    .server-table-v2 td[data-server-column="checked"] {
        min-width: 0;
    }
}

/* Compact reveal quota summary and anchored user quota editor. */
#reveal-quota { scroll-margin-top: 82px; }

/* Unified console and installer domain configuration. */
.install-domain-row {
    display: grid;
    grid-template-columns: minmax(104px, auto) minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
}
.install-domain-row select,
.install-domain-row input { width: 100%; }
.console-primary-actions { align-items: center; }
.console-primary-actions .inline-form { display: inline-flex; }
@media (max-width: 620px) {
    .install-domain-row { grid-template-columns: 1fr; }
    .console-primary-actions .inline-form,
    .console-primary-actions .inline-form .button { width: 100%; }
}


/* Mobile usability pass: compact inventory, safe-area navigation and touch-first details. */
.mobile-filter-toggle { display: none; }

@media (max-width: 768px) {
    html { scroll-padding-top: calc(72px + env(safe-area-inset-top)); }
    body { -webkit-text-size-adjust: 100%; }

    .mobile-topbar {
        height: calc(58px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
        padding-right: max(14px, env(safe-area-inset-right));
        padding-left: max(14px, env(safe-area-inset-left));
    }
    .mobile-menu-button,
    .mobile-sidebar-close { min-width: 44px; min-height: 44px; }
    .mobile-sidebar-close { top: calc(10px + env(safe-area-inset-top)); }
    .sidebar {
        width: min(88vw, 326px);
        padding-top: calc(22px + env(safe-area-inset-top));
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }
    .sidebar nav a { min-height: 46px; align-items: center; }
    .main {
        padding-top: calc(74px + env(safe-area-inset-top));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
        padding-left: max(12px, env(safe-area-inset-left));
    }

    .button { min-height: 44px; }
    .button.small { min-height: 40px; }
    .page-head h1,
    .ui-page-title-wrap h1 { overflow-wrap: anywhere; }
    .head-actions { gap: 8px; }

    /* Keep filters available without forcing users to scroll past a full form. */
    .mobile-filter-toggle { display: inline-flex; }
    .server-filter-card > .ui-section-head .ui-section-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 6px;
    }
    .server-filter-card.mobile-filter-collapsed .server-filter-form { display: none; }
    .server-filter-card.mobile-filter-collapsed > .ui-section-head { border-bottom: 0; }
    .server-filter-form { padding-top: 14px; }
    .server-tag-filter { min-width: 0; }
    .compact-tag-cloud {
        display: flex;
        max-height: 172px;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 2px;
    }

    /* Inventory rows are cards; keep frequent data compact and readable. */
    .server-list-card { overflow: visible; border: 0; background: transparent; box-shadow: none; }
    .server-list-card > .ui-section-head {
        margin-bottom: 10px;
        border: 1px solid var(--line);
        border-radius: 11px;
        background: #fff;
    }
    .server-table-scroll { overflow: visible; }
    .server-table-v2 tbody { gap: 12px; padding: 0; }
    .server-table-v2 tr {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        border-radius: 12px;
        box-shadow: 0 7px 20px rgba(20, 32, 55, .05);
    }
    .server-table-v2 td {
        min-width: 0;
        padding: 10px 12px;
        overflow-wrap: anywhere;
    }
    .server-table-v2 td::before { font-weight: 700; letter-spacing: .01em; }
    .server-table-v2 td[data-server-column="server"] {
        padding-top: 14px;
        padding-bottom: 12px;
        border-bottom-color: #dfe5ee;
    }
    .server-table-v2 td[data-server-column="server"] .server-link { font-size: 16px; line-height: 1.35; }
    .server-table-v2 td[data-server-column="server"]::before { display: none; }
    .server-table-v2 td[data-server-column="public_ip"] code,
    .server-table-v2 td[data-server-column="network"] code { white-space: normal; overflow-wrap: anywhere; }
    .server-table-v2 td[data-server-column="monitor"] { display: flex; flex-direction: column; align-items: flex-start; }
    .server-table-v2 td[data-server-column="checked"] > span,
    .server-table-v2 td[data-server-column="checked"] > small { white-space: normal; }
    .server-table-v2 .select-column { top: 16px; right: 54px; }
    .server-table-v2 .select-column input { width: 20px; height: 20px; }
    .server-table-v2 .row-actions-column { top: 9px; }
    .ui-row-menu > summary { width: 42px; height: 42px; }
    .ui-row-menu-panel {
        position: fixed;
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(12px + env(safe-area-inset-bottom));
        left: max(12px, env(safe-area-inset-left));
        z-index: 120;
        min-width: 0;
        padding: 8px;
        border-radius: 14px;
        box-shadow: 0 18px 55px rgba(15, 23, 42, .25);
    }
    .ui-row-menu-panel a,
    .ui-row-menu-panel button { min-height: 46px; padding: 12px 14px; }
    .server-list-footer { padding-right: 2px; padding-left: 2px; }
    .ui-pagination { flex-wrap: wrap; gap: 6px; }

    /* Server detail: prioritize console, reduce vertical waste and avoid clipping. */
    .server-detail-head .back-link { margin-bottom: 4px; }
    .server-detail-head .head-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .server-action-bar { overflow: hidden; }
    .server-action-body { gap: 10px; }
    .ipmi-visual-status { gap: 6px !important; }
    .oob-status-item {
        min-height: 78px;
        gap: 4px;
        padding: 8px 4px 7px;
        border-radius: 10px;
    }
    .oob-status-icon { width: 29px; height: 29px; flex-basis: 29px; }
    .oob-status-copy strong { overflow-wrap: anywhere; font-size: 11px; }
    .oob-status-dot { top: 6px; right: 6px; }
    .server-action-time { line-height: 1.45; }
    .server-primary-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .server-primary-actions .console-open-button { order: -1; }
    .server-primary-actions .button { min-height: 46px; }
    .server-action-feedback { min-width: 0; }
    .server-action-feedback > div,
    .compact-warning { overflow-wrap: anywhere; }

    .server-section-heading { min-width: 0; }
    .server-section-heading strong,
    .server-section-heading span { overflow-wrap: anywhere; white-space: normal; }
    .server-section-body { min-width: 0; }
    .details dd,
    .compact-details dd { min-width: 0; flex-wrap: wrap; overflow-wrap: anywhere; }
    .details dd code,
    .compact-details dd code { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
    .password-row dd .reveal-password { margin-left: auto; }
    .additional-ip-compact-item { min-width: 0; }
    .additional-ip-compact-item code { min-width: 0; white-space: normal; overflow-wrap: anywhere; }

    /* Four ranges always fit without horizontal scrolling. */
    .librenms-periods,
    .compact-periods {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
        gap: 6px;
    }
    .librenms-periods button,
    .compact-periods button {
        width: 100%;
        min-width: 0;
        min-height: 40px;
        padding-right: 5px;
        padding-left: 5px;
    }
    .compact-traffic-body { padding: 12px; }
    .compact-traffic-card.traffic-expanded .compact-graph-wrap,
    .librenms-graph-wrap { padding-right: 0; padding-left: 0; overflow: hidden; }
    .librenms-graph-stage { min-width: 0; }
    .librenms-svg-host .librenms-inline-svg { margin: 0; }

    .server-activity-grid { grid-template-columns: 1fr; padding: 12px; }
    .server-activity-item { grid-template-columns: 7px minmax(0, 1fr); }
    .server-activity-item > .audit-result { grid-column: 2; justify-self: start; }

    /* Dialogs become bottom sheets and remain above the mobile browser toolbar. */
    .ui-dialog,
    .column-dialog {
        width: 100vw;
        max-width: none;
        margin: auto 0 0;
        padding: 0;
        border-radius: 16px 16px 0 0;
    }
    .ui-dialog[open],
    .column-dialog[open] { position: fixed; inset: auto 0 0; }
    .ui-dialog-card { max-height: min(82dvh, 720px); border-radius: 16px 16px 0 0; }
    .ui-dialog-actions { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    .feishu-dialog-backdrop { align-items: end; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
    .feishu-dialog { width: 100%; max-width: none; border-radius: 16px; }
    .feishu-dialog-actions { grid-template-columns: 1fr 1fr; }

    .toast-container {
        right: max(10px, env(safe-area-inset-right));
        bottom: calc(12px + env(safe-area-inset-bottom));
        left: max(10px, env(safe-area-inset-left));
    }
    .toast { width: 100%; max-width: none; }
}

@media (max-width: 420px) {
    .main { padding-right: max(9px, env(safe-area-inset-right)); padding-left: max(9px, env(safe-area-inset-left)); }
    .ui-metric-grid.server-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ui-metric-card { min-width: 0; padding: 12px; }
    .ui-metric-card strong { font-size: 22px; }
    .ui-metric-card small { font-size: 10px; }
    .server-table-v2 tr { grid-template-columns: 1fr; }
    .server-table-v2 td[data-server-column] { grid-column: 1; }
    .server-primary-actions { grid-template-columns: 1fr; }
    .librenms-periods,
    .compact-periods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .head-actions,
    .server-detail-head .head-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) and (orientation: landscape) and (max-height: 520px) {
    .mobile-topbar { height: calc(50px + env(safe-area-inset-top)); }
    .main { padding-top: calc(62px + env(safe-area-inset-top)); }
    .sidebar nav a { min-height: 42px; }
    .tag-dialog,
    .ui-dialog-card { max-height: 90dvh; }
}

/* Mobile inventory refinement v2: minimal server cards and switch asset layouts. */
@media (max-width: 768px) {
    /* Desktop-only inventory management controls stay out of the mobile flow. */
    .server-list-desktop-action,
    .server-list-card .server-bulk-toolbar,
    .server-list-card .select-column { display: none !important; }
    .server-detail-head .server-delete-action,
    .mobile-destructive-action { display: none !important; }

    /* Reduce accidental double taps while keeping native scrolling responsive. */
    a, button, summary, .button { touch-action: manipulation; }

    /* Server cards: title, primary public IP and tags only. */
    .server-list-card .server-table-v2 tbody {
        gap: 10px;
        padding: 10px 0 0;
    }
    .server-list-card .server-table-v2 tr.server-card-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        overflow: hidden;
        border: 1px solid #dfe5ee;
        border-radius: 13px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(20, 32, 55, .045);
    }
    .server-list-card .server-table-v2 td[data-server-column="ipmi"],
    .server-list-card .server-table-v2 td[data-server-column="network"],
    .server-list-card .server-table-v2 td[data-server-column="monitor"],
    .server-list-card .server-table-v2 td[data-server-column="checked"],
    .server-list-card .server-table-v2 .server-card-actions,
    .server-list-card .server-table-v2 .select-column {
        display: none !important;
    }
    .server-list-card .server-table-v2 td[data-server-column="server"] {
        display: block !important;
        grid-column: 1;
        padding: 14px 15px 6px;
        border: 0;
    }
    .server-list-card .server-table-v2 td[data-server-column="server"]::before,
    .server-list-card .server-table-v2 td[data-server-column="tags"]::before {
        display: none;
    }
    .server-list-card .server-table-v2 td[data-server-column="server"] .server-link {
        font-size: 16px;
        font-weight: 750;
        line-height: 1.35;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .server-list-card .server-table-v2 .server-list-ipmi-address { display: none !important; }
    .server-list-card .server-table-v2 td[data-server-column="public_ip"] {
        display: block !important;
        grid-column: 1;
        min-height: 0;
        padding: 2px 15px 11px;
        border: 0;
    }
    .server-list-card .server-table-v2 td[data-server-column="public_ip"]::before {
        display: inline;
        margin: 0 7px 0 0;
        color: #98a2b3;
        font-size: 10px;
        font-weight: 700;
        content: "公网 IP";
    }
    .server-list-card .server-table-v2 td[data-server-column="public_ip"] code {
        font-size: 13px;
        font-weight: 650;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .server-list-card .server-table-v2 td[data-server-column="public_ip"] > small { display: none !important; }
    .server-list-card .server-table-v2 td[data-server-column="tags"] {
        display: block !important;
        grid-column: 1;
        padding: 10px 15px 13px;
        border-top: 1px solid #edf0f4;
        border-bottom: 0;
        background: #fbfcfe;
    }
    .server-list-card .server-tags-wrap { display: block; }
    .server-list-card .server-tag-cell {
        gap: 5px;
        max-height: none;
        overflow: visible;
    }
    .server-list-card .server-tag-cell .tag-badge,
    .server-list-card .server-tag-cell .tag-more {
        min-height: 22px;
        padding: 1px 7px;
        font-size: 11px;
    }
    .server-list-card .quick-tag-button { display: none !important; }

    /* Hide destructive controls on mobile asset detail pages. */
    .switch-detail-head .switch-delete-action { display: none !important; }

    /* Switch page header and search controls. */
    .switch-page-head,
    .switch-detail-head,
    .switch-import-head { gap: 12px; }
    .switch-page-head .head-actions,
    .switch-detail-head .head-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .switch-page-head .head-actions .button,
    .switch-detail-head .head-actions .button,
    .switch-detail-head .head-actions form { width: 100%; }
    .switch-detail-head .head-actions form .button { width: 100%; }
    .switch-search-card,
    .switch-import-search-card { padding: 14px; }
    .switch-search-card .search-form,
    .switch-import-search-form {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        width: 100%;
    }
    .switch-search-card .search-input-wrap,
    .switch-import-search-form .search-input-wrap,
    .switch-import-search-form select,
    .switch-search-card .button,
    .switch-import-search-form .button {
        width: 100%;
        min-width: 0;
    }
    .switch-search-card .result-count,
    .switch-import-search-card .result-count {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--line);
        line-height: 1.55;
        overflow-wrap: anywhere;
    }

    /* Switch list becomes compact tap-friendly cards. */
    .switch-list-card { border: 0; background: transparent; box-shadow: none; }
    .switch-list-scroll { overflow: visible; }
    .switch-list-table { min-width: 0; }
    .switch-list-table thead { display: none; }
    .switch-list-table tbody { display: grid; gap: 10px; }
    .switch-list-table tr.switch-card-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        border: 1px solid #dfe5ee;
        border-radius: 13px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(20, 32, 55, .045);
    }
    .switch-list-table td {
        display: block;
        min-width: 0;
        padding: 9px 13px;
        border-bottom: 1px solid #edf0f4;
        overflow-wrap: anywhere;
    }
    .switch-list-table td::before {
        display: block;
        margin-bottom: 2px;
        color: var(--muted);
        font-size: 9px;
        font-weight: 700;
        content: attr(data-mobile-label);
    }
    .switch-list-table td[data-switch-column="name"] {
        grid-column: 1 / -1;
        padding: 13px 14px 8px;
        border-bottom: 0;
    }
    .switch-list-table td[data-switch-column="name"]::before { display: none; }
    .switch-list-table td[data-switch-column="name"] .server-link {
        font-size: 16px;
        line-height: 1.35;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .switch-list-table td[data-switch-column="model"],
    .switch-list-table td[data-switch-column="management_ip"] { padding-top: 6px; }
    .switch-list-table td[data-switch-column="source"],
    .switch-list-table td[data-switch-column="updated"],
    .switch-list-table .switch-row-actions { display: none !important; }
    .switch-list-table td[data-switch-column="servers"],
    .switch-list-table td[data-switch-column="ports"] {
        border-bottom: 0;
        background: #fbfcfe;
    }

    /* Import page: remove table overflow and align controls/cards. */
    .switch-import-card { border: 0; background: transparent; box-shadow: none; }
    .switch-import-scroll { overflow: visible; }
    .switch-import-table { min-width: 0; }
    .switch-import-table thead { display: none; }
    .switch-import-table tbody { display: grid; gap: 10px; }
    .switch-import-table tr.switch-import-row {
        position: relative;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        border: 1px solid #dfe5ee;
        border-radius: 13px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(20, 32, 55, .045);
    }
    .switch-import-table td {
        display: block;
        min-width: 0;
        padding: 9px 13px;
        border-bottom: 1px solid #edf0f4;
        overflow-wrap: anywhere;
    }
    .switch-import-table td::before {
        display: block;
        margin-bottom: 2px;
        color: var(--muted);
        font-size: 9px;
        font-weight: 700;
        content: attr(data-mobile-label);
    }
    .switch-import-table .checkbox-cell {
        position: absolute;
        z-index: 2;
        top: 11px;
        right: 11px;
        width: 28px;
        padding: 0;
        border: 0;
    }
    .switch-import-table .checkbox-cell::before { display: none; }
    .switch-import-table .checkbox-cell input { width: 21px; height: 21px; }
    .switch-import-table td[data-import-column="device"] {
        grid-column: 1 / -1;
        padding: 13px 48px 9px 13px;
    }
    .switch-import-table td[data-import-column="device"]::before { display: none; }
    .switch-import-table td[data-import-column="device"] strong {
        display: block;
        font-size: 15px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }
    .switch-import-table td[data-import-column="device"] .table-subtext,
    .switch-import-table td[data-import-column="model"] .table-subtext {
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .switch-import-table td[data-import-column="location"] { display: none; }
    .switch-import-table td[data-import-column="import_state"] {
        grid-column: 1 / -1;
        border-bottom: 0;
        background: #fbfcfe;
    }
    .switch-import-form .bulk-action-bar {
        position: sticky;
        z-index: 20;
        bottom: calc(8px + env(safe-area-inset-bottom));
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 12px;
        padding: 11px;
        border: 1px solid #dfe5ee;
        border-radius: 12px;
        background: rgba(255,255,255,.97);
        box-shadow: 0 12px 30px rgba(16, 24, 40, .14);
        backdrop-filter: blur(10px);
    }
    .switch-import-form .bulk-action-bar span { font-size: 11px; line-height: 1.45; }
    .switch-import-form .bulk-action-bar .button { width: 100%; min-height: 44px; }

    /* Switch detail cards and attached servers. */
    .switch-detail-grid { gap: 12px; }
    .switch-detail-grid .detail-card { padding: 16px; }
    .switch-detail-grid .details > div { padding: 10px 0; }
    .switch-servers-card .card-section-head { padding: 14px; }
    .switch-server-scroll { overflow: visible; }
    .switch-server-table { min-width: 0; }
    .switch-server-table thead { display: none; }
    .switch-server-table tbody { display: grid; gap: 9px; padding: 10px; }
    .switch-server-table tr.switch-server-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        border: 1px solid #e1e6ed;
        border-radius: 11px;
        background: #fff;
    }
    .switch-server-table td {
        display: block;
        min-width: 0;
        padding: 9px 11px;
        border-bottom: 1px solid #edf0f4;
        overflow-wrap: anywhere;
    }
    .switch-server-table td::before {
        display: block;
        margin-bottom: 2px;
        color: var(--muted);
        font-size: 9px;
        font-weight: 700;
        content: attr(data-mobile-label);
    }
    .switch-server-table td[data-switch-server-column="server"] {
        grid-column: 1 / -1;
        padding-top: 11px;
    }
    .switch-server-table td[data-switch-server-column="server"] .server-link {
        font-size: 14px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .switch-server-table td[data-switch-server-column="port"],
    .switch-server-table td[data-switch-server-column="public_ip"] { border-bottom: 0; }
    .switch-server-table td[data-switch-server-column="ipmi"],
    .switch-server-table td[data-switch-server-column="updated"],
    .switch-server-table td[data-switch-server-column="tags"],
    .switch-server-table .switch-server-actions { display: none !important; }
}

@media (max-width: 420px) {
    .switch-page-head .head-actions,
    .switch-detail-head .head-actions { grid-template-columns: 1fr; }
    .switch-list-table tr.switch-card-row,
    .switch-import-table tr.switch-import-row,
    .switch-server-table tr.switch-server-row { grid-template-columns: 1fr; }
    .switch-list-table td[data-switch-column],
    .switch-import-table td[data-import-column],
    .switch-server-table td[data-switch-server-column] { grid-column: 1; }
    .switch-import-table td[data-import-column="device"],
    .switch-import-table td[data-import-column="import_state"],
    .switch-server-table td[data-switch-server-column="server"] { grid-column: 1; }
}

/* Mobile administration refinement: eliminate remaining wide tables and risky actions. */
@media (max-width: 768px) {
    /* Server CSV preview becomes a readable card list instead of a 1040px table. */
    .import-preview-scroll {
        margin: 10px 14px 14px;
        overflow: visible;
        border: 0;
        border-radius: 0;
    }
    .import-preview-table,
    .import-preview-table tbody { display: block; width: 100%; min-width: 0; }
    .import-preview-table thead { display: none; }
    .import-preview-table tbody { display: grid; gap: 10px; }
    .import-preview-table tr.server-import-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        border: 1px solid #dfe5ee;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(20, 32, 55, .045);
    }
    .import-preview-table tr.server-import-row.has-error { border-color: #f1b7b2; background: #fff; }
    .import-preview-table td {
        display: block;
        min-width: 0;
        padding: 9px 12px;
        border-bottom: 1px solid #edf0f4;
        overflow-wrap: anywhere;
    }
    .import-preview-table td::before {
        display: block;
        margin-bottom: 3px;
        color: var(--muted);
        font-size: 9px;
        font-weight: 700;
        content: attr(data-mobile-label);
    }
    .import-preview-table td[data-import-preview-column="server"],
    .import-preview-table td[data-import-preview-column="validation"] { grid-column: 1 / -1; }
    .import-preview-table td[data-import-preview-column="server"] {
        order: -2;
        padding-top: 12px;
        font-size: 14px;
    }
    .import-preview-table td[data-import-preview-column="validation"] {
        border-bottom: 0;
        background: #fbfcfe;
    }
    .import-preview-table td[data-import-preview-column="switch"],
    .import-preview-table td[data-import-preview-column="tags"],
    .import-preview-table td[data-import-preview-column="password"] { display: none; }
    .import-preview-table .import-row-errors { max-width: none; white-space: normal; }

    /* Backup archives become compact cards; restore/delete remain desktop-only. */
    .backup-list-card .table-scroll { overflow: visible; }
    .backup-table,
    .backup-table tbody { display: block; width: 100%; min-width: 0; }
    .backup-table thead { display: none; }
    .backup-table tbody { display: grid; gap: 10px; padding: 10px 0 0; }
    .backup-table tr.backup-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        border: 1px solid #dfe5ee;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(20, 32, 55, .045);
    }
    .backup-table td {
        display: block;
        min-width: 0;
        padding: 9px 12px;
        border-bottom: 1px solid #edf0f4;
        overflow-wrap: anywhere;
    }
    .backup-table td::before {
        display: block;
        margin-bottom: 3px;
        color: var(--muted);
        font-size: 9px;
        font-weight: 700;
        content: attr(data-mobile-label);
    }
    .backup-table td[data-backup-column="created"],
    .backup-table td[data-backup-column="note"],
    .backup-table td[data-backup-column="actions"] { grid-column: 1 / -1; }
    .backup-table td[data-backup-column="created"] {
        padding-top: 12px;
        font-weight: 700;
    }
    .backup-table td[data-backup-column="version"],
    .backup-table td[data-backup-column="database"] { display: none; }
    .backup-table td[data-backup-column="actions"] { border-bottom: 0; background: #fbfcfe; }
    .backup-table .backup-actions { display: flex; align-items: stretch; }
    .backup-table .backup-actions > a { width: 100%; min-height: 42px; }

    /* Tag management becomes editable cards with a single safe Save action. */
    .tag-create-form { grid-template-columns: 1fr; }
    .tag-management-table,
    .tag-management-table tbody { display: block; width: 100%; min-width: 0; }
    .tag-management-table colgroup,
    .tag-management-table thead { display: none; }
    .tag-management-table tbody { display: grid; gap: 10px; }
    .tag-management-table tr.tag-management-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        padding: 0;
        border: 1px solid #dfe5ee;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(20, 32, 55, .045);
    }
    .tag-management-table td {
        display: block;
        min-width: 0;
        padding: 9px 12px;
        border-bottom: 1px solid #edf0f4;
        text-align: left !important;
        white-space: normal;
    }
    .tag-management-table td::before {
        display: block;
        margin-bottom: 4px;
        color: var(--muted);
        font-size: 9px;
        font-weight: 700;
        content: attr(data-mobile-label);
    }
    .tag-management-table td[data-tag-column="preview"],
    .tag-management-table td[data-tag-column="name"],
    .tag-management-table td[data-tag-column="color"],
    .tag-management-table td[data-tag-column="actions"] { grid-column: 1 / -1; }
    .tag-management-table td[data-tag-column="preview"] { padding-top: 12px; border-bottom: 0; }
    .tag-management-table td[data-tag-column="preview"]::before { display: none; }
    .tag-management-table input:not([type="checkbox"]),
    .tag-management-table select,
    .tag-management-table .order-input { width: 100%; min-width: 0; }
    .tag-management-table .table-check { justify-content: flex-start; width: 44px; min-height: 34px; }
    .tag-management-table td[data-tag-column="actions"] { border-bottom: 0; background: #fbfcfe; }
    .tag-management-table td[data-tag-column="actions"] .button:not(.mobile-destructive-action) { width: 100%; min-height: 42px; }

    /* Destructive list operations require a desktop-sized confirmation workflow. */
    .access-table td.actions .mobile-destructive-action,
    .librenms-instance-operations .mobile-destructive-action { display: none !important; }
}

@media (max-width: 420px) {
    .import-preview-table tr.server-import-row,
    .backup-table tr.backup-row,
    .tag-management-table tr.tag-management-row { grid-template-columns: 1fr; }
    .import-preview-table td[data-import-preview-column],
    .backup-table td[data-backup-column],
    .tag-management-table td[data-tag-column] { grid-column: 1; }
    .import-preview-table td[data-import-preview-column="server"],
    .import-preview-table td[data-import-preview-column="validation"],
    .backup-table td[data-backup-column="created"],
    .backup-table td[data-backup-column="note"],
    .backup-table td[data-backup-column="actions"],
    .tag-management-table td[data-tag-column="preview"],
    .tag-management-table td[data-tag-column="name"],
    .tag-management-table td[data-tag-column="color"],
    .tag-management-table td[data-tag-column="actions"] { grid-column: 1; }
}


/* Mobile scope reduction: role and tag administration remain desktop-only. */
@media (max-width: 760px) {
    .mobile-admin-hidden {
        display: none !important;
    }
}


/* DCIM 2.1.17 mobile usability pass */
@media (max-width: 768px) {
    html, body { max-width: 100%; overscroll-behavior-x: none; }
    body { -webkit-tap-highlight-color: transparent; }

    .mobile-brand { flex: 1 1 auto; }
    .mobile-brand-copy {
        display: flex;
        min-width: 0;
        flex-direction: column;
        justify-content: center;
        line-height: 1.12;
    }
    .mobile-brand-copy strong {
        max-width: min(62vw, 330px);
        overflow: hidden;
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-brand-copy small {
        margin-top: 2px;
        color: #98a2b3;
        font-size: 9px;
        font-weight: 700;
        letter-spacing: .08em;
    }

    /* Prevent iOS auto-zoom and keep every form control touch-friendly. */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea { min-height: 44px; font-size: 16px; }
    input[type="checkbox"],
    input[type="radio"] { min-width: 20px; min-height: 20px; }

    .ui-metric-grid.server-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .server-stat-grid .ui-metric-card { min-height: 92px; padding: 12px; }
    .server-stat-grid .ui-metric-card small {
        display: -webkit-box;
        overflow: hidden;
        line-height: 1.35;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    /* The title/IP/tags card is the mobile navigation target. */
    [data-mobile-card-href] { cursor: pointer; -webkit-user-select: none; user-select: none; }
    [data-mobile-card-href]:active { transform: scale(.992); }
    .server-list-card .server-table-v2 tr.server-card-row,
    .switch-list-table tr.switch-card-row,
    .switch-server-table tr.switch-server-row {
        position: relative;
        transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    }
    .server-list-card .server-table-v2 tr.server-card-row::after,
    .switch-list-table tr.switch-card-row::after,
    .switch-server-table tr.switch-server-row::after {
        position: absolute;
        top: 16px;
        right: 14px;
        color: #b0b8c4;
        font-size: 20px;
        line-height: 1;
        content: "›";
        pointer-events: none;
    }
    .server-list-card .server-table-v2 td[data-server-column="server"] { padding-right: 40px; }
    .server-list-card .server-table-v2 td[data-server-column="public_ip"]::before { content: none; }
    .server-list-card .server-table-v2 td[data-server-column="public_ip"] code {
        color: #667085;
        font-size: 13px;
        font-weight: 600;
    }
    .server-list-card .server-card-tags.is-empty { display: none !important; }
    .server-list-card .server-tag-cell {
        display: flex;
        max-height: 51px;
        flex-wrap: wrap;
        overflow: hidden;
    }
    .server-list-card > .ui-section-head { padding: 12px 14px; }
    .server-list-range { font-variant-numeric: tabular-nums; }
    .server-list-footer > span { display: none; }
    .server-list-footer { padding: 12px 0 0; border-top: 0; }
    .server-list-footer .ui-pagination { width: 100%; justify-content: center; }
    .server-list-footer .ui-pagination a,
    .server-list-footer .ui-pagination span { min-height: 40px; }

    /* Mobile opens traffic on demand, avoiding a large graph and request on every detail view. */
    .compact-traffic-card:not(.mobile-traffic-initialized) .compact-periods,
    .compact-traffic-card:not(.mobile-traffic-initialized) .compact-graph-wrap,
    .compact-traffic-card:not(.traffic-expanded) .compact-periods,
    .compact-traffic-card:not(.traffic-expanded) .compact-graph-wrap { display: none !important; }
    .compact-traffic-card.traffic-expanded .compact-periods { display: grid !important; }
    .compact-traffic-card.traffic-expanded .compact-graph-wrap {
        display: block !important;
        width: 100%;
        min-width: 0;
        overflow: hidden !important;
    }
    .compact-traffic-card.traffic-expanded .librenms-inline-svg {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-width: 0;
    }
    .compact-traffic-card .librenms-graph-loading,
    .compact-traffic-card .librenms-graph-error { min-height: 168px; }
    .compact-traffic-card .compact-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .compact-traffic-card .compact-metrics > div { min-width: 0; padding: 10px; }
    .compact-traffic-card .compact-metrics strong { overflow-wrap: anywhere; }

    /* More predictable detail rows and action buttons on narrow screens. */
    .server-section-head { gap: 10px; }
    .server-section-head > .button { flex: 0 0 auto; }
    .details dd .copy-icon-button,
    .compact-details dd .copy-icon-button { flex: 0 0 36px; }
    .network-empty-state { align-items: flex-start; }
    .network-empty-state-action { width: 100%; justify-content: center; }
    .notes-preview { overflow-wrap: anywhere; }

    .switch-list-table td[data-switch-column="name"] { padding-right: 42px; }
    .switch-server-table td[data-switch-server-column="server"] { padding-right: 42px; }
    .switch-import-form .bulk-action-bar {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 420px) {
    .mobile-brand-copy strong { max-width: 58vw; }
    .page-head h1 { font-size: 20px; }
    .server-detail-head .head-actions,
    .head-actions { grid-template-columns: 1fr; }
    .server-primary-actions { grid-template-columns: 1fr; }
    .compact-traffic-card .compact-metrics { grid-template-columns: 1fr 1fr; }
}

/* DCIM 2.1.18 alignment and mobile administration fixes. */

/* Keep the server-list accent bar inside the reserved header gutter. */
.server-list-card > .ui-section-head {
    padding-left: 34px;
}
.server-list-card > .ui-section-head::before {
    top: 16px;
    bottom: 16px;
    left: 20px;
    width: 4px;
}

/* Audit filters are intentionally collapsed by default on every viewport. */
.audit-filter-card.is-collapsed > .audit-filter-grid {
    display: none;
}
.audit-filter-card.is-collapsed > .ui-section-head {
    border-bottom-color: transparent;
}
.audit-filter-toggle {
    flex: 0 0 auto;
}
.audit-filter-active-state {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 3px 9px;
    border: 1px solid #b9cef7;
    border-radius: 999px;
    color: #245bdb;
    background: #f2f6ff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* One authoritative desktop audit-table geometry. */
.audit-table-shell {
    margin: 14px 18px 0;
}
.audit-table-shell .table-scroll {
    width: 100%;
    overflow-x: auto;
}
.audit-table-shell .audit-table {
    width: 100%;
    min-width: 1040px;
    table-layout: fixed;
    border-collapse: collapse;
}
.audit-table-shell .audit-table th,
.audit-table-shell .audit-table td {
    box-sizing: border-box;
    width: auto !important;
    height: auto;
    padding: 10px 12px;
    vertical-align: middle;
}
.audit-table-shell .audit-table col.audit-col-time { width: 15%; }
.audit-table-shell .audit-table col.audit-col-user { width: 9%; }
.audit-table-shell .audit-table col.audit-col-action { width: 16%; }
.audit-table-shell .audit-table col.audit-col-resource { width: 24%; }
.audit-table-shell .audit-table col.audit-col-result { width: 9%; }
.audit-table-shell .audit-table col.audit-col-risk { width: 7%; }
.audit-table-shell .audit-table col.audit-col-ip { width: 14%; }
.audit-table-shell .audit-table col.audit-col-more { width: 6%; }
.audit-table-shell .audit-table th:last-child,
.audit-table-shell .audit-table td:last-child {
    padding-right: 12px;
    padding-left: 12px;
    text-align: center;
}
.audit-table-shell .audit-table td > strong,
.audit-table-shell .audit-table td code,
.audit-table-shell .audit-action-link,
.audit-table-shell .audit-resource-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* LibreNMS summary counters use identical boxes and baselines. */
.librenms-instance-summary-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(92px, auto));
    align-items: stretch;
    justify-content: end;
    gap: 7px;
}
.librenms-instance-summary-stats > span,
.librenms-instance-summary-stats > .instance-test-state {
    display: inline-flex;
    min-height: 28px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 650;
    line-height: 18px;
    white-space: nowrap;
}
.librenms-instance-summary-stats > span:not(.instance-test-state) {
    color: #536077;
    border-color: #e4e8ef;
    background: #f3f5f8;
}

/* Mobile quota action is rendered beside the quota, rather than being lost in the table action cell. */
.mobile-user-quota-reset {
    display: none;
    margin: 7px 0 0;
}
.mobile-user-quota-reset .user-row-button:disabled {
    opacity: .58;
    cursor: default;
}

@media (max-width: 768px) {
    .server-list-card > .ui-section-head {
        min-height: 60px;
        padding: 12px 14px 12px 30px;
    }
    .server-list-card > .ui-section-head::before {
        top: 14px;
        bottom: 14px;
        left: 14px;
        width: 4px;
    }

    .audit-filter-card > .ui-section-head {
        align-items: center;
        flex-direction: row;
        padding-right: 14px;
    }
    .audit-filter-card .ui-section-actions {
        width: auto;
        justify-content: flex-end;
    }
    .audit-filter-active-state {
        display: none;
    }

    /* Undo later desktop table declarations that previously forced a 960px table on phones. */
    .audit-table-shell {
        margin: 10px 0 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    .audit-table-shell .table-scroll {
        overflow: visible;
    }
    .audit-table-shell .audit-table,
    .audit-table-shell .audit-table tbody {
        display: block;
        width: 100%;
        min-width: 0 !important;
    }
    .audit-table-shell .audit-table colgroup,
    .audit-table-shell .audit-table thead {
        display: none;
    }
    .audit-table-shell .audit-table tbody {
        display: grid;
        gap: 10px;
    }
    .audit-table-shell .audit-table tr {
        display: block;
        width: auto;
        margin: 0;
        padding: 11px 13px;
        overflow: hidden;
        border: 1px solid #dfe5ee;
        border-radius: 11px;
        background: #fff;
        box-shadow: 0 4px 14px rgba(20, 32, 55, .04);
    }
    .audit-table-shell .audit-table tr.is-selected {
        border-color: #a9c1ff;
        box-shadow: inset 3px 0 0 var(--audit-blue), 0 4px 14px rgba(20, 32, 55, .04);
    }
    .audit-table-shell .audit-table td,
    .audit-table-shell .audit-table td:last-child {
        display: grid;
        width: 100% !important;
        min-width: 0;
        grid-template-columns: 76px minmax(0, 1fr);
        align-items: start;
        gap: 10px;
        padding: 4px 0 !important;
        border: 0;
        text-align: left;
    }
    .audit-table-shell .audit-table td::before {
        display: block;
        color: var(--muted);
        font-size: 10px;
        font-weight: 700;
        line-height: 1.5;
        content: attr(data-label);
    }
    .audit-table-shell .audit-table td.audit-more {
        display: none;
    }
    .audit-table-shell .audit-table td > strong,
    .audit-table-shell .audit-table td code,
    .audit-table-shell .audit-action-link,
    .audit-table-shell .audit-resource-name {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .librenms-instance-card > summary {
        gap: 13px;
    }
    .librenms-instance-summary-main {
        width: 100%;
    }
    .librenms-instance-summary-stats {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        justify-content: stretch;
    }
    .librenms-instance-summary-stats > span,
    .librenms-instance-summary-stats > .instance-test-state {
        width: 100%;
        min-width: 0;
        padding-right: 5px;
        padding-left: 5px;
        text-align: center;
    }

    .desktop-user-quota-reset {
        display: none !important;
    }
    .mobile-user-quota-reset {
        display: block;
        width: 100%;
    }
    .mobile-user-quota-reset .user-row-button {
        width: 100%;
        min-height: 40px;
    }
}

@media (max-width: 390px) {
    .audit-filter-card > .ui-section-head {
        align-items: stretch;
        flex-direction: column;
        padding-left: 30px;
    }
    .audit-filter-card .ui-section-actions,
    .audit-filter-card .audit-filter-toggle {
        width: 100%;
    }
    .librenms-instance-summary-stats {
        gap: 5px;
    }
    .librenms-instance-summary-stats > span,
    .librenms-instance-summary-stats > .instance-test-state {
        font-size: 10px;
    }
}


@media (max-width: 768px) {
    .audit-table-shell .audit-table td:nth-child(6) {
        text-align: left;
    }
    .audit-table-shell .audit-table td:nth-child(6) .risk-badge {
        width: auto;
        min-width: 34px;
        justify-self: start;
    }
}

/* DCIM 2.1.19 unified desktop Popover Select */
.dcim-select {
    position: relative;
    display: inline-flex;
    width: 100%;
    min-width: 0;
    vertical-align: middle;
}
.dcim-select-source {
    position: absolute !important;
    top: 50% !important;
    left: 10px !important;
    width: 1px !important;
    min-width: 1px !important;
    height: 1px !important;
    min-height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip-path: inset(50%) !important;
}
.dcim-select-trigger {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 11px;
    border: 1px solid #cfd6e2;
    border-radius: 9px;
    color: var(--text);
    background: linear-gradient(180deg, #fff 0%, #fdfefe 100%);
    box-shadow: 0 1px 2px rgba(20, 32, 55, .025);
    outline: none;
    cursor: pointer;
    text-align: left;
    transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.dcim-select-trigger:hover {
    border-color: #aeb9c9;
    background: #fff;
}
.dcim-select-trigger:focus-visible,
.dcim-select.is-open .dcim-select-trigger {
    border-color: #6f91e8;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10), 0 1px 2px rgba(20, 32, 55, .04);
}
.dcim-select-trigger.is-invalid {
    border-color: #e2776d;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .10);
}
.dcim-select.is-disabled .dcim-select-trigger,
.dcim-select-trigger:disabled {
    color: #98a2b3;
    border-color: #e1e5eb;
    background: #f5f6f8;
    box-shadow: none;
    cursor: not-allowed;
}
.dcim-select-value {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 5px;
    overflow: hidden;
}
.dcim-select-single-value,
.dcim-select-placeholder {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dcim-select-value.is-placeholder,
.dcim-select-placeholder { color: #98a2b3; }
.dcim-select-chip {
    display: block;
    max-width: min(160px, 44%);
    flex: 0 1 auto;
    padding: 2px 7px;
    overflow: hidden;
    border: 1px solid #dbe5fb;
    border-radius: 6px;
    color: #315ea8;
    background: #f2f6ff;
    font-size: 12px;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dcim-select-chip.is-count {
    max-width: none;
    flex: 0 0 auto;
    color: #667085;
    border-color: #e1e5eb;
    background: #f7f8fa;
}
.dcim-select-arrow {
    display: grid;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    place-items: center;
    color: #7b8799;
    transition: transform .16s ease, color .16s ease;
}
.dcim-select-arrow svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.dcim-select.is-open .dcim-select-arrow {
    color: #315ea8;
    transform: rotate(180deg);
}
.dcim-select-panel {
    position: fixed;
    z-index: 1300;
    display: flex;
    min-width: 220px;
    flex-direction: column;
    padding: 6px;
    overflow: hidden;
    border: 1px solid rgba(205, 213, 225, .95);
    border-radius: 11px;
    background: rgba(255, 255, 255, .985);
    box-shadow: 0 14px 34px rgba(20, 32, 55, .14), 0 3px 10px rgba(20, 32, 55, .07);
    transform-origin: top center;
    animation: dcim-select-enter .14s cubic-bezier(.2, .8, .2, 1);
    backdrop-filter: blur(12px);
}
.dcim-select-panel.opens-upward {
    transform-origin: bottom center;
    animation-name: dcim-select-enter-up;
}
.dcim-select-panel[hidden] { display: none !important; }
@keyframes dcim-select-enter {
    from { opacity: 0; transform: translateY(-3px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dcim-select-enter-up {
    from { opacity: 0; transform: translateY(3px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.dcim-select-search-wrap {
    position: relative;
    flex: 0 0 auto;
    padding: 2px 2px 7px;
}
.dcim-select-search-wrap[hidden] { display: none; }
.dcim-select-search-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    display: grid;
    width: 16px;
    height: 16px;
    place-items: center;
    color: #98a2b3;
    transform: translateY(-64%);
    pointer-events: none;
}
.dcim-select-search-icon svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
}
.dcim-select-search {
    width: 100% !important;
    min-height: 34px !important;
    padding: 6px 9px 6px 32px !important;
    border-color: #e0e5ec !important;
    border-radius: 7px !important;
    background: #f7f8fa !important;
    box-shadow: none !important;
    font-size: 13px !important;
}
.dcim-select-search:focus {
    border-color: #94ace8 !important;
    background: #fff !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .08) !important;
}
.dcim-select-options {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cfd6e2 transparent;
}
.dcim-select-group-label {
    padding: 7px 10px 4px;
    color: #98a2b3;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.dcim-select-option {
    display: grid;
    width: 100%;
    min-height: 36px;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    color: #273248;
    background: transparent;
    outline: none;
    cursor: pointer;
    text-align: left;
    transition: color .1s ease, background .1s ease;
}
.dcim-select-option:hover,
.dcim-select-option.is-active {
    color: #172033;
    background: #f3f5f8;
}
.dcim-select-option.is-selected {
    color: #1f55ad;
    background: #f2f6ff;
}
.dcim-select-option.is-selected.is-active,
.dcim-select-option.is-selected:hover { background: #eaf1ff; }
.dcim-select-option.is-disabled {
    color: #a8b0bd;
    background: transparent;
    cursor: not-allowed;
}
.dcim-select-check {
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: transparent;
}
.dcim-select-check svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.dcim-select-option.is-selected .dcim-select-check { color: #2f65c7; }
.dcim-select-option-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.35;
}
.dcim-select-option-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dcim-select-option-copy small {
    margin-top: 2px;
    overflow: hidden;
    color: #8a95a6;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dcim-select-empty {
    padding: 24px 12px;
    color: #98a2b3;
    font-size: 12px;
    text-align: center;
}
.dcim-select-empty[hidden] { display: none; }
.dcim-select.is-small .dcim-select-trigger,
.server-bulk-toolbar .dcim-select-trigger {
    min-height: 34px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-radius: 8px;
    font-size: 12px;
}
.search-form-wide .dcim-select { width: min(320px, 32vw); }
.tag-filter-heading .dcim-select { width: auto; min-width: 170px; }
.tag-management-table .dcim-select { min-width: 120px; }
.server-bulk-toolbar .dcim-select { width: 180px; }
.install-domain-row .dcim-select { width: 100%; }
.switch-import-search-form .dcim-select { width: auto; min-width: 190px; }
.assignment-row .dcim-select { min-width: 0; }

@media (max-width: 768px) {
    /* JS destroys enhanced instances at this breakpoint; these are defensive only. */
    .dcim-select { display: contents; }
    .dcim-select-trigger { display: none; }
    .dcim-select-source {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        min-height: 44px !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        clip-path: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dcim-select-panel { animation: none; }
    .dcim-select-arrow,
    .dcim-select-trigger { transition: none; }
}

/* DCIM 2.1.20 switch/port clarity and network row alignment */
.switch-server-switch-name {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 5px;
    color: #667085;
}
.switch-server-switch-name > span {
    flex: 0 0 auto;
    color: #98a2b3;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .01em;
}

/* Keep both labels and both values on one shared row grid. */
.network-connection-details {
    --network-connection-label-width: 104px;
}
.network-connection-details > .network-connection-row {
    grid-template-columns: var(--network-connection-label-width) minmax(0, 1fr);
    align-items: center;
    min-height: 44px;
    column-gap: 12px;
    padding: 8px 0;
}
.network-connection-details > .network-connection-row > dt,
.network-connection-details > .network-connection-row > dd {
    min-height: 28px;
    margin: 0;
    align-items: center;
    line-height: 20px;
}
.network-connection-details > .network-connection-row > dt {
    display: flex;
}
.network-connection-details .network-connection-value {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 28px;
    align-items: center;
    gap: 8px;
}
.network-connection-details .network-connection-text {
    display: inline-flex;
    min-width: 0;
    min-height: 28px;
    align-items: center;
    margin: 0;
    padding: 0;
    line-height: 20px;
    vertical-align: middle;
}
.network-connection-details .network-port-value > .port-status-light {
    width: 18px;
    height: 28px;
    flex: 0 0 18px;
    margin: 0;
    align-self: center;
}

@media (max-width: 768px) {
    .switch-server-switch-name {
        justify-content: flex-start;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .network-connection-details {
        --network-connection-label-width: 1fr;
    }
    .network-connection-details > .network-connection-row {
        grid-template-columns: 1fr;
        align-items: start;
        min-height: 0;
        row-gap: 5px;
        padding: 12px 0;
    }
    .network-connection-details > .network-connection-row > dt,
    .network-connection-details > .network-connection-row > dd {
        min-height: 0;
    }
    .network-connection-details .network-connection-value,
    .network-connection-details .network-connection-text {
        min-height: 34px;
    }
}

/* DCIM 2.2.1 Stable — global search */
.sidebar-global-search {
    display: flex;
    width: calc(100% - 12px);
    min-height: 38px;
    align-items: center;
    gap: 9px;
    margin: 18px 6px 0;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 8px;
    color: #c9d5e6;
    background: rgba(255,255,255,.045);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.sidebar-global-search:hover,
.sidebar-global-search:focus-visible { border-color: rgba(124,158,255,.42); color: #fff; background: rgba(78,112,176,.16); outline: none; }
.sidebar-global-search svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.sidebar-global-search span { min-width: 0; flex: 1; text-align: left; font-size: 12px; font-weight: 600; }
.sidebar-global-search kbd { padding: 2px 5px; border: 1px solid rgba(255,255,255,.12); border-radius: 5px; color: #8193ad; background: rgba(0,0,0,.12); font: 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; }
.sidebar-global-search + nav { margin-top: 14px; }
.mobile-global-search-button { display: none; }

body.global-search-open { overflow: hidden; }
.global-search-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: min(13vh, 112px) 18px 24px;
    opacity: 0;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(3px);
    transition: opacity .14s ease;
}
.global-search-backdrop[hidden] { display: none; }
.global-search-backdrop.is-open { opacity: 1; }
.global-search-dialog {
    width: min(680px, 100%);
    overflow: hidden;
    border: 1px solid rgba(208, 213, 221, .9);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 28px 90px rgba(15,23,42,.26);
    transform: translateY(-8px) scale(.985);
    transition: transform .16s ease;
}
.global-search-backdrop.is-open .global-search-dialog { transform: translateY(0) scale(1); }
.global-search-input-row { display: flex; height: 58px; align-items: center; gap: 11px; padding: 0 16px; border-bottom: 1px solid #eaecf0; }
.global-search-input-row > svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: #667085; stroke-width: 1.8; stroke-linecap: round; }
.global-search-input-row input { min-width: 0; height: auto; flex: 1; padding: 0; border: 0; outline: 0; box-shadow: none; color: #101828; background: transparent; font-size: 15px; }
.global-search-input-row input:focus { border: 0; box-shadow: none; }
.global-search-input-row kbd,
.global-search-footer kbd { padding: 2px 6px; border: 1px solid #d9dee8; border-bottom-color: #c8ced9; border-radius: 5px; color: #667085; background: #f8fafc; font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; box-shadow: 0 1px 0 rgba(16,24,40,.06); }
.global-search-body { max-height: min(58vh, 500px); overflow-y: auto; padding: 8px; }
.global-search-empty { display: grid; min-height: 160px; place-content: center; gap: 5px; padding: 24px; color: #667085; text-align: center; }
.global-search-empty strong { color: #344054; font-size: 14px; }
.global-search-empty span { font-size: 12px; }
.global-search-empty.is-error strong { color: #b42318; }
.global-search-group + .global-search-group { margin-top: 7px; padding-top: 7px; border-top: 1px solid #f0f2f5; }
.global-search-group-title { padding: 5px 9px 6px; color: #98a2b3; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.global-search-result { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 50px; padding: 7px 9px; border-radius: 8px; color: inherit; text-decoration: none; transition: background-color .1s ease; }
.global-search-result:hover,
.global-search-result.is-active { color: inherit; background: #f2f6ff; text-decoration: none; }
.global-search-result-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 8px; color: #3370ff; background: #eef4ff; }
.global-search-result-icon.is-switch { color: #6941c6; background: #f4f3ff; }
.global-search-result-icon.is-tag { color: #027a48; background: #ecfdf3; }
.global-search-result-icon.is-user { color: #b54708; background: #fffaeb; }
.global-search-result-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.global-search-result-copy { min-width: 0; }
.global-search-result-copy strong,
.global-search-result-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result-copy strong { color: #101828; font-size: 13px; font-weight: 650; }
.global-search-result-copy small { margin-top: 2px; color: #7b8798; font-size: 11px; }
.global-search-result-meta { max-width: 120px; overflow: hidden; color: #98a2b3; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.global-search-footer { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-height: 38px; padding: 7px 14px; border-top: 1px solid #eaecf0; color: #98a2b3; background: #fafbfc; font-size: 10px; }
.global-search-footer span { display: inline-flex; align-items: center; gap: 4px; }


@media (max-width: 768px) {
    .sidebar-global-search { display: none; }
    .mobile-global-search-button { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; margin-left: auto; border: 0; border-radius: 9px; color: #475467; background: transparent; }
    .mobile-global-search-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
    .global-search-backdrop { align-items: flex-start; padding: calc(58px + env(safe-area-inset-top)) 10px 12px; }
    .global-search-dialog { border-radius: 12px; }
    .global-search-input-row { height: 54px; padding: 0 13px; }
    .global-search-input-row input { font-size: 16px; }
    .global-search-body { max-height: calc(100dvh - 190px - env(safe-area-inset-top)); }
    .global-search-result { grid-template-columns: 32px minmax(0,1fr); }
    .global-search-result-meta { display: none; }
    .global-search-footer { display: none; }
}

/* DCIM 2.3.0 Stable — server-linked ticket module */
@media (max-width: 768px) {
    /*
     * On switch details the section header stacks its action below the title.
     * Keep the blue accent attached to the title block instead of stretching
     * through the full-width action button.
     */
    .switch-servers-card .card-section-head {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        padding: 15px 16px 14px 30px;
    }
    .switch-servers-card .card-section-head::before {
        display: none;
        content: none;
    }
    .switch-servers-card .card-section-head > .card-title {
        position: relative;
        min-height: 0;
        padding: 0;
    }
    .switch-servers-card .card-section-head > .card-title::before {
        position: absolute;
        top: 1px;
        bottom: 1px;
        left: -16px;
        display: block !important;
        width: 4px;
        border-radius: 4px;
        background: var(--ui-blue-500);
        content: "" !important;
    }
    .switch-servers-card .card-section-head > .button {
        width: 100%;
        margin: 0;
    }

    /*
     * One fixed label column and one fixed value column for every audit row.
     * Explicit placement also neutralises legacy text-align and badge margins.
     */
    .audit-table-shell .audit-table td,
    .audit-table-shell .audit-table td:last-child {
        grid-template-columns: 82px minmax(0, 1fr);
        align-items: center;
        column-gap: 10px;
        min-height: 32px;
        text-align: left !important;
    }
    .audit-table-shell .audit-table td::before {
        grid-column: 1;
        align-self: center;
        margin: 0;
        line-height: 1.45;
    }
    .audit-table-shell .audit-table td > strong,
    .audit-table-shell .audit-table td > code,
    .audit-table-shell .audit-row-link,
    .audit-table-shell .audit-action-link,
    .audit-table-shell .audit-resource-name,
    .audit-table-shell .audit-result,
    .audit-table-shell .risk-badge {
        grid-column: 2;
        justify-self: start;
        align-self: center;
        margin: 0;
    }
    .audit-table-shell .audit-result {
        min-height: 24px;
    }
    .audit-table-shell .audit-table .risk-badge,
    .audit-table-shell .audit-table td:nth-child(6) .risk-badge {
        width: auto;
        min-width: 34px;
        margin-left: 0;
        justify-self: start;
    }
}


/* Ticket module */
.ticket-filter-card{padding:16px}.ticket-filters{display:grid;grid-template-columns:minmax(220px,1fr) 180px 180px auto;gap:12px;align-items:end}.ticket-filters label,.stack-form label{display:grid;gap:7px;font-size:13px;font-weight:650;color:#475569}.ticket-list{display:grid;gap:10px}.ticket-list-item{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 20px;text-decoration:none;color:inherit;transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease}.ticket-list-item:hover{transform:translateY(-1px);border-color:#b9c9f8;box-shadow:0 10px 28px rgba(15,23,42,.08)}.ticket-list-main{display:grid;gap:6px;min-width:0}.ticket-list-main>strong{font-size:16px;color:#172033}.ticket-list-main small,.ticket-list-meta small{color:#7b8494}.ticket-number-row{display:flex;gap:8px;align-items:center;font-size:12px;color:#64748b}.ticket-list-meta{display:grid;justify-items:end;gap:9px;text-align:right}.ticket-status,.ticket-priority{display:inline-flex;align-items:center;border-radius:999px;padding:5px 10px;font-size:12px;font-weight:700;white-space:nowrap}.ticket-status.is-open{background:#eff6ff;color:#2563eb}.ticket-status.is-in_progress{background:#eef2ff;color:#4f46e5}.ticket-status.is-waiting{background:#fff7ed;color:#c2410c}.ticket-status.is-resolved{background:#ecfdf5;color:#15803d}.ticket-status.is-closed{background:#f1f5f9;color:#64748b}.ticket-priority{padding:3px 8px}.ticket-priority.is-low{background:#f1f5f9;color:#64748b}.ticket-priority.is-normal{background:#eef2ff;color:#4f46e5}.ticket-priority.is-high{background:#fff7ed;color:#c2410c}.ticket-priority.is-urgent{background:#fef2f2;color:#dc2626}.ticket-form-card{max-width:880px;padding:24px}.stack-form{display:grid;gap:18px}.stack-form.compact{gap:13px}.stack-form textarea{resize:vertical}.ticket-detail-grid{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:18px;align-items:start}.ticket-detail-grid main{display:grid;gap:14px}.ticket-detail-grid aside{display:grid;gap:14px;position:sticky;top:18px}.ticket-message,.ticket-reply-card,.ticket-side-card{padding:20px}.ticket-message-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding-bottom:14px;border-bottom:1px solid #edf0f4}.ticket-message-head>div{display:grid;gap:3px}.ticket-message-head small{color:#7b8494}.ticket-message-body{padding-top:16px;line-height:1.75;color:#273044;overflow-wrap:anywhere}.ticket-origin{border-left:4px solid #4f76f6}.ticket-side-card h2{margin:0 0 15px;font-size:15px}.ticket-side-card dl{display:grid;gap:0;margin:0}.ticket-side-card dl div{display:grid;grid-template-columns:80px 1fr;gap:10px;padding:10px 0;border-top:1px solid #edf0f4}.ticket-side-card dt{color:#7b8494}.ticket-side-card dd{margin:0;text-align:right;color:#273044}.server-ticket-list{display:grid}.server-ticket-list>a{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:13px 2px;border-top:1px solid #edf0f4;text-decoration:none;color:inherit}.server-ticket-list>a>span:first-child{display:grid;gap:3px;min-width:0}.server-ticket-list strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.server-ticket-list small{color:#7b8494}.server-section-actions{display:flex;gap:8px;align-items:center}
@media(max-width:768px){.ticket-filters{grid-template-columns:1fr}.ticket-list-item{align-items:flex-start;padding:16px;display:grid}.ticket-list-meta{justify-items:start;text-align:left}.ticket-detail-grid{grid-template-columns:1fr}.ticket-detail-grid aside{position:static}.ticket-message,.ticket-reply-card,.ticket-side-card{padding:16px}.ticket-side-card dl div{grid-template-columns:72px 1fr}.server-section-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}.server-section-actions .button{justify-content:center}.server-ticket-list>a{align-items:flex-start}.server-ticket-list strong{white-space:normal}}


/* DCIM 2.3.0 Stable — unified server-detail card headers */
.server-section-card {
    padding: 0;
    overflow: hidden;
}
.server-section-card > .server-section-head {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-height: 64px;
    margin: 0;
    padding: 13px 18px 12px 34px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.server-section-card > .server-section-head::before {
    top: 15px;
    bottom: 15px;
    left: 18px;
    width: 3px;
}
.server-section-card > .server-section-head .server-section-heading {
    min-width: 0;
    padding: 0;
}
.server-section-card > .server-section-head .server-section-heading strong {
    margin: 0;
    color: #101828;
    font-size: 16px;
    font-weight: 760;
    line-height: 1.3;
}
.server-section-card > .server-section-head .server-section-heading span {
    margin-top: 3px;
    color: #7b8798;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
}
.server-section-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.server-ticket-card,
.server-activity-card {
    width: 100%;
    min-width: 0;
}
.server-ticket-card > .server-ticket-list {
    display: grid;
    padding: 4px 18px 12px;
}
.server-ticket-card > .server-ticket-list > a {
    min-height: 58px;
    padding: 10px 2px;
}
.server-ticket-card > .server-ticket-list > a:first-child {
    border-top: 0;
}
.server-ticket-card > .server-ticket-list strong {
    font-size: 13px;
    line-height: 1.4;
}
.server-ticket-card > .server-ticket-list small {
    margin-top: 1px;
    font-size: 11px;
}
.server-ticket-card > .empty-state,
.server-activity-card > .empty-state {
    margin: 0;
    border: 0;
    border-radius: 0;
}
.server-activity-card > .server-activity-grid {
    padding: 12px 18px 16px;
}

@media (max-width: 768px) {
    .server-section-card > .server-section-head {
        min-height: 58px;
        align-items: center;
        gap: 10px;
        padding: 11px 14px 10px 29px;
    }
    .server-section-card > .server-section-head::before {
        top: 12px;
        bottom: 12px;
        left: 14px;
        width: 3px;
    }
    .server-section-card > .server-section-head .server-section-heading strong {
        font-size: 15px;
    }
    .server-section-card > .server-section-head .server-section-heading span {
        margin-top: 2px;
        font-size: 11px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .server-section-actions {
        width: auto;
        display: flex;
        flex: 0 0 auto;
        gap: 6px;
    }
    .server-section-actions .button {
        width: auto;
        min-height: 36px;
        padding: 7px 10px;
        justify-content: center;
        font-size: 12px;
    }
    .server-ticket-card > .server-ticket-list {
        padding: 2px 14px 10px;
    }
    .server-ticket-card > .server-ticket-list > a {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: 54px;
        gap: 10px;
        padding: 9px 0;
    }
    .server-ticket-card > .server-ticket-list strong {
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .server-activity-card > .server-activity-grid {
        padding: 10px 14px 14px;
    }
}

@media (max-width: 480px) {
    .server-section-card > .server-section-head:has(.server-section-actions) {
        align-items: stretch;
        flex-direction: column;
    }
    .server-section-card > .server-section-head:has(.server-section-actions)::before {
        bottom: auto;
        height: 34px;
    }
    .server-section-card > .server-section-head:has(.server-section-actions) .server-section-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-top: 3px;
    }
    .server-section-card > .server-section-head:has(.server-section-actions) .server-section-actions:has(> :only-child) {
        grid-template-columns: 1fr;
    }
    .server-section-card > .server-section-head:has(.server-section-actions) .server-section-actions .button {
        width: 100%;
    }
}

/* DCIM 2.3.1 Stable — server-list backend column sorting */
.server-table-v2 th.server-sortable-column {
    padding: 0;
}
.server-sort-link {
    display: flex;
    width: 100%;
    padding: 12px 14px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.server-sort-link:hover,
.server-sort-link:focus-visible {
    color: var(--primary);
    background: rgba(37, 99, 235, .045);
    outline: none;
}
.server-sort-indicator {
    position: relative;
    flex: 0 0 10px;
    width: 10px;
    height: 14px;
    opacity: .38;
}
.server-sort-indicator::before,
.server-sort-indicator::after {
    position: absolute;
    left: 2px;
    width: 0;
    height: 0;
    border-right: 3px solid transparent;
    border-left: 3px solid transparent;
    content: '';
}
.server-sort-indicator::before {
    top: 1px;
    border-bottom: 4px solid currentColor;
}
.server-sort-indicator::after {
    bottom: 1px;
    border-top: 4px solid currentColor;
}
.server-sortable-column[data-sort-state="asc"] .server-sort-indicator,
.server-sortable-column[data-sort-state="desc"] .server-sort-indicator {
    color: var(--primary);
    opacity: 1;
}
.server-sortable-column[data-sort-state="asc"] .server-sort-indicator::after,
.server-sortable-column[data-sort-state="desc"] .server-sort-indicator::before {
    opacity: .18;
}
.server-sortable-column.is-sorted .server-sort-link {
    color: var(--primary);
    font-weight: 700;
}
