:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --bg-soft: #FFE699;
  --bg-dark: #C0850E;
  --bg-deep: #F4EDD4;
  --surface: #F4F3F1;
  --line: #1A1A1A;
  --line-muted: #E5E2DE; 
  --text: #1A1A1A;
  --bg-form: #FFFFFF;
  --text-muted: #7b7359;
  --brand: #FFC144;
  --danger: #c0392b;
  --danger-action: #c0392b;
  --success: #16a34a;
  --toast-bg: #fff3e0;
  --toast-border: #FFC144;
  --toast-text: #7b4f00;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --radius: 12px;
  --top-bar-h: 64px;
  --bottom-nav-h: 72px;
  --browser-bottom-ui: 0px;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-old(bottom-nav),
::view-transition-new(bottom-nav) {
  animation: none;
}

::view-transition-old(app-main),
::view-transition-new(app-main) {
  animation-duration: 180ms;
  animation-timing-function: ease;
}

::view-transition-old(app-main) {
  animation-name: fade-out-main;
}

::view-transition-new(app-main) {
  animation-name: fade-in-main;
}

@keyframes fade-out-main {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

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

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.5;
  background: radial-gradient(circle at top, var(--bg), var(--bg) 36%);
  color: var(--text);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.top-bar {
  min-height: var(--top-bar-h);
  padding: calc(env(safe-area-inset-top) + var(--space-3)) var(--space-4)
    var(--space-3) var(--space-4);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.top-bar__title {
  font-size: 1rem;
  font-weight: 700;
}

.top-bar__actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.app-main {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4)
    calc(var(--space-5) + var(--browser-bottom-ui)) var(--space-4);
}
.app-main {
  view-transition-name: app-main;
}

section {
  margin-bottom: var(--space-5);
}

h1 {
  margin: 0 0 var(--space-3);
  font-size: 1.25rem;
}

h2 {
  margin: 0 0 var(--space-3);
  font-size: 1rem;
}

.bottom-nav {
  view-transition-name: bottom-nav;
  width: min(900px, 100%);
  margin: 0 auto;
  min-height: var(--bottom-nav-h);
  padding: var(--space-2) var(--space-3)
    calc(
      max(var(--space-2), env(safe-area-inset-bottom)) +
        var(--browser-bottom-ui)
    );
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: grid;
  grid-auto-flow: column;
  gap: var(--space-2);
}

@media (display-mode: standalone) {
  :root {
    --browser-bottom-ui: 0px;
  }
}
.bottom-nav a {
  min-height: 52px;
  border-radius: 12px;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  color: var(--line);
  text-decoration: none;
  background: transparent;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.bottom-nav a[aria-current="page"] {
  background: transparent;
}

.bottom-nav__icon {
  --nav-icon-color: var(--line);
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: var(--nav-icon-color);
  transition: background-color 140ms ease;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.bottom-nav a[aria-current="page"] .bottom-nav__icon {
  --nav-icon-color: var(--brand);
}

.bottom-nav__icon--home {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M3 10.5 12 3l9 7.5V21h-6v-6H9v6H3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M3 10.5 12 3l9 7.5V21h-6v-6H9v6H3z'/%3E%3C/svg%3E");
}

.bottom-nav__icon--friends {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle fill='%23fff' cx='9' cy='7' r='3'/%3E%3Cpath fill='%23fff' d='M1 19.5V18c0-2.2 3.6-4 8-4s8 1.8 8 4v1.5H1z'/%3E%3Ccircle fill='%23fff' cx='18' cy='7' r='2.5'/%3E%3Cpath fill='%23fff' d='M14.5 14.2C15.5 14.1 16.7 14 18 14c3.3 0 5.5 1.5 5.5 3.5V19h-5.5v-1c0-1.5-.9-2.9-3.5-3.8z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle fill='%23fff' cx='9' cy='7' r='3'/%3E%3Cpath fill='%23fff' d='M1 19.5V18c0-2.2 3.6-4 8-4s8 1.8 8 4v1.5H1z'/%3E%3Ccircle fill='%23fff' cx='18' cy='7' r='2.5'/%3E%3Cpath fill='%23fff' d='M14.5 14.2C15.5 14.1 16.7 14 18 14c3.3 0 5.5 1.5 5.5 3.5V19h-5.5v-1c0-1.5-.9-2.9-3.5-3.8z'/%3E%3C/svg%3E");
}

.bottom-nav__icon--create {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M11 5v6H5v2h6v6h2v-6h6v-2h-6V5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M11 5v6H5v2h6v6h2v-6h6v-2h-6V5z'/%3E%3C/svg%3E");
}

.btn,
button,
input,
textarea {
  font: inherit;
}

button {
  border: none;
}

.btn,
button {
  min-height: 44px;
  border-radius: 10px;
  padding: 0 var(--space-3);
  color: var(--text);
  background: var(--line-muted);
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.btn:hover,
button:hover {
  background: color-mix(in srgb, var(--bg-soft), black 10%);
}

.btn:active,
button:active {
  background: color-mix(in srgb, var(--bg-soft), black 16%);
  border-color: var(--brand);
  transform: translateY(1px);
}

a.btn {
  text-decoration: none;
  text-align: center;
  padding-top: var(--space-3);
}

.btn-primary {
  background: var(--brand);
  color: #000;
  font-weight: 600;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--brand), white 15%);
  border-color: color-mix(in srgb, var(--brand), white 15%);
}

.btn-primary:active {
  background: color-mix(in srgb, var(--brand), black 10%);
  border-color: color-mix(in srgb, var(--brand), black 10%);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-text {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.btn-popdown.is-selected button {
  border-radius: 10px 10px 0px 0px;
}
.btn-popdown .popdown {
  border-radius: 0px 0px 10px 10px;
}

input,
textarea {
  background: var(--bg-form);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: var(--space-3);
}

input.is-invalid {
  border-color: var(--danger-action);
}

input[type="checkbox"],
input[type="radio"] {
  padding: 0;
  border: none;
  background: none;
  accent-color: var(--brand);
}

label {
  color: var(--text-muted);
  font-size: 0.95rem;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

small {
  color: var(--text-muted);
}

pre {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  padding: var(--space-3);
  border-radius: 10px;
  overflow-x: auto;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--avatar-color, var(--brand));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  cursor: default;
}

.badge--joined {
  background: color-mix(in srgb, var(--success), transparent 80%);
  color: var(--success);
}

.badge--pending {
  background: color-mix(in srgb, var(--text-muted), transparent 80%);
  color: var(--text-muted);
  cursor: pointer;
}

.badge--pending:hover {
  background: color-mix(in srgb, var(--text-muted), transparent 65%);
}

#friends-list li,
#pending-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line-muted);
  border-radius: var(--radius);
}

.list-empty {
  background: none;
  border: none;
  color: var(--text-muted);
  font-style: italic;
  padding: 0;
}

.friends-list__phone {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.register-greeting {
  margin: 0 0 var(--space-4);
  color: var(--text-muted);
}

.register-greeting strong {
  color: var(--text);
}

.page-notice {
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: var(--space-4);
}

.page-notice--error {
  background: color-mix(in srgb, var(--danger), transparent 85%);
  border: 1px solid color-mix(in srgb, var(--danger), transparent 55%);
  color: var(--danger);
}

#note-form-message {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(app-main),
  ::view-transition-new(app-main) {
    animation-duration: 0ms;
  }
}

/* ── Create Wizard ─────────────────────────────────────── */

.wizard-progress {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.wizard-progress__bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line-muted);
  transition: background 250ms ease;
}

.wizard-progress__bar.is-active {
  background: var(--brand);
}

.wizard-progress__bar.is-done {
  background: color-mix(in srgb, var(--brand), transparent 50%);
}

.wizard-headline {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-5);
}

.wizard-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.wizard-nav {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.wizard-nav .btn {
  flex: 1;
}

/* Previous locations */

.previous-locations__heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.previous-locations__pills {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* Suggestion pills */

.suggestion-pill {
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  font-size: 0.9rem;
  background: var(--surface);
}

.suggestion-pill:hover {
  background: var(--bg-soft);
}

.suggestion-pill.is-selected {
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 600;
}

/* Day list */

.day-item {
  background: var(--surface);
}

.day-item__btn {
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  font-size: 1rem;
}

.day-item__btn:hover {
  background: var(--bg-soft);
}

.day-item.is-selected .day-item__btn {
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 600;
  border-bottom: none;
}

.day-item__time {
  padding: var(--space-2) var(--space-4) var(--space-3);
}

.day-item.is-selected .day-item__time {
  border: 1px solid var(--brand);
  border-top: none;
  background: var(--bg-soft);
}

.day-item__time input[type="time"] {
  font-size: 1.25rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  color: var(--text-muted);
}

/* Friend select */
.friend-select-item {
  background: var(--surface);
}

.friend-select-item:hover {
  background: var(--bg-soft);
}

.friend-select-item.is-selected {
  background-color: var(--brand);
  border-color: var(--line);
}

.friend-select-item__check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line);
  transition:
    background 120ms,
    border-color 120ms;
}

.friend-select-item.is-selected .friend-select-item__check {
  background: var(--bg-dark);
  border-color: var(--bg-dark);
}

/* ── Bid summary (step 4 review) ────────────────────────── */

.bid-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.bid-summary__row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}

