:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #192b29;
  background: #f4f7f5;
  --muted: #526762;
  --border: #dce6e1;
  --green: #087459;
  --green-hover: #065d48;
  --soft-green: #e0f4eb;
  --danger: #a62934;
  --sidebar: #132523;
  --shadow: 0 12px 34px rgba(24, 52, 43, .06);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
:focus-visible { outline: 3px solid #40a98a; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .93em; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 3; padding: 10px 15px; border-radius: 8px; color: white; background: var(--green); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.auth-layout { min-height: 100vh; min-height: 100svh; padding: 20px; display: grid; place-items: center; background: radial-gradient(ellipse at 18% 10%, #246951 0%, transparent 62%), linear-gradient(145deg, #173b34, #101e1d); }
.auth-card { width: min(100%, 420px); padding: clamp(24px, 6vw, 42px); border-radius: 20px; background: #fff; box-shadow: 0 30px 75px #101e1d60; }
.auth-brand { font-size: 25px; font-weight: 750; margin-bottom: 33px; }
.auth-card h1 { font-size: 29px; letter-spacing: -.03em; margin-bottom: 8px; }
.auth-card p.muted { font-size: 14px; margin-bottom: 26px; line-height: 1.6; }
.auth-card .button { width: 100%; }
.state-card { display: grid; gap: 16px; text-align: center; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { min-width: 0; min-height: 100vh; position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; padding: 25px 15px 15px; background: var(--sidebar); color: #e9f6ef; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: #b8edd1; color: #174b3a; }
.brand-mark .icon { width: 24px; height: 24px; stroke-width: 1.9; }
.sidebar-brand { margin: 0 8px 33px; }
.sidebar-brand strong { display: block; font-size: 23px; line-height: 1.1; letter-spacing: -.035em; }
.sidebar-brand div span, .session-copy span { display: block; margin-top: 4px; color: #b0c7bf; font-size: 12px; }
.navigation { display: flex; flex-direction: column; gap: 5px; }
.nav-button { display: flex; align-items: center; gap: 11px; padding: 11px 12px; min-height: 44px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #c4d9d1; font-size: 14px; text-align: left; white-space: nowrap; }
.nav-button:hover { background: #213a35; color: #fff; }
.nav-button[aria-current="page"] { color: #e6fff4; background: #26443b; border-color: #31574a; font-weight: 650; }
.nav-button[aria-current="page"] .icon { color: #a9e9c9; }
.session { display: flex; align-items: center; gap: 9px; margin-top: auto; padding-top: 14px; border-top: 1px solid #33504a; }
.avatar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: #35594e; color: #defaf0; font-size: 14px; font-weight: 700; }
.session-copy { min-width: 0; flex: 1; }
.session-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.logout { color: #c4d9d1 !important; }
.logout:hover { background: #29443e !important; color: #fff !important; }

.main-panel { min-width: 0; width: 100%; max-width: 1550px; margin: 0 auto; padding: 35px clamp(22px, 4vw, 54px) 55px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 25px; }
.breadcrumb { display: flex; gap: 9px; align-items: center; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 600; }
.breadcrumb span:last-child { color: var(--green); }
.page-header h1 { font-size: clamp(25px, 4vw, 36px); letter-spacing: -.045em; line-height: 1.14; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; font-size: 14px; }
.button { padding: 9px 12px; min-height: 40px; white-space: nowrap; text-decoration: none; }
.icon-button { padding: 7px; min-width: 36px; min-height: 36px; color: var(--muted); background: transparent; }
.icon-button:hover { background: #eef4ef; color: #162d28; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-hover); }
.button-outline { color: #29403a; background: #fff; border-color: var(--border); }
.button-outline:hover { background: #edf6f1; border-color: #bbcfc4; }
.button-danger { background: #fff; border-color: #efccd1; color: var(--danger); }
.button-danger:hover { background: #fff0f1; }
.button-danger-solid { background: var(--danger); color: #fff; }
.button-danger-solid:hover { background: #881f29; }
.button-small { min-height: 34px; padding: 6px 9px; font-size: 12px; }

.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 19px; }
.summary-card { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; min-width: 0; padding: 17px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.summary-card h2 { color: var(--muted); font-size: 13px; font-weight: 650; }
.summary-value { display: block; margin-top: 7px; font-size: clamp(22px, 3vw, 30px); line-height: 1; font-weight: 750; font-variant-numeric: tabular-nums; }
.summary-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--soft-green); color: var(--green); }
.summary-icon.is-danger { background: #fce8ea; color: var(--danger); }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; }
.panel-header h2 { font-size: 16px; letter-spacing: -.015em; }
.panel-actions, .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.search { display: flex; align-items: center; gap: 7px; padding: 0 9px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: #fff; }
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 2px #08745926; }
.search input { width: 155px; min-width: 0; min-height: 38px; border: 0; outline: 0; background: transparent; color: #192b29; font-size: 13px; }
.search .icon { width: 16px; height: 16px; }
.table-wrap { overflow: auto; border-radius: 0 0 13px 13px; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 13px; vertical-align: top; overflow-wrap: anywhere; }
.data-table th:first-child, .data-table td:first-child { padding-left: 16px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 16px; }
.data-table th { border-top: 1px solid var(--border); background: #f2f7f4; color: #465e56; font-size: 12px; font-weight: 700; white-space: nowrap; }
.data-table td { border-top: 1px solid #e6ede9; }
.data-table tbody tr:hover { background: #fbfdfb; }
.cell-primary { font-weight: 650; }
.cell-note { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.key-material { max-width: 54ch; }
.nowrap { white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 8px; background: #eef3f1; color: #405850; font-size: 12px; font-weight: 650; }
.badge::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.is-good { background: #e0f4eb; color: #075f49; }
.badge.is-warn { background: #fff3d7; color: #784b08; }
.badge.is-danger { background: #fce8ea; color: var(--danger); }
.fleet-anomalies { margin-bottom: 19px; }
.anomaly-list, .detail-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.anomaly-list li, .detail-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 10px 16px; border-top: 1px solid #e6ede9; }
.device-details > summary { cursor: pointer; color: var(--green); white-space: nowrap; }
.device-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(660px, 76vw); padding-top: 10px; }
.device-detail-section { min-width: 0; border-top: 1px solid var(--border); padding-top: 8px; }
.fleet-overview { width: 100%; padding-top: 0; margin-bottom: 19px; gap: 14px; }
.fleet-overview .device-detail-section { padding: 16px 18px; border: 1px solid var(--border); border-radius: 13px; background: #fff; }
.fleet-overview .device-detail-section h3 { color: #294039; font-size: 14px; }
.fleet-overview .detail-list li { display: flex; }
.fleet-overview .cell-note { margin: 0; font-variant-numeric: tabular-nums; }
.device-detail-section h3 { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.device-detail-section p { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.device-detail-section .detail-list li { display: block; padding: 6px 0; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 820px) { .device-detail-grid { width: min(580px, 100%); } }
@media (max-width: 460px) { .device-detail-grid { grid-template-columns: 1fr; } }
.empty-state { display: grid; justify-items: center; gap: 11px; padding: 44px 16px; color: var(--muted); text-align: center; font-size: 14px; }
.empty-state .icon { width: 25px; height: 25px; }
.state-error { color: var(--danger); }

.form-stack { display: grid; gap: 15px; }
.field { display: grid; min-width: 0; gap: 7px; color: #2a413a; font-size: 13px; font-weight: 650; }
.field input, .field textarea, .field select { width: 100%; padding: 9px 10px; min-height: 41px; border: 1px solid #cbdad1; border-radius: 8px; background: #fcfefc; color: #192b29; font-size: 14px; font-weight: 400; }
.field textarea { min-height: 110px; resize: vertical; }
.field small { color: var(--muted); font-weight: 400; line-height: 1.45; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-error { padding: 10px 12px; border-radius: 8px; color: var(--danger); background: #fff0f1; font-size: 13px; overflow-wrap: anywhere; }
dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100% - 32px); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 20px; color: #192b29; box-shadow: 0 24px 80px #152b264d; }
dialog::backdrop { background: #10272285; backdrop-filter: blur(3px); }
.editor-form { display: grid; gap: 0; }
.dialog-heading, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 20px clamp(18px, 5vw, 28px); }
.dialog-heading { align-items: flex-start; border-bottom: 1px solid var(--border); }
.dialog-heading h2 { font-size: 22px; line-height: 1.3; letter-spacing: -.025em; }
.dialog-heading-copy p { margin-top: 6px; font-size: 13px; line-height: 1.55; }
.dialog-heading .icon-button { margin: -4px -6px 0 0; }
#editor-fields { padding: 23px clamp(18px, 5vw, 28px); gap: 18px; }
#editor-error { margin: 0 clamp(18px, 5vw, 28px) 16px; }
.dialog-actions { justify-content: flex-end; background: #f7faf8; border-top: 1px solid var(--border); }
.dialog-actions .button { padding-inline: 16px; }
.allocation-note { display: flex; align-items: flex-start; gap: 12px; padding: 14px; background: #edf7f2; border: 1px solid #d7eae0; border-radius: 12px; color: #25493d; }
.allocation-mark, .customer-mark { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: #dcefe6; color: #17674f; }
.allocation-note strong { font-size: 13px; }
.allocation-note p { margin-top: 4px; font-size: 12px; line-height: 1.65; }
.customer-identity { display: flex; align-items: center; gap: 10px; }
.customer-mark { font-size: 13px; font-weight: 750; }
.network-tag { display: inline-block; padding: 4px 8px; border-radius: 6px; background: #edf5f1; color: #245447; font: .88em ui-monospace, SFMono-Regular, Consolas, monospace; }
.dialog-copy { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.notice { position: fixed; z-index: 2; bottom: 18px; right: 18px; max-width: min(420px, calc(100% - 36px)); display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 9px; background: #19483b; color: #fff; box-shadow: var(--shadow); font-size: 14px; overflow-wrap: anywhere; }
.notice.is-danger { background: var(--danger); }

.host-link { color: var(--green); font-weight: 700; text-decoration: none; }
.host-link:hover { text-decoration: underline; }
.hardware-banner, .hardware-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.hardware-banner { justify-content: space-between; margin-bottom: 16px; }
.fleet-overview.fleet-overview-single { grid-template-columns: minmax(0, 1fr); }
.hardware-meta { color: var(--muted); font-size: 13px; }
.hardware-facts { margin: 14px 0 0; }
.hardware-facts .summary-value { font-size: clamp(16px, 2vw, 23px); overflow-wrap: anywhere; }
.hardware-management { margin-top: 22px; }
.hardware-management .row-actions { padding: 0 16px 16px; }
.hardware-management p { padding: 0 16px 16px; font-size: 13px; }
.hardware-values progress { display: block; width: 100%; height: 7px; margin-top: 7px; accent-color: var(--green); }
.hardware-health { display: grid; gap: 7px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; font-size: 13px; }
.hardware-section-title { margin: 22px 0 10px; font-size: 16px; }
.hardware-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr)); gap: 12px; }
.hardware-card { min-width: 0; padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.hardware-card h3 { margin: 0 0 12px; font-size: 14px; overflow-wrap: anywhere; }
.hardware-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 9px; margin: 0; }
.hardware-values dt { color: var(--muted); font-size: 12px; }
.hardware-values dd { margin: 4px 0 0; font-size: 13px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-height: auto; position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 15px; }
  .sidebar-brand { margin: 0; }
  .sidebar-brand .brand-mark { width: 34px; height: 34px; }
  .navigation { grid-column: 1 / -1; grid-row: 2; flex-direction: row; flex-wrap: wrap; }
  .nav-button { padding: 7px 8px; gap: 5px; min-height: 38px; }
  .nav-button .icon { width: 16px; height: 16px; }
  .session { grid-column: 2; grid-row: 1; padding: 0; border: 0; margin: 0; }
  .session-copy { max-width: 100px; }
  .avatar { display: none; }
  .main-panel { padding: 22px 15px 39px; }
  .page-header { margin-bottom: 18px; }
  .table-wrap { overflow: visible; }
  .data-table, .data-table tbody, .data-table td { display: block; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .data-table tr { display: grid; gap: 7px; padding: 12px 15px; border-top: 1px solid var(--border); }
  .data-table td, .data-table td:first-child, .data-table td:last-child { display: grid; grid-template-columns: minmax(75px, 28%) minmax(0, 1fr); gap: 8px; border: 0; padding: 0; }
  .data-table td::before { content: attr(data-label); padding-top: 1px; color: var(--muted); font-size: 12px; font-weight: 650; }
  .nowrap { white-space: normal; }
}

@media (max-width: 460px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .summary-card { padding: 12px 10px; }
  .summary-card .summary-value { font-size: 21px; }
  .summary-icon { display: none; }
  .fleet-overview { width: 100%; }
  .dialog-heading, .dialog-actions { padding-block: 15px; }
  .panel-header { align-items: flex-start; flex-direction: column; padding: 11px; }
  .panel-actions { width: 100%; }
  .search { flex: 1; min-width: 115px; }
  .search input { width: 100%; }
  .field-row { grid-template-columns: 1fr; }
}
