:root {
  --bg: #0b0d12;
  --surface: #151922;
  --surface-2: #1d222d;
  --border: #262c39;
  --text: #e8ecf4;
  --muted: #8d97ab;
  --accent: #6ea8fe;
  --success: #3ecf8e;
  --warning: #f2b544;
  --error: #ff6b6b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}

/* ---- top bar ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(11, 13, 18, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -0.01em; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-actions form { margin: 0; }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- panels ---- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 { margin: 0; font-size: 0.95rem; font-weight: 600; letter-spacing: 0.01em; }
p { margin: 4px 0 0; }

.muted { color: var(--muted); font-size: 0.85rem; }
.empty { margin: 10px 0 0; }

/* ---- buttons ---- */

button {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 550;
  border-radius: 10px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s ease, opacity 0.15s ease;
}

button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: default; }

button.primary { background: var(--accent); border-color: transparent; color: #06111f; }
button.ghost { background: transparent; }
button.danger { background: transparent; border-color: #4a2630; color: var(--error); }

/* ---- status pill ---- */

.pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.pill.ok { color: var(--success); border-color: #1e4536; background: #10241c; }
.pill.bad { color: var(--warning); border-color: #453a1e; background: #241f12; }

/* ---- push instructions ---- */

.steps {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

.steps li { margin-bottom: 6px; }
.steps[hidden] { display: none; }

/* ---- agents ---- */

.agents { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.agents[hidden] { display: none; }

.agents li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
}

.agents .name { font-weight: 600; font-size: 0.88rem; }
.agents .meta { color: var(--muted); font-size: 0.75rem; }
.agents .token-cell { display: flex; align-items: center; gap: 6px; }

/* ---- feed ---- */

.feed { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.event {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: 10px;
  padding: 10px 12px;
  animation: slide-in 0.25s ease;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.event.success { border-left-color: var(--success); }
.event.warning { border-left-color: var(--warning); }
.event.error { border-left-color: var(--error); }
.event.info { border-left-color: var(--accent); }

.event .head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.event .title { font-weight: 600; font-size: 0.92rem; }
.event .time { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.event .body { color: var(--text); font-size: 0.87rem; margin-top: 3px; opacity: 0.92; }
.event .task { color: var(--muted); font-size: 0.78rem; margin-top: 5px; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  margin-top: 6px;
  margin-right: 5px;
}

/* ---- login ---- */

.login-body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px;
  text-align: center;
}

.login-card h1 { margin: 10px 0 0; font-size: 1.4rem; letter-spacing: -0.02em; }
.login-card .subtitle { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.login-card form { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; text-align: left; }
.login-card label { font-size: 0.78rem; color: var(--muted); font-weight: 550; }

.login-card input {
  font: inherit;
  font-size: 1rem;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  /* iOS zooms the viewport on focus if the font is under 16px */
}

.login-card button {
  margin-top: 6px;
  padding: 12px;
  font-size: 0.95rem;
  background: var(--accent);
  border-color: transparent;
  color: #06111f;
  font-weight: 650;
}

.error {
  color: var(--error);
  font-size: 0.82rem;
  text-align: center;
  margin: 2px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .event { animation: none; }
  button:active { transform: none; }
}
