:root {
  --bg: #f9f8f4;
  --fg: #1c1c1c;
  --muted: #6b6b6b;
  --accent: #2d5f7e;
  --border: #d8d6cf;
  --error-bg: #fbe9e7;
  --error-fg: #7a1c10;
  --ok-bg: #e6f0ea;
  --ok-fg: #1f4a31;
}

* { box-sizing: border-box; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  margin: 0;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: white;
}

.brand a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

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

.who { color: var(--muted); font-size: 0.9rem; }
.muted { color: var(--muted); }

form.inline { display: inline; }

button, .button {
  background: var(--accent);
  color: white;
  border: 0;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}

button.link {
  background: transparent;
  color: var(--muted);
  padding: 0;
  text-decoration: underline;
  font-size: 0.9rem;
}

main {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

h1 { font-weight: 600; letter-spacing: -0.02em; margin-top: 0; }

.flash {
  max-width: 720px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-fg);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.flash-message, .flash-info {
  background: var(--ok-bg);
  color: var(--ok-fg);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.login {
  max-width: 360px;
  margin: 3rem auto;
  padding: 2rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.login form { display: flex; flex-direction: column; gap: 1rem; }

.login label { display: flex; flex-direction: column; gap: 0.25rem; }
.login label span { font-size: 0.85rem; color: var(--muted); }

.login input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  background: var(--bg);
}

footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 0;
}

/* ===== Phase 1 UI additions ===== */

.primary-nav { display: flex; gap: 1.5rem; }
.primary-nav a {
  text-decoration: none;
  color: var(--fg);
  position: relative;
}
.primary-nav a:hover { color: var(--accent); }

.notif-link .badge {
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.7rem;
  margin-left: 4px;
}

.breadcrumb { font-size: 0.9rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }

.status {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 500;
}
.status-active { background: #e6f0ea; color: #1f4a31; }
.status-paused { background: #fff3cd; color: #6e4f06; }
.status-fulfilled { background: #e0e7ee; color: #2d4762; }
.status-failed { background: #fbe9e7; color: #7a1c10; }
.status-ready_to_book { background: #d6e8ff; color: #0a3470; }
.status-booked { background: #cdd9c0; color: #244216; }
.status-cancelled, .status-expired { background: #ece8e0; color: #5a5750; }

.verdict {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}
.verdict-buy_now { background: #1b873f; color: white; }
.verdict-consider { background: #d6e8ff; color: #0a3470; }
.verdict-wait { background: #fff3cd; color: #6e4f06; }
.verdict-unknown { background: #ece8e0; color: #5a5750; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 500; font-size: 0.85rem; color: var(--muted); }
td a { color: var(--accent); text-decoration: none; }
td a:hover { text-decoration: underline; }

.offers-table td.price { font-weight: 600; }
.runs-table td.error { color: var(--error-fg); font-size: 0.85rem; }

.small { font-size: 0.75rem; }

.actions { display: flex; gap: 0.5rem; margin: 1rem 0; }
button.secondary {
  background: white;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.stacked-form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
.stacked-form label { display: flex; flex-direction: column; gap: 0.25rem; }
.stacked-form label > span { font-size: 0.85rem; color: var(--muted); }
.stacked-form input, .stacked-form select {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  background: white;
}
.form-row { display: flex; gap: 1rem; }
.form-row > label { flex: 1; }
.checkboxes { gap: 1rem; flex-wrap: wrap; }
.checkbox { flex-direction: row !important; align-items: center; gap: 0.5rem; }
.checkbox input { margin: 0; }

details summary { cursor: pointer; padding: 0.5rem 0; user-select: none; }
details summary:hover { color: var(--accent); }

.bullets { padding-left: 1.2rem; }
.bullets li { margin: 0.25rem 0; }

.sparkline { vertical-align: middle; }

.notifications { list-style: none; padding: 0; }
.notification {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 1rem;
  background: white;
}
.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}
.notification-kind {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.notification h3 { margin: 0.5rem 0 0.25rem; font-size: 1rem; }
.notification p { margin: 0 0 0.5rem; color: #444; }
.notification-actions { display: flex; gap: 1rem; align-items: center; font-size: 0.85rem; }
.notification-actions a { color: var(--accent); }

.notification-target_hit { border-left: 4px solid #1b873f; }
.notification-deal_alert { border-left: 4px solid #b3261e; }
.notification-price_drop { border-left: 4px solid var(--accent); }
.notification-buy_now_signal { border-left: 4px solid #1b873f; }
.notification-new_offer { border-left: 4px solid var(--muted); }
