@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #012253;
  --navy2: #0a3a6b;
  --mint: #00e7a7;
  --mint-d: #00a97a;
  --mint-bg: #e6fdf6;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e3ebf5;
  --bg: #f4f7fb;
  --card: #ffffff;
  --danger: #c2362b;
  --warn: #b7791f;
  --radius: 16px;
  --shadow: 0 18px 40px -28px rgba(1, 34, 83, 0.45);
}

* { box-sizing: border-box; }

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

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

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

/* ------------------------------------------------------------------ */
/* Login                                                               */
/* ------------------------------------------------------------------ */
.login-body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 10% 0%, #0a3a6b 0%, #012253 55%, #01183c 100%);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-hero {
  position: relative;
  padding: 48px clamp(28px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(1, 24, 60, 0.55), rgba(1, 24, 60, 0.82)),
    url("/static/login-1000.webp") center/cover no-repeat;
  overflow: hidden;
}

.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/static/hero-pattern.svg") center/cover no-repeat;
  opacity: 0.16;
  pointer-events: none;
}

.login-brand, .login-copy, .login-foot { position: relative; z-index: 1; }

.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand img { width: 56px; height: 56px; object-fit: contain; }
.login-brand strong { display: block; font-size: 1.25rem; letter-spacing: 0.2px; }
.login-brand span { display: block; font-size: 0.8rem; color: var(--mint); font-weight: 600; }

.login-copy h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  margin: 0 0 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-copy h1 span { color: var(--mint); }
.login-copy p { max-width: 34ch; color: #d7e3f4; line-height: 1.6; margin: 0 0 28px; }

.login-features { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.login-features li {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #eaf2fb;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
}

.login-foot { color: #9fb4d1; font-size: 0.8rem; }

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafe 100%);
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 30px 60px -40px rgba(1, 34, 83, 0.55);
  padding: 34px;
}

.login-badge {
  display: inline-block;
  background: var(--mint-bg);
  color: var(--mint-d);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.login-card h2 { margin: 0 0 8px; font-size: 1.6rem; color: var(--navy); letter-spacing: -0.02em; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 0.8rem; font-weight: 700; color: var(--navy); margin-bottom: 7px; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 11px;
  padding: 13px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--mint-d);
  box-shadow: 0 0 0 4px rgba(0, 231, 167, 0.16);
}

.btn-primary {
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 14px 16px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #0a3a6b, #012253);
  box-shadow: 0 14px 26px -14px rgba(1, 34, 83, 0.6);
  transition: transform 0.12s, filter 0.12s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }

.login-error {
  background: #fff1ef;
  color: var(--danger);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 14px;
}

.login-note { text-align: center; color: var(--muted); font-size: 0.76rem; margin: 16px 0 0; }

/* ------------------------------------------------------------------ */
/* Dashboard                                                           */
/* ------------------------------------------------------------------ */
.topbar {
  background: linear-gradient(180deg, #0a3a6b 0%, #012253 100%);
  color: #fff;
  box-shadow: 0 10px 30px -18px rgba(1, 34, 83, 0.8);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px clamp(16px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand strong { display: block; font-size: 1rem; line-height: 1.1; }
.brand span { display: block; font-size: 0.72rem; color: var(--mint); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 0.78rem; font-weight: 700; color: #d9f9ee; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(0, 231, 167, 0.18); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.updated { font-size: 0.75rem; color: #b9cbe2; }
.user { font-size: 0.78rem; color: #e6eef8; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout {
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--mint);
  padding: 8px 13px;
  border-radius: 999px;
}
.logout:hover { background: #3af0be; }

.page { max-width: 1440px; margin: 0 auto; padding: 26px clamp(16px, 3vw, 32px) 48px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: clamp(1.4rem, 2.4vw, 2rem); color: var(--navy); letter-spacing: -0.02em; }
.page-head p { margin: 6px 0 0; font-size: 0.85rem; }

.uptime-pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  box-shadow: var(--shadow);
}

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

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--mint), var(--mint-d));
}
.kpi-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.kpi-top span { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-top em { font-style: normal; font-size: 0.7rem; color: #9aa9bd; }
.kpi strong { display: block; font-size: 1.75rem; line-height: 1.1; color: var(--navy); letter-spacing: -0.03em; margin-bottom: 10px; }
.kpi small { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 8px; }

.bar { height: 7px; border-radius: 999px; background: #edf2f9; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--mint-d), var(--mint)); transition: width 0.5s ease; }
.bar.warn i { background: linear-gradient(90deg, #d69e2e, #f6c453); }
.bar.danger i { background: linear-gradient(90deg, #a93226, #e05a4a); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 1.1rem; color: var(--navy); letter-spacing: -0.01em; }
.panel-head p { margin: 4px 0 0; font-size: 0.78rem; }

.ranges { display: flex; gap: 6px; flex-wrap: wrap; }
.ranges button {
  border: 1px solid var(--line);
  background: #fbfdff;
  color: var(--navy);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.ranges button.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.ranges button:hover:not(.active) { border-color: var(--mint-d); }

.peaks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.peak {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.peak span { display: block; font-size: 0.68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.peak strong { display: block; font-size: 1.05rem; color: var(--navy); margin-top: 4px; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card { border: 1px solid var(--line); border-radius: 13px; padding: 12px 12px 8px; background: #fff; }
.chart-card h3 { margin: 0 0 8px; font-size: 0.82rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.chart-box { position: relative; height: 220px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid #eef3f9; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .name { font-weight: 700; color: var(--navy); }

.tag { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.tag.ok { background: var(--mint-bg); color: var(--mint-d); }
.tag.warn { background: #fff7e6; color: var(--warn); }
.tag.bad { background: #fff1ef; color: var(--danger); }
.tag.muted { background: #eef3f9; color: var(--muted); }

.health-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.health-card { border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px; background: #fff; }
.health-card h3 { margin: 0 0 10px; font-size: 0.82rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.health-list, .error-list { display: flex; flex-direction: column; gap: 8px; font-size: 0.83rem; }
.health-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; background: #f8fbff; }
.health-row b { color: var(--navy); }
.error-row { padding: 8px 10px; border-radius: 9px; background: #f8fbff; color: #334155; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.74rem; word-break: break-word; }
.error-row.warn { background: #fffaf0; color: #8a5a12; }
.empty { color: var(--muted); font-size: 0.82rem; }

.foot { text-align: center; color: var(--muted); font-size: 0.76rem; padding: 6px 0 0; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .peaks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { min-height: 260px; padding: 28px; }
  .login-copy h1 { font-size: 1.8rem; }
  .login-copy p { display: none; }
  .login-features { display: none; }
  .login-foot { display: none; }
  .charts { grid-template-columns: 1fr; }
  .health-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .table th:nth-child(2), .table td:nth-child(2),
  .table th:nth-child(4), .table td:nth-child(4) { display: none; }
  .table th, .table td { padding: 9px 8px; font-size: 0.78rem; }
  .table td:nth-child(3) { white-space: normal; }
}

@media (max-width: 560px) {
  .topbar-inner { flex-direction: column; align-items: flex-start; }
  .topbar-right { width: 100%; justify-content: flex-start; gap: 10px; }
  .user { display: none; }
  .kpis { grid-template-columns: 1fr; }
  .peaks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding-top: 18px; }
  .panel { padding: 14px; }
  .chart-box { height: 190px; }
}