.bid-summary__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  min-width: 56px;
  flex-shrink: 0;
}

.bid-summary__value {
  font-size: 0.95rem;
  color: var(--text);
}

/* ── Location autocomplete dropdown ─────────────────────── */

.location-dropdown {
  position: absolute;
  top: calc(100% - var(--space-3));
  left: 0;
  right: 0;
  z-index: 100;
  list-style: none;
  margin: 0;
  padding: var(--space-1) 0;
  background: var(--bg-form);
  border: 1px solid var(--line-muted);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  max-height: 260px;
  overflow-y: auto;
}

.location-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
}

.location-option__name {
  font-size: 0.95rem;
  color: var(--text);
}

.location-option__address {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 55%;
}

/* ── Home feed ───────────────────────────────────────────── */

.feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.feed-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.feed-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: var(--space-3) var(--space-4);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
}

.feed-tab:hover {
  background: none;
  border-bottom-color: color-mix(in srgb, var(--brand) 50%, transparent);
}

.feed-tab:active {
  background: none;
  transform: none;
  border-color: transparent;
  border-bottom-color: var(--brand);
}

.feed-tab.is-active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

.feed-tab.is-active:hover {
  border-bottom-color: var(--brand);
}

.bid-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bid-card {
  background: var(--surface);
  border: 1px solid var(--line-muted);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.date-badge {
  display: inline-block;
  align-self: flex-start;
  padding: var(--space-1) var(--space-3);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--line-muted);
  color: var(--text);
}

