:root {
  --navy: #0b3b60;
  --dark-gray: #2a3a4a;
  --bg: #f6f8fa;
  --accent: #ffb84d;
  --card-bg: #ffffff;
  --line: #d7e0e8;
  --ok: #2e7d32;
  --warn: #ef8c23;
  --bad: #c62828;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--dark-gray);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: var(--navy);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  background: var(--navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.brand:hover {
  text-decoration: none;
}

.brand svg {
  width: 18px;
  height: 18px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topnav a {
  color: #dbe8f3;
  font-weight: 500;
}

.beta-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 184, 77, 0.2);
  color: #ffd08b;
  border: 1px solid rgba(255, 184, 77, 0.55);
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.08rem 0.45rem;
  letter-spacing: 0.3px;
}

.main-content {
  padding: 1.5rem 0 2.5rem;
}

.page-header h1,
.prose-card h1,
.auth-card h1 {
  margin: 0 0 0.5rem;
  color: #142333;
  font-size: clamp(1.35rem, 2.1vw, 1.8rem);
  line-height: 1.25;
}

.page-header p {
  margin: 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
  align-items: start;
}

.access-card {
  border-color: #dce7f2;
  box-shadow: 0 3px 12px rgba(20, 40, 60, 0.06);
}

.access-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  color: #132a3f;
}

#login-form-inline {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.48rem;
}

#login-message-inline {
  margin-top: 0.65rem;
  min-height: 1.2rem;
}

.system-health {
  margin-top: 0.5rem !important;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.health-operational {
  color: #0f5132;
  background: rgba(46, 125, 50, 0.16);
  border: 1px solid rgba(46, 125, 50, 0.35);
}

.health-degraded {
  color: #7a4a00;
  background: rgba(239, 140, 35, 0.2);
  border: 1px solid rgba(239, 140, 35, 0.34);
}

.health-critical {
  color: #7f1d1d;
  background: rgba(198, 40, 40, 0.18);
  border: 1px solid rgba(198, 40, 40, 0.35);
}

.kpi-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.kpi-chip {
  background: #ffffff;
  border: 1px solid #dbe6ef;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  box-shadow: 0 2px 8px rgba(20, 40, 60, 0.04);
}

.kpi-label {
  margin: 0;
  color: #5f7284;
  font-size: 0.79rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kpi-value {
  margin: 0.2rem 0 0;
  color: #12283b;
  font-weight: 700;
  font-size: 1.02rem;
}

.small {
  font-size: 0.9rem;
}

.muted {
  color: #5e6e7f;
}

.dashboard-grid {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  align-items: stretch;
}

.col-5 {
  grid-column: span 5;
}

.col-7 {
  grid-column: span 7;
}

.col-12 {
  grid-column: span 12;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(15, 40, 65, 0.03);
  display: flex;
  flex-direction: column;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card h2 {
  margin: 0;
  font-size: 1.05rem;
}

.frosted-card .frosted-body {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(236, 243, 250, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -20px 35px rgba(10, 40, 65, 0.08),
    0 8px 18px rgba(20, 40, 60, 0.08);
  isolation: isolate;
  flex: 1;
}

.frosted-card .frosted-body > * {
  filter: blur(4.5px) saturate(0.9) brightness(0.9);
  opacity: 0.9;
  transform: scale(1.015);
  transform-origin: center;
  user-select: none;
}

.frosted-card .frosted-body::before,
.frosted-card .frosted-body::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.frosted-card .frosted-body::before {
  background:
    radial-gradient(130% 65% at 0% 0%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 62%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.04) 40%, rgba(255, 255, 255, 0.16));
  mix-blend-mode: screen;
  animation: glass-sheen 10s linear infinite;
}

.frosted-card .frosted-body::after {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.03) 0px,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(0, 0, 0, 0.02) 2px,
      rgba(0, 0, 0, 0.02) 4px
    );
  opacity: 0.45;
}

@keyframes glass-sheen {
  0% {
    transform: translateX(-10%) translateY(0);
  }
  50% {
    transform: translateX(8%) translateY(-1%);
  }
  100% {
    transform: translateX(-10%) translateY(0);
  }
}

.build-list,
.logs-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.build-item {
  padding: 0.7rem 0;
  border-top: 1px solid #edf2f7;
}

.build-item:first-child {
  border-top: 0;
  padding-top: 0.2rem;
}

.build-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.badge {
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
}

.status-success {
  background: var(--ok);
}

.status-failed {
  background: var(--bad);
}

.status-running {
  background: var(--warn);
  color: #111;
}

.build-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 0.75rem;
  font-size: 0.9rem;
}

.build-meta strong {
  color: #1b2c3f;
}

.progress-wrap {
  width: 100%;
  height: 11px;
  background: #e6edf3;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), #2f6d98);
  transition: width 0.35s ease;
}

