:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f3f6fa;
  color: #18273c;
  --muted: #52647c;
  --line: #dce4ee;
  --accent: #2563b5;
  --nav-width: 14rem;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 18rem; }
a { color: inherit; }
button { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #589be7; outline-offset: 3px; }

.skip {
  position: fixed;
  z-index: 5;
  top: .75rem;
  left: .75rem;
  transform: translateY(-150%);
  padding: .625rem .875rem;
  background: white;
  border-radius: .5rem;
}
.skip:focus { transform: none; }

.sidebar {
  position: fixed;
  display: flex;
  flex-direction: column;
  inset: 0 auto 0 0;
  width: var(--nav-width);
  padding: 1.5rem .875rem 1.25rem;
  background: #15243a;
  color: #e7effb;
  z-index: 2;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .25rem .5rem .625rem;
  text-decoration: none;
}
.brand strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.05;
  letter-spacing: .03em;
  color: #fff;
}
.brand small {
  display: block;
  margin-top: .375rem;
  color: #bac9dd;
  font-size: .8125rem;
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 2.5rem;
  height: 2.5rem;
  background: #427bc3;
  border: 1px solid #6a9bda;
  border-radius: .7rem;
}
.brand-mark i {
  display: block;
  width: 4px;
  height: 13px;
  transform: skew(-14deg);
  border-radius: 2px;
  background: #fff;
}
.brand-mark i:nth-child(2) { height: 20px; }
.brand-mark i:nth-child(3) { height: 10px; }

