:root {
  color-scheme: light;
  --bg: #f6f1e8;
  --ink: #1f2624;
  --muted: #6c746f;
  --panel: rgba(255, 252, 244, 0.88);
  --line: rgba(31, 38, 36, 0.13);
  --yes: #20b26b;
  --yes-soft: #ddf8eb;
  --maybe: #e7b72f;
  --maybe-soft: #fff2c5;
  --no: #e55d4f;
  --no-soft: #ffe2df;
  --shadow: 0 24px 70px rgba(54, 44, 27, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(32, 178, 107, 0.16), transparent 30rem),
    radial-gradient(circle at top right, rgba(231, 183, 47, 0.2), transparent 28rem),
    var(--bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 24px; }

.hero {
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,0.82), rgba(255,247,228,0.86));
  box-shadow: var(--shadow);
}

.topbar, .hero-grid, .controls-card, .timeline-toolbar, .session, .range-controls, .view-tabs {
  display: flex;
  align-items: center;
}

.topbar { justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.03em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: white; background: #17201d; font-size: 13px; }
.session { gap: 10px; color: var(--muted); }

.hero-grid { align-items: stretch; justify-content: space-between; gap: 28px; padding: 70px 10px 10px; }
.hero-copy { max-width: 720px; }
.eyebrow { margin: 0 0 10px; color: var(--yes); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.16em; }
h1, h2 { margin: 0; letter-spacing: -0.055em; }
h1 { font-size: clamp(48px, 8vw, 104px); line-height: 0.9; max-width: 780px; }
h2 { font-size: clamp(24px, 3vw, 38px); }
.lede { max-width: 610px; color: var(--muted); font-size: 20px; line-height: 1.55; }

.login-card, .controls-card, .best-days, .timeline-view, .stat-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.login-card { width: min(430px, 100%); padding: 26px; align-self: flex-end; }
.login-card p { color: var(--muted); line-height: 1.5; }
.google-signin { min-height: 44px; margin: 14px 0 8px; }
.auth-note { margin: 6px 0 16px; font-size: 13px; }
.auth-note.ready { color: #087744; }
.login-form label, .range-controls label, .timeline-toolbar label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.login-row { display: flex; gap: 10px; margin-top: 8px; }
input, select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 13px;
  background: white;
  color: var(--ink);
}
button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  color: white;
  background: #17201d;
  font-weight: 800;
}
.secondary-button { width: 100%; margin-top: 12px; color: var(--ink); background: white; border: 1px solid var(--line); }
.secondary-button { width: auto; margin-top: 0; }

.workspace { display: grid; gap: 18px; margin-top: 22px; }
.controls-card { justify-content: space-between; gap: 18px; padding: 22px; }
.range-controls { flex-wrap: wrap; gap: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-card { padding: 20px; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card strong { display: block; margin-top: 8px; font-size: 42px; letter-spacing: -0.05em; }
.stat-card.positive strong { color: var(--yes); }
.view-tabs { gap: 8px; padding: 6px; width: fit-content; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.55); }
.tab { color: var(--muted); background: transparent; }
.tab.active { color: white; background: #17201d; }

.calendar-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 18px; align-items: start; }
.best-days { position: sticky; top: 18px; padding: 20px; }
.best-days-list { display: grid; gap: 10px; margin-top: 16px; }
.best-day { display: grid; gap: 4px; padding: 14px; border-radius: 18px; background: white; border: 1px solid var(--line); }
.best-day strong { font-size: 17px; }
.best-day span { color: var(--muted); font-size: 13px; }

.calendar-scroll {
  display: grid;
  gap: 18px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 6px;
  scroll-behavior: smooth;
}
.month-card { border: 1px solid var(--line); border-radius: 28px; padding: 18px; background: rgba(255,255,255,0.72); }
.month-title { margin: 0 0 14px; font-size: 28px; letter-spacing: -0.04em; }
.weekday-grid, .days-grid { display: grid; grid-template-columns: repeat(7, minmax(96px, 1fr)); gap: 8px; }
.weekday { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; padding: 0 8px; }
.day-cell {
  min-height: 138px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  background:
    linear-gradient(rgba(32, 178, 107, var(--yes-alpha, 0)), rgba(32, 178, 107, var(--yes-alpha, 0))),
    rgba(255,255,255,0.88);
}
.day-cell.blank { visibility: hidden; }
.day-cell.top-day { outline: 3px solid rgba(32,178,107,0.28); }
.day-head, .vote-counts { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.date-number { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: #f2eadc; font-weight: 900; }
.yes-score { color: var(--yes); font-weight: 900; }
.vote-counts { justify-content: flex-start; flex-wrap: nowrap; margin: 12px 0; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 24px; border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 900; }
.pill.yes { color: #087744; background: var(--yes-soft); }
.pill.maybe { color: #916b00; background: var(--maybe-soft); }
.pill.no { color: #a92d23; background: var(--no-soft); }
.vote-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vote-buttons button { min-height: 34px; padding: 0 6px; color: var(--muted); background: #f7f2e9; font-size: 12px; }
.vote-buttons button.active[data-vote="yes"] { color: white; background: var(--yes); }
.vote-buttons button.active[data-vote="maybe"] { color: #372800; background: var(--maybe); }
.vote-buttons button.active[data-vote="no"] { color: white; background: var(--no); }

.timeline-view { padding: 20px; }
.timeline-toolbar { justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.timeline-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: white; }
.timeline-table { border-collapse: separate; border-spacing: 0; min-width: 980px; width: 100%; }
.timeline-table th, .timeline-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px; text-align: center; white-space: nowrap; }
.timeline-table th { position: sticky; top: 0; z-index: 2; background: #fffaf0; font-size: 12px; }
.timeline-table th:first-child, .timeline-table td:first-child { position: sticky; left: 0; z-index: 3; text-align: left; background: #fffaf0; font-weight: 900; }
.timeline-table .summary-row td { background: #f7f2e9; font-weight: 900; }
.vote-dot { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 900; }
.vote-dot.yes { color: white; background: var(--yes); }
.vote-dot.maybe { color: #3d2c00; background: var(--maybe); }
.vote-dot.no { color: white; background: var(--no); }
.vote-dot.empty { color: var(--muted); background: #eee7dc; }

@media (max-width: 980px) {
  .hero-grid, .controls-card, .calendar-layout { grid-template-columns: 1fr; flex-direction: column; }
  .hero-grid { padding-top: 42px; }
  .login-card { align-self: stretch; }
  .calendar-layout { display: grid; }
  .best-days { position: static; }
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell { padding: 12px; }
  .hero { border-radius: 24px; padding: 16px; }
  .topbar, .timeline-toolbar { align-items: flex-start; flex-direction: column; }
  .login-row { flex-direction: column; }
  .weekday-grid, .days-grid { grid-template-columns: repeat(7, minmax(74px, 1fr)); }
  .calendar-scroll { max-height: none; }
  .day-cell { min-height: 128px; padding: 8px; }
}