.storage-list {
  display: grid;
  gap: 0.8rem;
}

.storage-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.storage-name {
  color: #1b2c3f;
  font-weight: 600;
}

.chart-box {
  position: relative;
  width: 100%;
  height: 250px;
  border: 1px solid #d9e5ef;
  border-radius: 8px;
  padding: 0.45rem;
  background: linear-gradient(180deg, #fdfefe, #f1f6fb 55%, #eef4fb);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 -12px 20px rgba(20, 48, 76, 0.04);
}

#traffic-chart {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.traffic-fallback {
  margin-top: 0.55rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.79rem;
  color: #2a4358;
  background: #f8fbff;
  border: 1px solid #dce8f3;
  border-radius: 8px;
  padding: 0.5rem;
  max-height: 180px;
  overflow: auto;
}

.logs-card {
  background: linear-gradient(180deg, #13293d, #0f2335 62%, #0c1d2d);
  border-color: #1e3f59;
}

.logs-card h2 {
  color: #eaf4ff;
}

.logs-card .logs-list {
  position: relative;
}

.logs-card .logs-list::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  background: linear-gradient(to top, rgba(15, 35, 53, 0.95), rgba(15, 35, 53, 0));
  pointer-events: none;
}

.logs-list li {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.79rem;
  border-top: 1px solid rgba(180, 210, 235, 0.12);
  padding: 0.45rem 0;
  color: #cfe6fb;
  word-break: break-word;
  letter-spacing: 0.1px;
}

.logs-list li:first-child {
  border-top: 0;
}

.live-log-line {
  animation: log-pulse 1.5s ease-out;
}

@keyframes log-pulse {
  0% {
    transform: translateY(3px);
    opacity: 0.2;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.table-wrap {
  overflow-x: auto;
}

.nodes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.nodes-table th,
.nodes-table td {
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  padding: 0.55rem 0.2rem;
}

.nodes-table th {
  color: #172c41;
  font-size: 0.84rem;
  letter-spacing: 0.25px;
  text-transform: uppercase;
}

.nodes-table thead th {
  background: #f5f9fd;
  position: sticky;
  top: 0;
}

.nodes-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.nodes-table tbody tr:hover {
  background: #f1f7fc;
}

.nodes-table td:first-child {
  font-weight: 600;
  color: #132a3f;
}

.nodes-table td:nth-child(6),
.nodes-table td:nth-child(7),
.nodes-table td:nth-child(8) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
}

.node-role {
  font-size: 0.78rem;
  font-weight: 600;
  color: #365069;
  background: #eef4fa;
  border: 1px solid #d5e2ee;
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
}

.node-metric {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: #17344c;
}

.node-health-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.1rem 0.52rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.node-health-ok {
  color: #0f5132;
  background: rgba(46, 125, 50, 0.14);
  border: 1px solid rgba(46, 125, 50, 0.3);
}

.node-health-warn {
  color: #7a4a00;
  background: rgba(239, 140, 35, 0.2);
  border: 1px solid rgba(239, 140, 35, 0.32);
}

.node-lag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
}

.prose-card {
  max-width: 760px;
  margin: 0 auto;
}

.prose-card p {
  margin: 0.55rem 0;
}

.contact-card {
  text-align: left;
}

.inline-button {
  display: inline-block;
}

.auth-wrap {
  display: grid;
  place-items: center;
  padding: 2rem 0;
}

.auth-card {
  width: min(460px, 100%);
}

#login-form {
  margin-top: 1rem;
  display: grid;
  gap: 0.55rem;
}

label {
  font-size: 0.9rem;
  color: #172c41;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid #c9d6e2;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}

input:focus {
  border-color: var(--navy);
  outline: 2px solid rgba(11, 59, 96, 0.15);
}

.btn-primary,
.btn-secondary {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
}

.btn-primary:hover {
  background: #0f4b78;
  text-decoration: none;
}

.btn-secondary {
  background: #eef3f8;
  color: #1e3449;
  border-color: #d9e3ee;
}

#login-message {
  margin-top: 0.8rem;
  min-height: 1.2rem;
}

.msg-warning {
  color: #7a4a00;
}

.msg-error {
  color: var(--bad);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(18, 35, 53, 0.56);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 20;
}

.modal-card {
  width: min(540px, 100%);
  background: #fff;
  border: 1px solid #d3dde8;
  border-radius: 10px;
  padding: 1rem;
}

.modal-card h2 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.hidden {
  display: none;
}

.site-footer {
  border-top: 1px solid #e3ebf2;
  background: #fff;
}

.footer-inner {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
}

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

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

  .col-5,
  .col-7,
  .col-12 {
    grid-column: span 12;
  }

  .build-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .chart-box {
    height: 190px;
  }

  .topbar-inner {
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0.65rem 0;
  }

  .topnav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .footer-inner {
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0.5rem 0;
  }
}