.navigation { display: grid; gap: .375rem; margin-top: 2.375rem; }
.navigation a {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 2.625rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  padding: .625rem .75rem;
  color: #ccd9ec;
  font-size: .9375rem;
  text-decoration: none;
  white-space: nowrap;
}
.navigation a:hover { background: #1f3450; color: #fff; }
.navigation a[aria-current] { background: #274366; border-color: #3d5b7e; color: #fff; }
.nav-icon {
  position: relative;
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex: none;
  color: #a9c5e9;
}
.nav-icon-grid {
  border: 1.5px solid currentColor;
  border-radius: 3px;
  background:
    linear-gradient(90deg, transparent calc(50% - .65px), currentColor 0 calc(50% + .65px), transparent 0),
    linear-gradient(transparent calc(50% - .65px), currentColor 0 calc(50% + .65px), transparent 0);
}
.nav-icon-list {
  height: .875rem;
  margin-top: 2px;
  background: repeating-linear-gradient(currentColor 0 1.5px, transparent 1.5px 5.25px) no-repeat right center / .75rem 100%;
  border-left: 1.5px solid currentColor;
  border-radius: 1px;
}
.nav-icon-node { border: 1.5px solid currentColor; border-radius: 3px; }
.nav-icon-node::before,
.nav-icon-node::after {
  position: absolute;
  top: 5px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}
.nav-icon-node::before { left: 2px; }
.nav-icon-node::after { right: 2px; }
.nav-icon-fleet {
  border: 1.5px solid currentColor;
  border-radius: 3px;
  background: linear-gradient(transparent calc(50% - .75px), currentColor 0 calc(50% + .75px), transparent 0);
}
.nav-icon-fleet::before,
.nav-icon-fleet::after {
  position: absolute;
  left: 2px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}
.nav-icon-fleet::before { top: 2px; }
.nav-icon-fleet::after { bottom: 2px; }
.nav-icon-check { border: 1.5px solid currentColor; border-radius: 50%; }
.nav-icon-check::after {
  position: absolute;
  width: 6px;
  height: 3px;
  border: solid currentColor;
  border-width: 0 0 1.5px 1.5px;
  top: 3px;
  left: 3px;
  transform: rotate(-45deg);
  content: "";
}

.sidebar-footer {
  margin-top: auto;
  padding: .875rem .75rem .75rem;
  background: #1d304a;
  border: 1px solid #354b66;
  border-radius: .625rem;
  font-size: .8125rem;
}
.sidebar-footer p { margin: 0 0 .5rem; font-weight: 650; color: #e8f0fd; }
.sidebar-footer dl { margin: 0; }
.sidebar-footer dl div { display: flex; justify-content: space-between; gap: .25rem; margin-top: .375rem; }
.sidebar-footer dt { color: #c2cfe1; }
.sidebar-footer dd { margin: 0; font-weight: 600; text-align: right; }

.workspace { margin-left: var(--nav-width); min-height: 100vh; }
.topbar {
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: .75rem clamp(1.25rem, 3.15vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.local-label, .timestamp { color: var(--muted); font-size: .875rem; }
.local-label span { margin: 0 .35rem; color: #8091a8; }
.refresh-controls { display: flex; align-items: center; gap: .875rem; }
#refresh, #logout button {
  min-height: 2.375rem;
  padding: .4rem .8rem;
  border-radius: .45rem;
  background: #fff;
  color: #234976;
  border: 1px solid #b5c6db;
  font-size: .875rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
#refresh:not(:disabled):hover, #logout button:hover { background: #eaf2fc; border-color: #80a3ce; }
#refresh:disabled { color: var(--muted); cursor: progress; opacity: .7; }

.login-page {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.125rem;
  background: radial-gradient(ellipse at 20% 5%, #274366, #15243a 68%);
}
.login-panel {
  width: min(100%, 27rem);
  padding: clamp(1.5rem, 7vw, 2.75rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 1.25rem 3rem #07132455;
}
.login-brand { display: flex; align-items: center; gap: .65rem; font-size: 1.5rem; letter-spacing: .03em; }
.login-panel h1 { margin: 1.3rem 0 1.5rem; font-size: clamp(1.625rem, 5.8vw, 2rem); line-height: 1.15; }
.login-form { display: grid; gap: 1.05rem; }
.login-field { display: grid; gap: .4rem; font-weight: 600; }
.login-field input {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid #b5c6db;
  border-radius: .45rem;
  padding: .55rem .75rem;
  color: inherit;
  font: inherit;
  font-weight: 400;
}
.login-form .login-message { margin: 0; }
.login-message:empty { display: none; }
.login-remember { display: flex; align-items: center; gap: .65rem; min-height: 2.25rem; cursor: pointer; }
.login-remember input { inline-size: 1.125rem; block-size: 1.125rem; margin: 0; accent-color: var(--accent); }
.login-submit {
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}
.login-submit:hover { background: #1b51a0; }

.page { max-width: 93rem; margin-inline: auto; padding: 2rem clamp(1.25rem, 3.15vw, 3rem) 3rem; }
.page-header { margin-bottom: 1.625rem; }
.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.12;
  font-weight: 720;
  letter-spacing: -.045em;
}
.page-header p { margin: .625rem 0 0; color: var(--muted); line-height: 1.45; }

.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .875rem; margin-bottom: 1.25rem; }
.metric-card {
  display: flex;
  flex-direction: column;
  min-height: 8.875rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: .75rem;
  box-shadow: 0 2px 5px #24385708;
}
.metric-card h2 { margin: 0; color: var(--muted); font-size: .875rem; font-weight: 650; }
.metric-server {
  border-color: #2a4e73;
  background:
    radial-gradient(circle at 100% 15%, #3b638e 0 18%, transparent 64%),
    linear-gradient(120deg, #203e60, #294c75);
  color: #fff;
}
.metric-server h2, .metric-server .metric-detail { color: #e1edfa; }
.metric-value {
  margin: .7rem 0 .45rem;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.12;
  font-weight: 710;
  letter-spacing: -.035em;
}
.metric-value.number { font-size: clamp(1.8rem, 2.5vw, 2.3rem); line-height: .9; font-variant-numeric: tabular-nums; }
.metric-detail { margin: auto 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.36; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}
.panel {
  min-width: 0;
  scroll-margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 1.25rem;
  background: #fff;
  box-shadow: 0 2px 5px #24385708;
}
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.125rem; }
.panel-header h2 { margin: 0; font-size: 1.125rem; letter-spacing: -.01em; line-height: 1.25; }
.panel-header p { margin: .4rem 0 0; font-size: .875rem; color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.625rem;
  max-width: 100%;
  padding: .2rem .55rem;
  border-radius: .375rem;
  font-size: .8125rem;
  font-weight: 650;
  line-height: 1.15;
}
.chip.neutral { color: #4c617a; background: #edf2f8; }
.chip.success { color: #11654e; background: #e2f3eb; }
.chip.caution { color: #7b4e11; background: #f9edd7; }
.chip.danger { color: #9e3042; background: #f9e8eb; }

.order-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .625rem;
  margin: 0 0 .75rem;
  padding: 0;
  list-style: none;
}
.order-flow li {
  position: relative;
  display: grid;
  gap: .45rem;
  padding: .75rem .5rem;
  text-align: center;
  border: 1px solid #dde8f5;
  border-radius: .5rem;
  background: #f2f7fd;
}
.order-flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  width: .625rem;
  height: 1px;
  background: #94afd0;
  top: calc(50% - 1px);
  right: calc(-.625rem - 1px);
}
.order-flow span { color: #405e87; font-size: .875rem; }
.order-flow strong { font-size: 1.375rem; font-variant-numeric: tabular-nums; line-height: 1; }
.order-details, .service-list { margin: 0; }
.order-details div, .service-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .875rem;
  padding: .45rem 0;
  border-bottom: 1px solid #e9eef4;
  font-size: .875rem;
}
.order-details div:last-child, .service-list div:last-child { border-bottom: 0; }
.order-details dt, .service-list dt { color: #33465f; }
.order-details dd, .service-list dd { margin: 0; text-align: right; }
.order-details dd { font-variant-numeric: tabular-nums; font-weight: 650; }
.service-list div { min-height: 2.65rem; }
.panel-footer {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  padding-top: .875rem;
  border-top: 1px solid var(--line);
  margin-top: .875rem;
  font-size: .8125rem;
  color: var(--muted);
}
.notice {
  background: #eef4fb;
  color: #3e5575;
  border-radius: .45rem;
  padding: .625rem .75rem;
  margin: .55rem 0 0;
  font-size: .875rem;
  line-height: 1.45;
}
.notice-error { margin: 0 0 1rem; background: #f9e8eb; color: #922d40; }
.notice-success { background: #e2f3eb; color: #11654e; }

.fleet-panel { margin-bottom: 1rem; }
.fleet-moves { margin: .75rem 0; color: var(--muted); font-size: .875rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.fleet-table { min-width: 48rem; }
.fleet-table tr > * { padding-inline: .75rem; }
.fleet-table tbody th { width: 25%; overflow-wrap: anywhere; }
.fleet-table tbody small {
  display: block;
  margin-top: .25rem;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 400;
}
.fleet-table tbody td:nth-child(2) { width: 15%; }
.fleet-table tbody td:last-child { width: 7rem; }
.fleet-table tbody tr:hover { background: #f8fafd; }
.fleet-load { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fleet-tool {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .625rem;
  background: #f5f8fc;
}
.fleet-tool-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.fleet-tool-header h3 { margin: 0; font-size: 1rem; line-height: 1.3; }
.fleet-tool-header p, .fleet-help { margin: .35rem 0 .8rem; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.fleet-fields { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, .58fr) minmax(0, 1.35fr); gap: .75rem; }
.fleet-preview-controls { display: grid; grid-template-columns: minmax(0, 20rem) auto; align-items: end; justify-content: start; gap: .75rem; }
.fleet-tool label { display: grid; gap: .375rem; color: #33465f; font-size: .875rem; font-weight: 650; min-width: 0; }
.fleet-tool input, .fleet-tool select {
  width: 100%;
  min-width: 0;
  min-height: 2.45rem;
  border: 1px solid #b5c6db;
  border-radius: .45rem;
  background-color: #fff;
  color: #223a58;
  padding: .4rem .625rem;
  font: inherit;
  font-weight: 500;
}
.fleet-tool select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, #456286 50%), linear-gradient(135deg, #456286 50%, transparent 50%);
  background-position: right .9rem center, right .625rem center;
  background-size: .3rem .3rem, .3rem .3rem;
  background-repeat: no-repeat;
}
.fleet-help { margin: .625rem 0 .875rem; }
.action-button {
  min-height: 2.45rem;
  padding: .4rem .8rem;
  border: 1px solid #b5c6db;
  border-radius: .45rem;
  background: #fff;
  color: #234976;
  font-size: .875rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.action-button:not(:disabled):hover { background: #eaf2fc; border-color: #80a3ce; }
.action-button.primary { color: #fff; background: #2563b5; border-color: #2563b5; }
.action-button.primary:not(:disabled):hover { background: #1d5094; border-color: #1d5094; }
.action-button:disabled, .fleet-tool select:disabled, .fleet-tool input:disabled { cursor: not-allowed; opacity: .6; }
.operation-message { display: inline-block; margin-left: .65rem; color: #33465f; font-size: .875rem; }

.directory-panel { margin-bottom: 1rem; }
.workspace[data-view="subscriptions"] .page > :not(#subscriptions, #snapshot-error),
.workspace[data-view="users"] .page > :not(#users, #snapshot-error) { display: none; }
.directory-help { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.directory-help:empty { display: none; }
.directory-controls, .directory-pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-block: .75rem;
}
.directory-controls label { color: #33465f; font-size: .875rem; font-weight: 650; }
.directory-controls input {
  min-height: 2.45rem;
  width: min(100%, 20rem);
  border: 1px solid #b5c6db;
  border-radius: .45rem;
  padding: .4rem .625rem;
  font: inherit;
  color: #223a58;
}
.directory-controls button[aria-pressed="true"] { background: #234976; color: #fff; border-color: #234976; }
.directory-controls button[aria-pressed="true"]:hover { background: #1d406a; color: #fff; }
.directory-pagination { font-size: .875rem; color: var(--muted); }
.directory-table th, .directory-table td { overflow-wrap: anywhere; }
.node-subscriptions > td { padding: .85rem; background: #f5f8fc; }
.fleet-count { margin-right: .5rem; }

.checks-panel { margin-top: 1rem; }
.monitor-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 0 1.5rem; }
.monitor-list > div:last-child { border-bottom: 1px solid #e9eef4; }
.monitor-heading { margin-top: 1.25rem; font-size: 1rem; }
.monitor-caption { display: block; color: var(--muted); font-size: .8125rem; margin-top: .3rem; }
.monitor-table th, .monitor-table td { width: auto; }
.monitor-table th:first-child { min-width: 9rem; }
.monitor-table td { font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 37rem; }
tr > * {
  text-align: left;
  padding: .7rem .625rem;
  border-bottom: 1px solid #e7edf4;
  font-size: .875rem;
  line-height: 1.4;
}
thead th { color: var(--muted); font-weight: 650; background: #f1f5fa; }
thead th:first-child { border-radius: .4rem 0 0 .4rem; }
thead th:last-child { border-radius: 0 .4rem .4rem 0; }
tbody th { width: 24%; font-weight: 650; }
tbody td:nth-child(2) { width: 23%; }
tbody td:last-child { color: #42546c; }
tbody tr:last-child > * { border: 0; }

@media (max-width: 68rem) {
  :root { --nav-width: 12.75rem; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 57rem) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 44rem) {
  .sidebar { position: static; width: 100%; padding: .75rem 1rem; }
  .brand { padding: 0; }
  .brand small { margin-top: .25rem; }
  .brand-mark { flex-basis: 2.25rem; height: 2.25rem; }
  .navigation { display: flex; gap: .25rem; margin-top: .75rem; overflow-x: auto; }
  .navigation a { min-height: 2.5rem; padding-inline: .5rem; gap: .375rem; }
  .nav-icon, .sidebar-footer { display: none; }
  .workspace { margin-left: 0; }
  .topbar { padding: .65rem 1rem; gap: .75rem; }
  .local-label { font-size: .8125rem; }
  .local-label span { margin-inline: .15rem; }
  .refresh-controls { gap: .5rem; }
  .timestamp { font-size: .8125rem; text-align: right; }
  .page { padding: 1.375rem 1rem 2rem; }
  .page-header { margin-bottom: 1.125rem; }
  .metric-card { min-height: 7.5rem; padding: .75rem; }
  .panel { padding: 1rem; }
  .fleet-fields { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 28rem) {
  .topbar { flex-wrap: wrap; }
  .refresh-controls { width: 100%; flex-wrap: wrap; justify-content: space-between; }
  .timestamp { text-align: left; }
  .overview-grid { gap: .5rem; }
  .nav-icon { display: none; }
  .fleet-preview-controls { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .fleet-preview-controls label { width: 100%; }
  .operation-message { display: block; margin: .45rem 0 0; }
}
