:root {
  --forest: #174c3a;
  --forest-deep: #10382b;
  --forest-soft: #e5f1e9;
  --sage: #d8e9de;
  --cream: #f8f4e9;
  --paper: #fffefa;
  --ink: #18342c;
  --muted: #66766f;
  --line: #dce4de;
  --purple: #6747a5;
  --purple-deep: #4e337f;
  --purple-soft: #f0ebf8;
  --tag-bg: #eaf0f5;
  --tag-ink: #40586a;
  --amber: #a96808;
  --amber-soft: #fff3d8;
  --coral: #a9404b;
  --coral-soft: #fbeaec;
  --shadow: 0 5px 18px rgba(27, 57, 46, .07);
  --shadow-raised: 0 14px 40px rgba(22, 45, 37, .18);
  --radius: 17px;
  --radius-small: 11px;
  --touch: 46px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

button {
  appearance: none;
  min-height: var(--touch);
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: var(--forest);
  color: #fff;
  padding: 10px 15px;
  font-weight: 780;
  cursor: pointer;
  transition: background-color 170ms ease, border-color 170ms ease, color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

button:hover { background: var(--forest-deep); }
button:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: .7; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(103, 71, 165, .28);
  outline-offset: 2px;
}

button.quiet { background: var(--paper); color: var(--forest); border-color: var(--line); }
button.quiet:hover { background: var(--forest-soft); border-color: #bdd1c4; }
button.compact { min-height: 38px; padding: 7px 11px; font-size: .84rem; }

.app-header, main { width: min(100%, 980px); margin-inline: auto; padding-inline: 20px; }

.app-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 10px;
  padding-bottom: 6px;
}

.brand-lockup { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; }
.brand-mascot { width: 72px; height: 72px; flex: 0 0 auto; object-fit: contain; }
.brand-copy { display: grid; min-width: 0; }
.brand-copy strong { color: var(--forest-deep); font-size: 1.7rem; line-height: 1; letter-spacing: .06em; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.account-menu { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
#hello { color: var(--muted); font-size: .86rem; font-weight: 650; }

main { padding-bottom: 36px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.48rem, 4.2vw, 2rem); line-height: 1.15; letter-spacing: -.025em; }
h2 { margin-bottom: 8px; font-size: 1.18rem; line-height: 1.25; }
h3 { margin-bottom: 6px; font-size: 1rem; line-height: 1.3; }
p { margin-bottom: 10px; }

.eyebrow { margin-bottom: 5px; color: var(--forest); font-size: .68rem; font-weight: 850; letter-spacing: .13em; }
.muted, .hint { color: var(--muted); }
.small, .hint { font-size: .86rem; }
.page-intro { padding: 13px 3px 4px; }
.page-intro h1 { max-width: 580px; }
.page-heading { margin: 14px 2px 12px; align-items: center !important; }
.page-heading > div { min-width: 0; }
.page-heading p:last-child { margin-bottom: 0; }
.page-mascot { width: 88px; height: 88px; object-fit: contain; flex: 0 0 auto; }

nav {
  position: relative;
  z-index: 4;
  display: flex;
  gap: 7px;
  margin: 4px 0 14px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 254, 250, .94);
  box-shadow: 0 3px 12px rgba(27, 57, 46, .06);
}

nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  white-space: nowrap;
}

