:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --ink: #101820;
  --muted: #687480;
  --line: #dfe5e8;
  --blue: #0f74c9;
  --blue-dark: #0a568f;
  --green: #15845a;
  --amber: #b76b00;
  --red: #c33131;
  --shadow: 0 18px 50px rgba(16, 24, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px;
  color: #eef7ff;
  background: #13202b;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #22a2e8;
  color: #ffffff;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aebdca;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  color: #d4e0ea;
  background: transparent;
  text-align: left;
}

.nav-item span:first-child {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.nav-item.active,
.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-note span,
.sidebar-note strong {
  display: block;
}

.sidebar-note span {
  margin-bottom: 6px;
  color: #aebdca;
  font-size: 13px;
}

.main {
  padding: 28px;
}

.topbar,
.panel-heading,
.toolbar,
.top-actions,
.segments,
.site-row,
.status-line,
.dialog-actions {
  display: flex;
  align-items: center;
}

.topbar,
.panel-heading,
.toolbar {
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.top-actions {
  gap: 10px;
}

.primary-button,
.ghost-button,
.icon-button,
.segment {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.primary-button {
  padding: 0 16px;
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
}

.ghost-button {
  padding: 0 12px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  font-size: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 26px 0 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 32px;
}

.metric.danger strong {
  color: var(--red);
}

.metric.warning strong {
  color: var(--amber);
}

.toolbar {
  margin-bottom: 18px;
}

.search-wrap {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-width: min(460px, 100%);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
}

.segments {
  gap: 6px;
}

.segment {
  padding: 0 12px;
}

.segment.active {
  border-color: #8fc8ef;
  background: #e7f3fc;
  color: var(--blue-dark);
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.panel {
  padding: 18px;
}

.site-list,
.alert-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.site-row {
  gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  text-align: left;
}

.site-row.active {
  border-color: #8fc8ef;
  background: #eef8ff;
}

.status-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
}

.status-dot.warning {
  background: var(--amber);
}

.status-dot.critical {
  background: var(--red);
}

.status-dot.pending {
  background: var(--muted);
}

.site-main {
  min-width: 0;
  flex: 1;
}

.site-main strong,
.site-main span {
  display: block;
}

.site-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--blue-dark);
  background: #e7f3fc;
  font-size: 12px;
  font-weight: 800;
}

.badge.warning {
  color: #7a4700;
  background: #fff1d8;
}

.badge.critical {
  color: #9b1d1d;
  background: #ffe6e4;
}

.badge.pending {
  color: #4f5962;
  background: #edf1f3;
}

.detail-panel {
  align-self: start;
}

.detail-hero {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-hero h2 {
  margin: 4px 0 6px;
  font-size: 24px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.detail-stat {
  padding: 12px;
  border-radius: 8px;
  background: #f5f7f8;
}

.detail-stat span,
.update-item span,
.alert-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.detail-stat strong {
  display: block;
  margin-top: 4px;
}

.update-list {
  display: grid;
  gap: 8px;
}

.server-note {
  display: grid;
  gap: 4px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.connector-box {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
}

.connector-box strong,
.connector-box span,
.connector-box label {
  display: block;
}

.connector-box span,
.connector-box label {
  color: var(--muted);
  font-size: 13px;
}

.copy-field {
  display: block;
  width: 100%;
  min-height: 34px;
  margin-top: 5px;
  padding: 6px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-field.secret {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.server-note span {
  color: var(--muted);
  font-size: 13px;
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
}

.detail-tabs button {
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-weight: 800;
}

.detail-tabs button.active {
  border-color: #8fc8ef;
  background: #e7f3fc;
  color: var(--blue-dark);
}

.detail-tab-panel {
  min-width: 0;
}

.inventory-list {
  display: grid;
  gap: 8px;
}

.inventory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.inventory-row strong,
.inventory-row span {
  display: block;
}

.inventory-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 78px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #edf1f3;
  color: #4f5962;
  font-size: 11px;
  font-weight: 800;
}

.mini-badge.active,
.mini-badge.ok {
  background: #e4f6ee;
  color: var(--green);
}

.mini-badge.warning {
  background: #fff1d8;
  color: #7a4700;
}

.inventory-empty {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
}

.update-item,
.alert-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #ffffff;
}

.update-item.warning,
.alert-item.warning {
  border-left-color: var(--amber);
}

.update-item.critical,
.alert-item.critical {
  border-left-color: var(--red);
}

.alerts-panel,
.connector-panel {
  margin-top: 18px;
}

.alert-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.connector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.connector-grid article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.connector-grid p {
  margin: 8px 0 0;
  color: var(--muted);
}

dialog {
  width: min(480px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 24, 32, 0.35);
}

.dialog-form {
  display: grid;
  gap: 14px;
}

.dialog-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dialog-form input,
.dialog-form select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dialog-actions {
  justify-content: flex-end;
  gap: 8px;
}

.muted {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr;
    padding: 14px;
  }

  .nav-list {
    display: flex;
    justify-content: flex-end;
    overflow-x: auto;
  }

  .sidebar-note {
    display: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .toolbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .connector-grid {
    grid-template-columns: 1fr;
  }

  .segments {
    flex-wrap: wrap;
  }

  .site-row,
  .alert-item {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .site-meta {
    justify-items: start;
  }
}
