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

:root {
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1a1a1a;
  --muted: #6b7280;
  --yes: #16a34a;
  --yes-bg: #dcfce7;
  --maybe: #d97706;
  --maybe-bg: #fef3c7;
  --accent: #2563eb;
  --accent-bg: #eff6ff;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

header h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dot {
  color: var(--accent);
}

#user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

#current-user {
  font-weight: 600;
  color: var(--text);
}

#logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Login overlay */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#login-overlay.hidden {
  display: none;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-card h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}

.input-row input:focus {
  border-color: var(--accent);
}

.input-row button {
  padding: 12px 18px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  font-weight: 700;
}

.error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

/* Weeks list */
main {
  padding: 12px 16px 80px;
  max-width: 480px;
  margin: 0 auto;
}

.week-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}

.week-card.expanded {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.week-header:active {
  background: var(--bg);
}

.week-dates {
  font-size: 15px;
  font-weight: 600;
}

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

.week-voters {
  display: flex;
  gap: 4px;
  align-items: center;
}

.voter-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.voter-count {
  font-size: 12px;
  color: var(--muted);
}

/* Expanded week content */
.week-body {
  display: none;
  padding: 0 16px 16px;
}

.week-card.expanded .week-body {
  display: block;
}

.destination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.dest-left {
  flex: 1;
  min-width: 0;
}

.dest-name {
  font-size: 15px;
  font-weight: 600;
}

.dest-votes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.vote-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.vote-pill.yes {
  background: var(--yes-bg);
  color: var(--yes);
}

.vote-pill.maybe {
  background: var(--maybe-bg);
  color: var(--maybe);
}

/* Vote buttons */
.vote-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 12px;
}

.vote-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.vote-btn:active {
  transform: scale(0.95);
}

.vote-btn.active-yes {
  background: var(--yes-bg);
  border-color: var(--yes);
  color: var(--yes);
}

.vote-btn.active-maybe {
  background: var(--maybe-bg);
  border-color: var(--maybe);
  color: var(--maybe);
}

/* Empty state */
.empty-msg {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

/* Add destination */
.add-dest-row {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.autocomplete-wrap {
  flex: 1;
  position: relative;
}

.autocomplete-wrap input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.autocomplete-wrap input:focus {
  border-color: var(--accent);
}

.autocomplete-list {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
  overflow: hidden;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.autocomplete-list:empty {
  display: none;
}

.ac-item {
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.ac-item:last-child {
  border-bottom: none;
}

.ac-item:hover, .ac-item:active {
  background: var(--accent-bg);
  color: var(--accent);
}

.add-dest-row button {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}
