@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:wght@600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --base: #faf9f5;
  --accent: #2d5d8a;
  --text-1: #29261b;
  --text-2: rgba(41,38,27,.6);
  --text-3: rgba(41,38,27,.38);
  --f-display: 'Source Serif 4', Georgia, serif;
  --f-body: 'Plus Jakarta Sans', sans-serif;
  --ok: #3f6b4d;
  --warn: #c9962d;
  --crit: #c14343;
  --card-bg: rgba(255,255,255,.72);
  --border: rgba(41,38,27,.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--base);
  color: var(--text-1);
  font-family: var(--f-body);
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--f-display); margin: 0; }

#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 320px;
  box-shadow: 0 8px 30px rgba(0,0,0,.06);
}

.login-card h1 { font-size: 22px; margin-bottom: 4px; color: var(--accent); }
.login-card p.sub { color: var(--text-2); font-size: 13px; margin: 0 0 24px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.field input {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); font-family: var(--f-body); font-size: 14px;
  background: #fff;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px; padding: 10px 16px;
  font-family: var(--f-body); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: opacity .15s;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; margin-top: 6px; }
.btn-primary:hover { opacity: .9; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.error-msg { color: var(--crit); font-size: 13px; margin-top: 10px; min-height: 16px; }

#app-view { display: none; }
#app-view.visible { display: block; }
#login-view.hidden { display: none; }

header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--base); z-index: 10;
}
header.topbar h1 { font-size: 20px; color: var(--accent); }
header.topbar .right { display: flex; align-items: center; gap: 14px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.pulse-dot.stale { background: var(--text-3); }

main { max-width: 1200px; margin: 0 auto; padding: 24px 28px 60px; }

.banner {
  border-radius: 14px; padding: 16px 20px; margin-bottom: 22px;
  display: flex; align-items: center; gap: 12px; font-weight: 600;
}
.banner.clear { background: rgba(63,107,77,.12); color: var(--ok); }
.banner.alert { background: rgba(193,67,67,.12); color: var(--crit); }
.banner .count { font-family: var(--f-display); font-size: 20px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }

.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px;
}
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin-bottom: 10px; font-family: var(--f-body); font-weight: 600; }
.stat-value { font-family: var(--f-display); font-size: 30px; }
.stat-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.stat-value.warn { color: var(--warn); }
.stat-value.crit { color: var(--crit); }

canvas.spark { width: 100%; height: 40px; display: block; margin-top: 8px; }

section { margin-bottom: 28px; }
section > h2 { font-size: 16px; margin-bottom: 12px; color: var(--text-1); }

.svc-row, .domain-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  margin-bottom: 8px; background: var(--card-bg); font-size: 14px;
}
.svc-name { font-weight: 600; }
.svc-meta { color: var(--text-2); font-size: 12px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; display: inline-block; vertical-align: middle; }
.status-dot.up { background: var(--ok); }
.status-dot.down { background: var(--crit); }
.status-dot.warn { background: var(--warn); }

.feed-item {
  display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); margin-bottom: 8px; background: var(--card-bg);
  align-items: flex-start;
}
.feed-item .sev {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0;
}
.sev-critical { background: var(--crit); }
.sev-warning { background: var(--warn); }
.sev-info { background: var(--text-3); }
.feed-body { flex: 1; }
.feed-type { font-weight: 600; font-size: 13px; }
.feed-detail { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.feed-meta { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.feed-item .ack-btn { font-size: 11px; padding: 4px 10px; }
.feed-item.acked { opacity: .45; }
.empty-state { color: var(--text-2); font-size: 13px; padding: 20px; text-align: center; }

@media (max-width: 640px) {
  header.topbar { padding: 14px 16px; }
  main { padding: 16px 16px 40px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
