:root {
  color-scheme: light;
  --bg: #eef2f6;
  --sidebar: #19212b;
  --sidebar-soft: #232d39;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667381;
  --line: #dce4ec;
  --blue: #017ceb;
  --blue-dark: #015eb2;
  --green: #14845c;
  --red: #b42318;
  --amber: #a15c07;
  --shadow: 0 12px 30px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 24px;
  padding: 26px;
}

.login-panel h1,
.topbar h1,
.panel h2 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: 0;
}

.login-panel h1 {
  font-size: 2rem;
}

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

.sidebar {
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--blue);
  font-weight: 900;
}

.brand small {
  display: block;
  color: #b6c0cc;
}

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

.nav-button,
.secondary-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  min-height: 42px;
  padding: 9px 12px;
  text-align: left;
}

.nav-button {
  background: transparent;
  color: #d7dee7;
  font-weight: 700;
}

.nav-button:hover,
.nav-button.active {
  background: var(--sidebar-soft);
  color: #fff;
}

.secondary-button {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: center;
  font-weight: 800;
}

.content-shell {
  min-width: 0;
  overflow-x: hidden;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar .eyebrow,
.brand .eyebrow {
  color: #b6c0cc;
}

.grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.two-columns {
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1.05fr);
}

.view-section {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-ok {
  border-color: rgba(20, 132, 92, 0.24);
  background: rgba(20, 132, 92, 0.08);
  color: var(--green);
}

.status-warn {
  border-color: rgba(161, 92, 7, 0.24);
  background: rgba(161, 92, 7, 0.08);
  color: var(--amber);
}

.status-error {
  border-color: rgba(180, 35, 24, 0.24);
  background: rgba(180, 35, 24, 0.08);
  color: var(--red);
}

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

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label:first-child,
.form-grid .primary-button {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
}

label span,
.status-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #ccd6e0;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(1, 124, 235, 0.14);
}

.primary-button,
.icon-button,
.ghost-button {
  cursor: pointer;
}

.primary-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #e1e9f2;
  color: var(--text);
  font-size: 1.1rem;
}

.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  padding: 6px 10px;
}

.message {
  border-radius: 6px;
  padding: 10px 12px;
  background: #eef5fc;
  color: var(--text);
  font-size: 0.9rem;
}

.message.error {
  background: rgba(180, 35, 24, 0.08);
  color: var(--red);
}

.message.success {
  background: rgba(20, 132, 92, 0.08);
  color: var(--green);
}

.status-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.status-list div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.status-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.status-list dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

table {
  min-width: 640px;
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

td {
  font-size: 0.92rem;
}

.row-title {
  display: grid;
  gap: 3px;
}

.row-title small {
  color: var(--muted);
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.system-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  min-height: 120px;
  padding: 14px;
}

.system-tile strong {
  font-size: 1rem;
}

.system-tile small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.stat-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  min-height: 72px;
  padding: 10px;
}

.stat-item span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-item strong {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.issue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.issue-chip {
  border: 1px solid rgba(161, 92, 7, 0.24);
  border-radius: 999px;
  background: rgba(161, 92, 7, 0.08);
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 10px;
}

.payload-box {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1720;
  color: #e8eef6;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
}

.empty-state {
  padding: 26px 10px;
  color: var(--muted);
  text-align: center;
}

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

  .sidebar {
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .secondary-button {
    margin-top: 0;
  }

  .two-columns,
  .stat-grid,
  .systems-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .content-shell {
    padding: 16px 10px 28px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-list,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .status-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
