:root {
  color-scheme: light;
  --navy: #101f38;
  --navy-light: #1b2e4c;
  --brand: #2957a5;
  --blue: #2862c5;
  --cyan: #0098db;
  --orange: #f26d36;
  --ink: #182940;
  --muted: #526581;
  --line: #dce5f0;
  --soft: #f3f6fb;
  --white: #fff;
  --green: #127457;
  --shadow: 0 2px 4px #142f5710;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--soft); font-size: 14px; }
button, select, input { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .57; }
:focus-visible { outline: 3px solid #048aca; outline-offset: 3px; }
h1, h2, p { margin: 0; }
svg:not(.symbols) { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); line-height: 1.5; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 226px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--navy); color: #c3d0e3; z-index: 2; }
.brand { display: flex; align-items: center; gap: 12px; padding: 23px 19px 22px; text-decoration: none; border-bottom: 1px solid #ffffff13; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; background: #fff; position: relative; overflow: hidden; flex: none; }
.brand-mark img { width: 34px; position: absolute; top: 9px; left: 3px; clip-path: inset(0 0 40% 0); }
.brand strong { display: block; color: #fff; font-size: 21px; line-height: 1.05; letter-spacing: -.04em; }
.brand-accent { color: #ff985d; }
.brand small { display: block; margin-top: 5px; color: #9db4d5; font-size: 9px; font-weight: 750; letter-spacing: .25em; }
.sidebar-body { padding: 29px 13px; flex: 1; overflow-y: auto; }
.nav-label { margin: 0 9px 11px; color: #a5b9d4; font-size: 10px; font-weight: 750; letter-spacing: .1em; }
nav { display: grid; gap: 5px; }
nav a { display: flex; align-items: center; gap: 11px; padding: 12px 11px; text-decoration: none; font-weight: 600; border-radius: 7px; border: 1px solid transparent; }
nav a:hover { background: #ffffff0b; color: #fff; }
nav a[aria-current="page"] { background: #224377; border-color: #3d6399; color: #fff; }
nav a[aria-current="page"] svg { color: #a9d6ff; }
.sidebar-foot { display: flex; gap: 9px; align-items: center; border-top: 1px solid #ffffff13; padding: 15px 13px; }
.account-avatar { display: grid; place-items: center; width: 34px; height: 34px; background: #254777; color: #e1efff; border-radius: 50%; font-weight: 750; flex: none; }
.account-text { min-width: 0; flex: 1; }
.account-text strong, .account-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-text strong { color: #fff; font-size: 13px; }
.account-text small { color: #aec2dd; font-size: 11px; margin-top: 2px; }
.icon-button { border: 0; background: transparent; color: inherit; padding: 7px; border-radius: 7px; display: inline-grid; place-items: center; }
.icon-button:hover { background: #7594bc22; }
.workspace { min-width: 0; }
.topbar { min-height: 61px; background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 30px; }
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); min-width: 0; }
.crumb svg { color: var(--brand); width: 16px; height: 16px; }
.crumb svg.chevron { color: #7184a0; width: 12px; height: 12px; }
.crumb strong { color: var(--ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-status, .badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; white-space: nowrap; font-weight: 650; }
.top-status { padding: 6px 10px; background: #edf6f3; color: #17634d; font-size: 12px; }
.top-status:has(.warning) { background: #fff1e6; color: #8d411d; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #1c9b72; display: inline-block; flex: none; }
.dot.warning { background: #cb642c; }
.main { max-width: 1540px; margin: 0 auto; padding: 26px 30px 17px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 19px; }
.eyebrow { color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .14em; display: flex; align-items: center; gap: 6px; }
.eyebrow span { width: 14px; height: 2px; background: var(--orange); display: inline-block; }
h1 { margin: 5px 0 4px; font-size: clamp(30px, 4vw, 38px); line-height: 1.13; letter-spacing: -.047em; font-weight: 750; }
.intro .muted { font-size: 14px; }
.secondary, .primary { display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 8px 12px; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; font-weight: 650; white-space: nowrap; }
.secondary svg, .primary svg { width: 16px; height: 16px; }
.secondary:not(:disabled):hover { border-color: #a6badd; color: var(--brand); background: #f4f8ff; }
.primary { color: #fff; border-color: var(--brand); background: var(--brand); }
.primary:not(:disabled):hover { background: #1b448c; }
.notice { padding: 10px 13px; margin-bottom: 15px; border: 1px solid #f0d2ae; color: #77441d; background: #fff6e9; border-radius: 8px; font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin-bottom: 15px; }
.metric, .panel { background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 0; }
.metric { padding: 12px 14px 11px; }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 650; color: var(--muted); font-size: 13px; }
.metric-icon, .panel-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; flex: none; }
.metric-icon svg, .panel-icon svg { width: 17px; height: 17px; }
.metric-icon.blue, .panel-icon { background: #edf3ff; color: #2b5eaf; }
.metric-icon.sky { background: #e8f6fc; color: #007cae; }
.metric-icon.orange { background: #fff0e7; color: #b94e24; }
.metric-icon.purple { background: #f0edff; color: #6447aa; }
.metric > strong { display: block; margin: 1px 0 3px; line-height: 1.1; font-size: 27px; font-weight: 750; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric p { font-size: 12px; color: var(--muted); }
.operational { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(0,1fr); gap: 13px; margin-bottom: 15px; }
.operational.single { grid-template-columns: minmax(0,1fr); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px; }
.panel-heading h2 { font-size: 17px; letter-spacing: -.02em; }
.panel-heading p { color: var(--muted); margin-top: 4px; font-size: 12px; line-height: 1.4; }
select, .search, .login-card input { border: 1px solid var(--line); border-radius: 7px; min-height: 34px; padding: 6px 8px; color: var(--ink); background: var(--white); }
select { max-width: 100%; cursor: pointer; }
.chart { display: grid; grid-template-columns: 38px minmax(0,1fr); grid-template-rows: 120px 18px; gap: 6px 7px; margin: 3px 16px 4px 12px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.axis { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; margin: -6px 0; }
.plot { position: relative; min-width: 0; }
.grid-lines { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; }
.grid-lines i { border-top: 1px dashed #dce5f1; }
#graph { width: 100%; height: 100%; position: absolute; inset: 0; overflow: visible; stroke: none; }
#graph .cpu-line, #graph .ram-line { vector-effect: non-scaling-stroke; stroke-width: 2; }
#graph .cpu-line { stroke: var(--blue); }
#graph .ram-line { stroke: #e06731; }
#graph .area { fill: url(#cpu-fill); }
#chart-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; text-align: center; padding: 0 5px; }
.time-axis { grid-column: 2; display: flex; justify-content: space-between; gap: 4px; }
.legend { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; font-size: 11px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; }
.legend .cpu { background: var(--blue); }
.legend .memory { background: #e06731; }
.performance .panel-heading { flex-wrap: wrap; }
.chart-filters { flex: 1 1 auto; justify-content: flex-end; }
.chart-filters select { max-width: 160px; }
.chart-summary { margin: 0 14px 13px; color: var(--muted); text-align: center; font-size: 11px; }
#graph circle.cpu-line { fill: var(--blue); }
#graph circle.ram-line { fill: #e06731; }
#agent-dialog { width: min(500px, calc(100vw - 24px)); }
.agent-body { padding: 0 15px 15px; display: grid; gap: 10px; justify-items: start; }
.agent-body > label { font-weight: 650; }
.agent-body > input { border: 1px solid var(--line); border-radius: 7px; padding: 8px; width: 100%; color: var(--ink); }
.agent-body ol { padding-left: 20px; margin: 2px 0; line-height: 1.55; }
.check-label { display: flex; align-items: center; gap: 6px; }
.host-list { padding: 0 13px; }
.host-row { border: 0; border-bottom: 1px solid #ebeff5; background: transparent; width: 100%; display: flex; align-items: center; text-align: left; color: inherit; padding: 8px 0; gap: 9px; }
.host-row:not(:disabled):hover .host-name { color: var(--brand); }
.host-row:disabled { opacity: 1; }
.host-icon { background: #f1f5fb; color: var(--brand); display: grid; place-items: center; width: 33px; height: 33px; border-radius: 7px; flex: none; }
.host-icon svg { width: 16px; height: 16px; }
.host-name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.host-detail { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.host-info { flex: 1; min-width: 0; }
.host-usage { color: var(--muted); font-size: 12px; white-space: nowrap; }
.badge { font-size: 11px; padding: 4px 7px; background: #edf1f7; color: #50617a; }
.badge .dot { width: 6px; height: 6px; background: #7386a0; }
.badge.ok { background: #eaf7f1; color: #16664e; }
.badge.ok .dot { background: #1c9b72; }
.panel-link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 700; font-size: 12px; text-decoration: none; padding: 11px 14px; }
.panel-link:hover { text-decoration: underline; }
.panel-link svg { width: 13px; height: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.search { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.search:focus-within { outline: 2px solid #048aca; outline-offset: 1px; }
.search svg { width: 14px; height: 14px; }
.search input { background: transparent; border: 0; min-width: 0; width: 128px; outline: none; color: var(--ink); padding: 0; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { padding: 8px 11px; border-top: 1px solid #e7edf5; }
th:first-child, td:first-child { padding-left: 14px; }
th:last-child, td:last-child { padding-right: 14px; }
th { background: #f8faff; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.adaptive-table th { padding: 3px 5px; }
.adaptive-table th:first-child { padding-left: 8px; }
.sort-button {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 6px; min-height: 32px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; font-weight: inherit;
}
.sort-direction { color: #5b7190; font-size: 13px; }
.sort-button:hover, th[aria-sort] .sort-button { background: #e6effc; border-color: #c6d8ee; color: var(--brand); }
th[aria-sort] .sort-direction { color: inherit; }
td { color: #314764; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cell-caption { display: none; }
tbody tr:hover { background: #fafcff; }
.user { display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 27px; height: 27px; border-radius: 7px; display: grid; place-items: center; flex: none; font-size: 10px; font-weight: 750; background: #eaf1ff; color: #325da8; }
.user strong, .user small { display: block; overflow-wrap: anywhere; }
.user > div { min-width: 0; }
.user strong { font-size: 12px; color: var(--ink); }
.user small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.table-foot { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; padding: 9px 14px; border-top: 1px solid #e7edf5; }
.empty { padding: 16px 14px; color: var(--muted); text-align: center; }
.view-button { min-height: 28px; padding: 4px 7px; font-size: 11px; color: var(--brand); }
.view-button svg { width: 14px; height: 14px; }
.footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.menu, .menu-backdrop { display: none; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: radial-gradient(ellipse at 90% 15%, #2957a5, var(--navy) 67%); }
.login-card { width: min(100%, 390px); background: #fff; border-radius: 14px; padding: 25px; box-shadow: 0 18px 54px #0d1d3b66; }
.login-card img { display: block; margin-bottom: 14px; }
.login-card h1 { font-size: 29px; }
.login-card form { display: grid; gap: 7px; margin-top: 17px; }
.login-card label { font-weight: 650; }
.login-card input { min-height: 39px; margin-bottom: 5px; }
.login-card button { margin-top: 4px; min-height: 40px; }
.form-error { color: #a33227; min-height: 1.4em; margin-top: 9px; }
dialog { color: var(--ink); padding: 0; border: 1px solid var(--line); border-radius: 13px; width: min(940px,calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 70px #101f3855; }
dialog::backdrop { background: #101f38b8; }
.shadow-head, .shadow-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 15px; }
.shadow-head h2 { margin: 3px 0; }
.shadow-head > div { min-width: 0; overflow-wrap: anywhere; }
.shadow-foot { font-size: 12px; color: var(--muted); }
#shadow-dialog {
  width: min(1360px, calc(100vw - 24px));
  height: min(880px, calc(100dvh - 24px));
  min-width: min(400px, calc(100vw - 24px));
  min-height: min(340px, calc(100dvh - 24px));
  max-width: calc(100vw - 24px);
  overflow: hidden;
}
#shadow-dialog[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
#shadow-dialog[data-expanded] {
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  border-radius: 0;
  resize: none;
}
@media (pointer: fine) {
  #shadow-dialog { resize: both; }
  #shadow-dialog .shadow-foot { padding-right: 23px; }
}
.shadow-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  background: var(--soft);
  border-top: 1px solid var(--line);
}
.shadow-toolbar label { font-weight: 650; }
#shadow-expand { margin-left: auto; }
.screen { background: #0d192c; color: #fff; display: flex; overflow: auto; overscroll-behavior: contain; }
.screen:focus-visible { outline-offset: -3px; }
.screen img, .screen p { flex: none; margin: auto; }
.screen img { display: block; width: 100%; height: 100%; object-fit: contain; }
.screen p { max-width: 100%; padding: 14px; text-align: center; }
.boot-error { margin: 30px; color: #a33227; }
@media (max-width: 1120px) {
  .shell { grid-template-columns: 196px minmax(0,1fr); }
  .main, .topbar { padding-left: 19px; padding-right: 19px; }
  .operational { grid-template-columns: minmax(0,1fr); }
  .chart-filters { justify-content: flex-start; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0,1fr); }
  .sidebar { position: fixed; inset: 56px auto 0 0; width: min(280px,calc(100vw - 32px)); height: auto; display: none; z-index: 3; }
  .menu-open .sidebar { display: flex; }
  .menu-backdrop { display: block; position: fixed; inset: 56px 0 0; z-index: 2; background: #101f3870; }
  body:has(.menu-open) { overflow: hidden; }
  .menu { display: inline-grid; color: var(--ink); }
  .topbar { height: 56px; position: sticky; top: 0; z-index: 4; }
  .crumb { flex: 1; }
  .crumb > span, .crumb > svg { display: none; }
  .primary, .secondary, .icon-button, select, .search { min-height: 44px; }
  .icon-button { min-width: 44px; flex: none; }
  .view-button { min-height: 44px; }
  .login-card input, .agent-body > input, .search input, select { font-size: 16px; }
  .login-card input, .agent-body > input { min-height: 44px; }
}
@media (max-width: 740px) {
  .adaptive-table, .adaptive-table thead { display: block; }
  .adaptive-table thead tr { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 9px; }
  .adaptive-table thead th { padding: 0; border: 0; background: transparent; }
  .sort-button { min-height: 44px; padding-inline: 8px; border-color: var(--line); }
  .adaptive-table tbody { display: grid; gap: 9px; padding: 0 12px 12px; }
  .adaptive-table tbody tr {
    display: grid; gap: 9px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
  }
  .adaptive-table td { display: block; min-width: 0; padding: 0; border: 0; }
  .adaptive-table .empty-row { display: block; }
  .adaptive-table .empty { padding: 5px; }
  .cell-caption { display: block; color: var(--muted); font-size: 11px; font-weight: 650; margin-bottom: 3px; }
  .session-table tr { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .session-table td:first-child { grid-column: 1 / 3; grid-row: 1; align-self: center; }
  .session-table td:nth-child(2), .session-table td:last-child { grid-column: 1 / -1; }
  .session-table td:nth-child(3) { grid-column: 3; grid-row: 1; justify-self: end; }
  .session-table td:nth-child(3) .badge { white-space: normal; }
  .session-table .view-button { width: 100%; }
  .audit-table tr { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .audit-table td:last-child { grid-column: 1 / -1; }
  .sessions .panel-heading { flex-wrap: wrap; }
  .sessions .filters { flex: 1 1 auto; }
  .sessions .search { flex: 1 1 140px; }
  .sessions .search input { width: 100%; }
}
@media (max-width: 640px) {
  .main, .topbar { padding-left: 12px; padding-right: 12px; }
  .main { padding-top: 16px; }
  .intro { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .intro .muted { font-size: 13px; }
  .metrics, .operational { gap: 9px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric { padding: 10px; }
  .metric-head { min-height: 32px; gap: 4px; }
  .metric-icon { width: 25px; height: 25px; }
  .chart-filters { flex: 1 1 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .chart-filters select { width: 100%; max-width: none; font-size: 14px; }
  #chart-host { grid-column: 1 / -1; }
  .chart { grid-template-rows: 142px 18px; }
  .time-axis span:nth-child(even) { display: none; }
  .host-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; }
  .host-usage { grid-column: 2 / -1; grid-row: 2; white-space: normal; }
  .host-row .badge { grid-column: 3; grid-row: 1; }
  .hosts .panel-heading, .shadow-foot { flex-wrap: wrap; }
  .shadow-foot button { width: 100%; }
}
@media (max-height: 540px) {
  #shadow-dialog .shadow-head, #shadow-dialog .shadow-foot, .shadow-toolbar { padding-top: 5px; padding-bottom: 5px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, nav a { transition: background-color .15s, border-color .15s, color .15s; }
}
