/* Design tokens: light blue (shared with WeekWrap) */
:root {
  --bg: #EEF2F9;
  --surface: #FFFFFF;
  --border: #E2E8F5;
  --text: #0F172A;
  --muted: #64748B;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: #EAF1FF;
  --danger: #DC2626;
  --danger-soft: #FEECEC;
  --success: #16A34A;
  --success-soft: #EAF7EF;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(31, 27, 22, 0.18));
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

header p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* Period picker (WeekWrap's tab pills as a segmented control) */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.analyze-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Buttons */
button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  border-radius: 999px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

button.primary:hover { opacity: 0.92; }
button.primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* Section labels */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Hero digest */
.hero-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}

#hero-run-at {
  margin-bottom: 14px;
}

#hero-headline {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 10px;
}

.hero-total {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-total .amount { color: var(--text); font-weight: 500; }

#hero-summary {
  font-size: 14px;
  margin-bottom: 18px;
}

/* Mover rows */
.mover-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mover-row.up { border-left-color: var(--danger); }
.mover-row.down { border-left-color: var(--success); }

.mover-service { font-size: 14px; font-weight: 500; }

.mover-note { font-size: 12px; color: var(--muted); margin-top: 2px; }

.mover-numbers {
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: right;
  flex: none;
}

.mover-amounts { color: var(--muted); font-size: 11px; }

.delta-up { color: var(--danger); }
.delta-down { color: var(--success); }

.delta-badge {
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 8px;
}

.delta-badge.up { background: var(--danger-soft); color: var(--danger); }
.delta-badge.down { background: var(--success-soft); color: var(--success); }
.delta-badge.new { background: var(--accent-soft); color: var(--accent); }

/* Tags */
.tag {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 9px;
}

/* History */
#history-list {
  max-height: 380px;
  overflow-y: auto;
  margin: 0 -8px -8px;
  padding: 0 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#history-list::-webkit-scrollbar { width: 6px; }
#history-list::-webkit-scrollbar-track { background: transparent; }
#history-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
#history-list::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.history-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.history-item:last-child { margin-bottom: 0; }

.history-item:hover { border-color: var(--accent); background: var(--surface); }

.history-headline { font-size: 14px; margin-bottom: 6px; }

.history-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.entry-date {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

/* Status + spinner */
#run-status { font-size: 13px; min-height: 20px; margin-top: 10px; }
.status-ok { color: var(--success); }
.status-err { color: var(--danger); }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Utility */
.mt-8 { margin-top: 8px; }
.mt-20 { margin-top: 20px; }
.mt-28 { margin-top: 28px; }
.text-muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
