@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

:root {
  --brand: #0039fa;
  --brand-700: #12359b;
  --brand-950: #06194e;
  --bg: #fcfcfd;
  --bg-card: #ffffff;
  --text: #11181c;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 18px 55px -20px rgba(15, 23, 42, 0.35);
  --pink: #ffd1dc;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --font: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(0, 57, 250, 0.08), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(255, 209, 220, 0.35), transparent 50%),
    linear-gradient(160deg, var(--bg) 0%, #fff 45%, #f0f4ff 100%);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-page {
  min-height: 100vh;
  padding: 2rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-grid {
  width: min(1100px, 100%);
  display: grid;
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 960px) {
  .auth-grid { grid-template-columns: 1.1fr 0.9fr; gap: 3.5rem; }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-950) 92%, transparent);
  color: #eff6ff;
  padding: 0.25rem 0.35rem 0.25rem 0.35rem;
  font-size: 0.7rem;
  box-shadow: var(--shadow);
}
.hero-badge span.pill {
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hero-badge span.tag { padding-right: 0.65rem; color: #dbeafe; }

.hero h1 {
  margin: 1rem 0 0.75rem;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.hero h1 .grad {
  display: block;
  background: linear-gradient(90deg, var(--brand), var(--brand-700), var(--brand-950));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.15rem;
}
.hero p.lead {
  margin: 0;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.feature-row {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 640px) {
  .feature-row { grid-template-columns: repeat(3, 1fr); }
}
.feature {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.82);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.feature .cat {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.feature .title { margin-top: 0.35rem; font-size: 0.88rem; font-weight: 600; }
.feature .body { margin-top: 0.2rem; font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

.card {
  width: 100%;
  max-width: 420px;
  justify-self: end;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: rgba(255,255,255,0.92);
  border-radius: 28px;
  padding: 1.6rem 1.5rem 2rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}
@media (max-width: 959px) {
  .card { justify-self: stretch; max-width: none; }
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.card-head img.icon {
  width: 40px;
  height: 40px;
  border-radius: 16%;
  box-shadow: var(--shadow);
}
.card-head .eyebrow {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card-head h2 {
  margin: 0.1rem 0 0;
  font-size: 0.95rem;
  font-weight: 650;
}
.card .hint {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

label {
  display: grid;
  gap: 0.35rem;
  margin-top: 1rem;
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--text);
}
input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: #fff;
}
input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--brand);
}

.btn {
  margin-top: 1.15rem;
  width: 100%;
  border: 0;
  border-radius: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn:hover { background: var(--brand-700); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary {
  background: transparent;
  color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border));
}
.btn.secondary:hover { background: color-mix(in srgb, var(--brand) 6%, white); }

.divider {
  display: grid;
  place-items: center;
  margin: 1.1rem 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider::before {
  content: "";
  width: 100%;
  height: 1px;
  background: var(--border);
  grid-row: 1;
  grid-column: 1;
}
.divider span {
  grid-row: 1;
  grid-column: 1;
  background: #fff;
  padding: 0 0.65rem;
}

.err {
  margin-top: 0.85rem;
  color: var(--err);
  font-size: 0.85rem;
}
.ok {
  margin-top: 0.85rem;
  color: var(--ok);
  font-size: 0.85rem;
}

/* Dashboard shell */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(252, 252, 253, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.app-top .brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.app-top .brand img.logo { height: 28px; width: auto; }
.app-top .brand .product {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--brand);
  letter-spacing: 0.02em;
}
.app-top nav { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.app-top nav a, .app-top nav button.linkish {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--text-muted);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}
.app-top nav a:hover, .app-top nav button.linkish:hover,
.app-top nav a.active {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  text-decoration: none;
}
.app-main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.app-main h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.app-main .sub {
  margin: 0.35rem 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.server-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .server-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .server-grid { grid-template-columns: repeat(3, 1fr); }
}

.server-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 1rem;
  padding: 1rem 1.05rem 1.1rem;
  box-shadow: var(--shadow);
}
.server-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.server-card h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
}
.server-card .role {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
}
.badge.up { background: #dcfce7; color: #166534; }
.badge.down { background: #fee2e2; color: #991b1b; }
.badge.unknown { background: #f1f5f9; color: #475569; }

.metrics {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
}
.metric .k {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 550;
}
.metric .v {
  margin-top: 0.1rem;
  font-size: 0.95rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.panel {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.panel header h2 { margin: 0; font-size: 0.95rem; }
.panel iframe {
  width: 100%;
  height: min(72vh, 720px);
  border: 0;
  background: #fff;
}

.logo-mark {
  height: 36px;
  width: auto;
  display: block;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.crumb { margin: 0 0 0.5rem; font-size: 0.85rem; }
.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.15rem;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  text-decoration: none;
}
.status-chip.ok { background: #dcfce7; color: #166534; border-color: transparent; }
.status-chip.warn { background: #ffedd5; color: #9a3412; border-color: transparent; }
.status-chip.err { background: #fee2e2; color: #991b1b; border-color: transparent; }
.status-chip.muted { background: #f8fafc; }

.pill-row { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.pill.active, .pill:hover {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  background: color-mix(in srgb, var(--brand) 6%, white);
}

.link-card { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.link-card:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: 0 8px 28px -16px rgba(0, 57, 250, 0.45);
}
.card-spark { margin-top: 0.75rem; }
.metric .v.small { font-size: 0.78rem; font-weight: 600; }

.metrics-lg {
  grid-template-columns: repeat(2, 1fr);
  margin: 0 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
@media (min-width: 720px) {
  .metrics-lg { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .metrics-lg { grid-template-columns: repeat(5, 1fr); }
}

.charts-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.25rem;
}
@media (min-width: 860px) {
  .charts-grid { grid-template-columns: 1fr 1fr; }
}
.chart-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 1rem;
  padding: 0.85rem 1rem 1rem;
  box-shadow: var(--shadow);
}
.chart-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.chart-card h3 { margin: 0; font-size: 0.88rem; font-weight: 650; }
.chart-body { min-height: 48px; }
.spark { display: block; }
.spark-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.spark-legends {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
}
.spark-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.spark-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.spark-legend b { color: var(--text); font-weight: 650; }
.muted-tiny { font-size: 0.72rem; color: var(--text-muted); }

.two-col {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .two-col { grid-template-columns: 1fr 1fr; }
}
.panel-block {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 1rem;
  padding: 1rem 1.05rem 1.15rem;
  box-shadow: var(--shadow);
}
.panel-block h2 { margin: 0 0 0.75rem; font-size: 0.95rem; }
.panel-block h3 { margin: 0.85rem 0 0.4rem; font-size: 0.82rem; color: var(--text-muted); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 650;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }

.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.backup-group + .backup-group { margin-top: 0.85rem; }
.log-tail {
  margin-top: 0.75rem;
  max-height: 220px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.75rem;
  font-size: 0.68rem;
  line-height: 1.45;
}

.alert-list { display: grid; gap: 0.75rem; }
.alert-card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background: #fff;
  box-shadow: var(--shadow);
}
.alert-card.critical { border-color: #fecaca; background: #fff7f7; }
.alert-card.warning { border-color: #fed7aa; background: #fffbeb; }
.alert-card header { display: flex; align-items: center; gap: 0.55rem; }
.alert-card h3 { margin: 0; font-size: 0.92rem; }
.alert-card p { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--text-muted); }
.empty-ok {
  padding: 2rem 1rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 1rem;
  color: var(--ok);
  font-weight: 600;
  background: #f0fdf4;
}

.info-rows { display: grid; gap: 0; }
.info-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.info-rows span { color: var(--text-muted); }
.info-rows b { font-weight: 650; text-align: right; }

.btn.inline {
  width: auto;
  margin-top: 0;
  display: inline-flex;
  padding: 0.55rem 1rem;
}
.btn.danger {
  background: #dc2626;
}
.btn.danger:hover { background: #b91c1c; }
.server-grid.compact { margin-top: 0.5rem; }

.head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 25, 78, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal {
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 1.15rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
}
.modal > header h2 { margin: 0; font-size: 1.05rem; }
.modal-close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-body { padding: 1rem 1.15rem; }
.modal-body p { margin: 0 0 0.75rem; font-size: 0.88rem; color: var(--text-muted); line-height: 1.45; }
.modal-body code {
  font-size: 0.78rem;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
}
.purge-hosts {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
}
.purge-hosts li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.purge-hosts li:last-child { border-bottom: 0; }
.check-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.82rem;
  margin: 0.75rem 0;
  cursor: pointer;
}
.check-row.danger-opt { color: #9a3412; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .app-top { flex-direction: column; align-items: flex-start; }
  .app-top nav { width: 100%; }
  .head-actions { align-items: stretch; width: 100%; }
}
