:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-strong: #f0f4f8;
  --line: #d8e0ea;
  --text: #17202a;
  --muted: #627083;
  --blue: #2563eb;
  --green: #14804a;
  --amber: #a15c00;
  --red: #b42318;
  --ink: #0f172a;
  --shadow: 0 14px 34px rgba(20, 31, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.login-view {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
}

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

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

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

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  letter-spacing: 0;
}

h3 {
  font-size: 18px;
  letter-spacing: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.primary-button,
.ghost-button,
.deploy-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 28px;
  line-height: 1;
}

.icon-button:hover {
  color: var(--text);
  background: var(--panel-strong);
}

.primary-button,
.deploy-button {
  color: #fff;
  background: var(--blue);
}

.primary-button:hover,
.deploy-button:hover {
  background: #1d4ed8;
}

.ghost-button {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

.ghost-button:hover {
  background: var(--panel-strong);
}

.form-error {
  min-height: 20px;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
}

.dashboard-view {
  display: grid;
  gap: 28px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

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

.muted {
  color: var(--muted);
  font-size: 14px;
}

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

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

.metric-card {
  min-height: 138px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
}

.metric-card.wide {
  grid-column: span 1;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1.1;
}

.metric-card small {
  color: var(--muted);
  font-size: 13px;
}

.meter {
  width: 100%;
  height: 9px;
  overflow: hidden;
  background: #e8edf3;
  border-radius: 999px;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  border-radius: inherit;
  transition: width 180ms ease, background-color 180ms ease;
}

.disk-list {
  display: grid;
  gap: 10px;
}

.disk-row {
  display: grid;
  gap: 5px;
}

.disk-row-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

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

.systems-list {
  display: grid;
  gap: 14px;
}

.system-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.system-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.system-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.system-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 4px;
}

.system-link {
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.system-link:hover {
  color: #1d4ed8;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.ok {
  color: var(--green);
  background: #e8f6ee;
}

.badge.warn {
  color: var(--amber);
  background: #fff4df;
}

.badge.bad {
  color: var(--red);
  background: #fdeceb;
}

.badge.neutral {
  color: #334155;
  background: #eef2f7;
}

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

.info-box {
  min-height: 94px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.info-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.info-box strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.info-box small,
.log-box {
  color: var(--muted);
  font-size: 13px;
}

.service-list,
.pr-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-list li,
.pr-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

.pr-list a {
  min-width: 0;
  overflow: hidden;
  color: var(--blue);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-box {
  max-height: 180px;
  overflow: auto;
  padding: 12px;
  background: #111827;
  color: #d1d5db;
  border-radius: 6px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  line-height: 1.45;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 15px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.modal-heading,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.form-wide {
  grid-column: 1 / -1;
}

.modal-actions {
  justify-content: flex-end;
}

[hidden] {
  display: none !important;
}

@media (max-width: 940px) {
  .metrics-grid,
  .system-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .system-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .metrics-grid,
  .system-grid {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .system-card,
  .login-card {
    padding: 15px;
  }
}