nav button:hover { background: var(--forest-soft); color: var(--forest); }
nav button.active { background: var(--forest); color: #fff; box-shadow: 0 3px 10px rgba(23, 76, 58, .2); }
nav svg, button svg { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
button.primary-action svg { fill: currentColor; stroke: none; }
.nav-short { display: none; }

.tab { display: none; }
.tab.active { display: block; animation: tab-in 160ms ease-out; }
@keyframes tab-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.card, .recommendation-section {
  margin: 11px 0;
  padding: 17px;
  border: 1px solid rgba(220, 228, 222, .86);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.attendee-card, .filter-card { position: relative; overflow: hidden; }
.attendee-card::after { content: ""; position: absolute; top: 0; right: 0; width: 86px; height: 5px; border-radius: 0 0 0 8px; background: var(--purple); }

label { display: block; color: var(--ink); font-size: .83rem; font-weight: 740; }

input, select, textarea {
  display: block;
  width: 100%;
  min-height: var(--touch);
  margin-top: 5px;
  padding: 10px 12px;
  border: 1px solid #bdcbc2;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

input::placeholder, textarea::placeholder { color: #8b9992; }
input:hover, select:hover, textarea:hover { border-color: #9fb3a7; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(103, 71, 165, .1); }
textarea { min-height: 82px; resize: vertical; }

.grid, .filters { display: grid; gap: 11px; }
.grid button { align-self: end; }
.filters { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 14px 0 15px; }
.filters label:first-child { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; min-height: var(--touch); padding-top: 8px; }
.check input { width: 20px; min-height: 20px; height: 20px; margin: 0; accent-color: var(--forest); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0; }
.chip { min-height: 40px; display: inline-flex; align-items: center; gap: 0; padding: 8px 12px; border: 1px solid #b9cfc1; border-radius: 999px; background: var(--forest-soft); color: var(--forest); font-size: .87rem; box-shadow: none; }
.chip:hover { background: var(--sage); }
.chip.selected { border-color: var(--forest); background: var(--forest); color: #fff; }
.chip.partial { border-color: #a78dce; background: var(--purple-soft); color: var(--purple-deep); }
.chip-status { display: inline-block; width: 0; overflow: hidden; transition: width 150ms ease, margin-right 150ms ease; }
.chip.selected .chip-status, .chip.partial .chip-status { width: 1em; margin-right: 3px; }
.chip.selected .chip-status::before { content: "✓"; }
.chip.partial .chip-status::before { content: "–"; }
.chip.everyone-chip { border-color: var(--purple); background: var(--purple); color: #fff; box-shadow: 0 3px 9px rgba(103, 71, 165, .18); }
.chip.everyone-chip:hover { background: var(--purple-deep); }
.chip.everyone-chip.partial { border-color: #a78dce; background: var(--purple-soft); color: var(--purple-deep); }

.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.person { display: flex; align-items: center; gap: 8px; min-height: var(--touch); padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .9rem; font-weight: 620; cursor: pointer; transition: background-color 150ms ease, border-color 150ms ease; }
.person:has(input:checked) { border-color: #8eb39c; background: var(--forest-soft); }
.person input { width: 19px; min-height: 19px; height: 19px; margin: 0; accent-color: var(--forest); }

.primary-action { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 52px; background: var(--purple); box-shadow: 0 7px 16px rgba(103, 71, 165, .2); font-size: .98rem; }
.primary-action:hover { background: var(--purple-deep); }

.dice-status { position: relative; display: flex; align-items: center; gap: 13px; min-height: 102px; margin: 14px 0; padding: 10px 16px 10px 8px; overflow: hidden; border: 1px solid #d6c9ea; border-radius: var(--radius); background: var(--purple-soft); color: var(--purple-deep); }
.dice-status[hidden] { display: none; }
.dice-status img { width: 92px; height: 92px; flex: 0 0 auto; object-fit: contain; }
.dice-status strong, .dice-status span { display: block; }
.dice-status strong { margin-bottom: 3px; font-size: 1rem; }
.dice-status span { color: #6d607b; font-size: .86rem; }
.dice-status i { width: 18px; height: 18px; margin-left: auto; flex: 0 0 auto; border: 2px solid #c9b8e2; border-top-color: var(--purple); border-radius: 50%; animation: spin .75s linear infinite; }
.result-status { background: #f5f1fb; }
.result-status img { width: 104px; height: 104px; }
@keyframes spin { to { transform: rotate(360deg); } }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.recommendation-section { margin-top: 16px; padding: 17px; box-shadow: 0 7px 22px rgba(27, 57, 46, .075); }
.top-section { border-top: 5px solid var(--forest); }
.unique-section { border-color: #d9cbea; border-top: 5px solid var(--purple); background: #f6f1fb; }
.unique-section .eyebrow, .unique-section h2 { color: var(--purple-deep); }
.sparkle { color: var(--purple); font-size: 1.8rem; }
.more-section { border-top: 5px solid #9daea2; background: #fcfcf8; }

.cards { display: grid; gap: 10px; }
.cards > .card { margin: 0; }
.restaurant { position: relative; padding: 15px; box-shadow: none; }
.restaurant h3 { margin: 0 94px 4px 0; font-size: 1.02rem; }
.restaurant p { margin-bottom: 9px; font-size: .86rem; }
.restaurant p:last-child { margin-bottom: 0; }
.score { position: absolute; top: 14px; right: 14px; padding: 5px 8px; border-radius: 8px; background: var(--forest-soft); color: var(--forest); font-size: .76rem; font-weight: 850; }
.unique-section .score { background: #e5daf4; color: var(--purple-deep); }

.badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.badge { padding: 4px 8px; border-radius: 999px; background: var(--tag-bg); color: var(--tag-ink); font-size: .72rem; font-weight: 720; }
.badge.price { background: var(--forest-soft); color: var(--forest); }
.badge.category { background: var(--purple-soft); color: var(--purple-deep); }
.group-favorites { color: var(--amber); font-weight: 760; }
.address { color: #53665d; }
.map-link { display: inline-flex; align-items: center; min-height: 38px; margin: 0 0 10px; color: var(--forest); font-weight: 780; text-underline-offset: 3px; }

.rating { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.rating label { min-width: max-content; }
.rating select { width: 132px; margin: 0; }
.pref-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pref-toggle { min-height: 40px; }
.pref-toggle.chosen { border-color: #d8b96f; background: var(--amber-soft); color: var(--amber); }
.pref-toggle.deal { border-color: #bdaee0; background: var(--purple-soft); color: var(--purple-deep); }
.note-label { margin-top: 12px; }
.save-note { margin-top: 7px; }

.guide-list { gap: 8px; }
.guide-item { width: 100%; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-align: left; box-shadow: 0 2px 7px rgba(27, 57, 46, .035); }
.guide-item:hover { border-color: #b7cbbf; background: #fff; }
.guide-item > span:first-child { min-width: 0; }
.guide-item b { display: block; overflow: hidden; text-overflow: ellipsis; }
.favorite-mark { color: var(--amber); }
.guide-item small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: .78rem; font-weight: 540; text-overflow: ellipsis; }
.guide-price { flex: 0 0 auto; color: var(--forest); font-size: .78rem; font-weight: 820; }
.guide-arrow { margin-left: 5px; color: #88968f; font-size: 1.1rem; }

dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 28px); overflow: auto; padding: 21px; border: 1px solid rgba(255,255,255,.7); border-radius: 19px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow-raised); }
dialog::backdrop { background: rgba(16, 56, 43, .52); }
.close-dialog, .close-user-dialog, .close-restaurant-editor { float: right; }
.detail-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.reviews { margin-top: 12px; }
.review { padding: 11px 0; border-top: 1px solid var(--line); }
.review span { display: block; color: var(--muted); font-size: .86rem; }
.review p { margin: 5px 0 0; }

.admin-user { display: flex; align-items: center; justify-content: space-between; gap: 11px; min-height: 58px; padding: 10px 0; border-top: 1px solid var(--line); }
.admin-user p { margin: 2px 0 0; font-size: .8rem; }
.lifecycle-card { border-left: 4px solid #9aac9f; }
.deleted-card { border-left-color: var(--coral); background: #fffdfc; }
.danger-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 17px; }
.destructive-soft { color: var(--coral) !important; border-color: #ebc4c8 !important; background: var(--coral-soft) !important; }

.connection-status { margin: 5px 0 10px; padding: 10px 12px; border: 1px solid #c7b8df; border-radius: 11px; background: var(--purple-soft); color: var(--purple-deep); font-size: .86rem; font-weight: 740; }
.connection-status.offline { border-color: #c7b8df; background: var(--purple-soft); color: var(--purple-deep); }

#toast { position: fixed; z-index: 20; bottom: 18px; left: 50%; display: none; width: max-content; max-width: calc(100% - 28px); padding: 11px 15px; border-radius: 11px; background: var(--forest-deep); color: #fff; box-shadow: var(--shadow-raised); font-size: .88rem; font-weight: 700; text-align: center; transform: translateX(-50%); }
#toast.show { display: block; }

body.login { display: grid; min-height: 100dvh; place-items: center; padding: 20px; }
.auth { width: min(100%, 430px); margin: 0; padding: 24px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin: -5px 0 12px; }
.auth-brand img { width: 86px; height: 86px; object-fit: contain; }
.auth-brand strong { display: block; color: var(--forest-deep); font-size: 2rem; line-height: 1; letter-spacing: .06em; }
.auth-brand span { display: block; margin-top: 5px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.auth form label { margin-top: 12px; }
.auth form > button { width: 100%; margin-top: 14px; }
.password-input { display: flex; align-items: center; gap: 6px; }
.password-input input { flex: 1; min-width: 0; }
.password-input button { flex: 0 0 auto; }
.error { min-height: 1.2em; margin: 8px 0; color: var(--coral); font-size: .86rem; font-weight: 650; }

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filters label:first-child { grid-column: span 2; }
  .people { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-list { grid-template-columns: 1fr; }
  .recommendation-section > .cards > .restaurant { height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