.date-badge--today {
  background: var(--bg-soft);
}

.bid-card__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.bid-card__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.bid-card__joiners {
  font-size: 0.875rem;
  color: var(--text);
}

.bid-card__waiting {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

.bid-respond-btn {
  font-size: 0.85rem;
  padding: var(--space-2) var(--space-3);
}

.bid-status-btn {
  font-size: 0.85rem;
  padding: var(--space-2) var(--space-3);
  width: 100%;
}

.bid-responded {
  font-size: 0.875rem;
  color: var(--bg-dark);
  margin: 0;
}

.bid-card--clickable {
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.bid-card--clickable:hover {
  background: color-mix(in srgb, var(--surface), black 5%);
  border-color: var(--line-muted);
}

/* ── Activity detail page ────────────────────────────────── */

.activity-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: var(--space-5);
}

.activity-loading {
  color: var(--text-muted);
  font-style: italic;
}

.activity-eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0;
}

.activity-eyebrow--today {
  color: var(--brand);
}

.activity-eyebrow--meet {
  color: var(--success);
}

.activity-headline {
  font-size: 1.5rem;
  font-weight: 700;
  margin: var(--space-1) 0 var(--space-3);
}

.activity-meta-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.95rem;
  color: var(--text);
}

.activity-meta-icon {
  font-size: 1rem;
  line-height: 1.5;
  flex-shrink: 0;
}

.activity-meta-text {
  line-height: 1.5;
}

.activity-meta-link {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.activity-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: var(--space-4) 0 var(--space-2);
}

.activity-joiner__name {
  font-size: 0.95rem;
  font-weight: 500;
}

.activity-joiner__phone {
  font-size: 0.8rem;
  color: var(--brand);
  text-decoration: underline;
  font-variant-numeric: tabular-nums;
}

.avatar--pending {
  background: transparent;
  border: 2px dashed var(--text-muted);
  color: var(--text-muted);
}

.friend-select-item--pending {
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
}

.friend-select-item--pending .friend-select-item__name-info {
  grid-column: 2;
  grid-row: 1;
  gap: 1px;
}

.friend-select-item--pending .friend-select-item__check {
  grid-column: 3;
  grid-row: 1;
}

.friend-select-item__pending-label {
  font-size: 0.8rem;
}

.friend-select-item__resend {
  grid-column: 2 / 4;
  grid-row: 2;
  font-size: 0.8rem;
}

.activity-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  width: fit-content;
}

.activity-status-badge--on-my-way {
  background: color-mix(in srgb, var(--brand), transparent 80%);
  color: var(--brand);
}

.activity-status-badge--arrived {
  background: color-mix(in srgb, var(--success), transparent 80%);
  color: var(--success);
}

.btn-danger {
  background: transparent;
  border-color: var(--danger-action);
  color: var(--danger-action);
  font-weight: 600;
}

.btn-danger:active {
  background: color-mix(in srgb, var(--danger-action), transparent 85%);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger-action), transparent 85%);
}

/* ── Swipe-to-delete (Yours feed) ─────────────────────── */

.bid-card-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.bid-card-delete-bg {
  position: absolute;
  inset: 0;
  background: var(--danger-action);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: var(--space-4);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.bid-card-wrap .bid-card {
  position: relative;
  margin-bottom: 0;
  transition: transform 200ms ease;
}

.bid-card-wrap.is-swiping .bid-card {
  transition: none;
}

/* ── Toast notifications ──────────────────────────────── */

.toast {
  position: fixed;
  top: calc(var(--top-bar-h) + var(--space-3));
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  color: var(--toast-text);
  border-radius: 20px;
  padding: var(--space-3) var(--space-5);
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition:
    opacity 200ms ease,
    transform 200ms ease;
  pointer-events: none;
  z-index: 100;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
