:root {
  --bg: #FFFFFF;
  --surface: #FAFAFA;
  --border: #EEEDE8;
  --border-strong: #D3D1C7;
  --text: #2C2C2A;
  --text-muted: #5F5E5A;
  --text-hint: #888780;
  --primary: #378ADD;
  --primary-soft: #E6F1FB;
  --primary-dark: #185FA5;
  --like: #F09595;
  --like-stroke: #E24B4A;
  --star: #EF9F27;
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.auth-page {
  max-width: 420px;
  margin: 0 auto;
  padding: 32px 20px;
}

h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 20px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}

input:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

button {
  font: inherit;
  font-weight: 500;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 6px;
}

button:hover { background: var(--primary-dark); }

p { font-size: 14px; color: var(--text-muted); }
a { color: var(--primary-dark); }

.errors {
  list-style: none;
  padding: 12px 14px;
  margin: 0 0 16px;
  background: #FDECEC;
  border: 1px solid var(--like);
  border-radius: var(--radius);
  color: var(--like-stroke);
  font-size: 13px;
}

.errors li + li { margin-top: 4px; }

.ob { max-width: 560px; margin: 0 auto; padding: 20px 16px 64px; }

.ob-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.ob-head h1 { margin: 0 0 4px; font-size: 22px; font-weight: 500; }
.ob-sub { margin: 0; font-size: 13px; color: var(--text-muted); }

.ob-skip { margin: 0; }
.ob-skip-btn {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  margin: 0;
  font-size: 13px;
}
.ob-skip-btn:hover { background: var(--surface); color: var(--text); }

.ob-form { display: flex; flex-direction: column; gap: 22px; }

.ob-section h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}

.ob-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ob-card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.ob-card input { position: absolute; opacity: 0; pointer-events: none; }
.ob-card:has(input:checked) {
  background: #E6F1FB;
  border-color: #378ADD;
  color: #0C447C;
  font-weight: 500;
}

.ob-custom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.ob-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ob-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.ob-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ob-chip:has(input:checked) {
  background: #E6F1FB;
  border-color: #378ADD;
  color: #0C447C;
  font-weight: 500;
}

.ob-radius select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  width: 100%;
}

.ob-save { margin-top: 8px; }

/* ========== App shell ========== */
body.app { background: var(--bg); }

.app-main {
  padding-bottom: 80px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.hdr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 0;
  cursor: pointer;
}
.hdr-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}
.hdr-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--primary);
}
.hdr-name { font-size: 17px; font-weight: 500; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}
.drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 78vw;
  max-width: 300px;
  background: #fff;
  padding: 20px 16px;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.15);
  overflow-y: auto;
}
.drawer-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  font-size: 26px;
  padding: 4px 10px;
  cursor: pointer;
}
.drawer-list { list-style: none; margin: 28px 0 0; padding: 0; }
.drawer-list li + li { margin-top: 2px; }
.drawer-list a,
.drawer-logout {
  display: block;
  padding: 12px 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 15px;
}
.drawer-list a:hover { background: var(--surface); }
.drawer-logout {
  background: transparent;
  border: 0;
  text-align: left;
  width: 100%;
  color: var(--like-stroke);
  font: inherit;
  cursor: pointer;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #fff;
  border-top: 0.5px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 2px 0;
}
.bn-item svg { color: var(--text-muted); }
.bn-item.is-active,
.bn-item.is-active svg { color: var(--primary-dark); }
.bn-item.is-active { font-weight: 500; }

/* ========== Discover ========== */
.location-pill-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--border);
}
.location-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 500;
}
.location-radius {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.stories-wrap {
  padding: 12px 0 10px;
  overflow-x: auto;
  border-bottom: 0.5px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.stories {
  display: inline-flex;
  gap: 14px;
  padding: 0 12px;
  min-width: min-content;
}
.story {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  max-width: 76px;
  text-decoration: none;
  color: var(--text);
}
.story-ring {
  display: inline-block;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  padding: 2px;
  background: var(--primary);
}
.story-ring img,
.story-fallback {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #EAE6DC;
  border: 2px solid #fff;
  box-sizing: border-box;
}
.story-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 500;
  color: var(--text-muted);
}
.story-name {
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
  max-width: 70px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.story-dist { font-size: 9px; color: var(--text-hint); }

.feed {
  padding: 14px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.feed-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.card-photo {
  display: block;
  position: relative;
  aspect-ratio: 4 / 5;
  background: #EAE6DC;
  color: var(--text);
  text-decoration: none;
}
.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-photo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 500;
  color: var(--text-muted);
}
.card-dist {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 500;
}
.card-menu {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  border: 0;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.card-menu span { font-size: 14px; line-height: 1; }
.card-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 44px 14px 14px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
}
.card-name { font-size: 18px; font-weight: 500; margin-bottom: 2px; }
.card-meta { font-size: 12px; opacity: 0.9; }
.card-tap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 11px;
  padding: 6px 11px;
  border-radius: 999px;
  font-weight: 500;
}

.tooltip {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 40%;
  z-index: 45;
}
.tooltip-body {
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.4;
}
.tooltip-body button {
  background: #fff;
  color: var(--text);
  margin-top: 10px;
  padding: 8px 14px;
  font-size: 12px;
}

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}
.sheet-panel {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sheet-title {
  font-size: 14px;
  color: var(--text-muted);
  padding: 8px 10px 12px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 6px;
}
.sheet-action {
  display: block;
  padding: 14px 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 15px;
}
.sheet-action:hover { background: var(--surface); }
.sheet-cancel {
  background: transparent;
  color: var(--text-muted);
  margin-top: 6px;
  padding: 14px 10px;
  border-radius: var(--radius);
  font-weight: 500;
}

/* ========== Restaurant detail ========== */
.detail { padding-bottom: 20px; }
.detail-back { padding: 10px 14px 0; }
.back-link {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}

.hero-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  background: #EAE6DC;
  margin-top: 10px;
}
.hero-slide {
  flex: 0 0 100%;
  aspect-ratio: 4 / 3;
  scroll-snap-align: start;
  background: #EAE6DC;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-hint);
}
.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-empty .hero-slide span { font-size: 14px; }

.detail-head {
  padding: 16px 16px 8px;
}
.detail-head h1 { font-size: 22px; font-weight: 500; margin: 0 0 4px; }
.detail-meta { margin: 0; font-size: 13px; color: var(--text-muted); }
.detail-meta .muted { color: var(--text-hint); font-weight: 400; }
.detail-hours {
  margin: 10px 0 2px;
  font-size: 13px;
  color: var(--text-muted);
}
.detail-hours .open { color: #1F7A3A; font-weight: 500; }
.detail-hours .closed { color: var(--like-stroke); font-weight: 500; }
.hours-toggle {
  background: transparent;
  color: var(--primary-dark);
  border: 0;
  padding: 0 0 0 6px;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
}
.hours-list {
  list-style: none;
  padding: 8px 10px;
  margin: 6px 0 0;
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
}
.hours-list li { padding: 2px 0; }
.detail-address { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 16px;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
}
.action-btn.primary {
  background: var(--primary);
  color: #fff;
}
.action-btn.outline {
  border-color: var(--border-strong);
  color: var(--text);
  background: #fff;
}

.add-dish, .prior-dishes { padding: 0 16px; margin-top: 22px; }
.add-dish h2, .prior-dishes h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}
.dish-form { display: flex; flex-direction: column; gap: 12px; }
.dish-form textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  resize: vertical;
  min-height: 70px;
}
.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.inline-check input { width: auto; }

/* ========== Dishes list ========== */
.dishes { padding: 16px 16px 30px; }
.dishes-head h1 { font-size: 22px; font-weight: 500; margin: 0 0 12px; }
.dish-filter {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin-bottom: 16px;
}
.dish-filter input[type="search"],
.dish-filter select {
  font: inherit;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}
.dish-filter button { margin: 0; padding: 9px 14px; }

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
}
.empty-state .muted { color: var(--text-hint); font-size: 13px; }

.dish-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dish-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  padding: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  align-items: flex-start;
}
.dish-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  object-fit: cover;
}
.dish-body { min-width: 0; }
.dish-name { font-size: 15px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.dish-rest { font-size: 12px; color: var(--primary-dark); }
.dish-rest a { color: inherit; text-decoration: none; }
.dish-notes { font-size: 13px; color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.dish-date { font-size: 11px; color: var(--text-hint); margin-top: 4px; }
.heart { color: var(--like-stroke); }
.dish-del {
  background: transparent;
  color: var(--text-hint);
  border: 0;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.dish-del:hover { color: var(--like-stroke); background: transparent; }

/* ========== Profile ========== */
.profile { padding: 20px 16px 30px; max-width: 560px; margin: 0 auto; }
.profile-head h1 { margin: 0 0 2px; font-size: 22px; font-weight: 500; }
.profile .muted { color: var(--text-muted); font-size: 13px; margin: 0; }

.profile-section { margin-top: 22px; }
.profile-section h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}
.sub-section { margin-bottom: 18px; }
.sub-section h3 {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.inline-form select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
}
.inline-form button { margin: 0; padding: 10px 16px; }

.save-btn { margin-top: 6px; }

.profile-links {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}
.profile-links li { padding: 0; }
.profile-links a {
  display: block;
  padding: 12px 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--surface);
  margin-bottom: 6px;
}

.logout-form { margin-top: 12px; }
.logout-btn {
  background: transparent;
  color: var(--like-stroke);
  border: 1px solid var(--border-strong);
  width: 100%;
  margin: 0;
}
.logout-btn:hover { background: #FDECEC; }

.toast {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid var(--primary);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 10px;
}

/* ========== Friends ========== */
.friends { padding: 20px 16px 30px; max-width: 560px; margin: 0 auto; }
.friends-head h1 { margin: 0 0 2px; font-size: 22px; font-weight: 500; }
.friends-head .muted { margin: 0 0 14px; }
.small { font-size: 12px; }

.friend-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.friend-add input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}
.friend-add button { margin: 0; padding: 10px 16px; }

.friend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.friend-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  align-items: center;
}
.friend-body { min-width: 0; }
.friend-name { font-size: 15px; font-weight: 500; }
.friend-email { font-size: 12px; overflow-wrap: anywhere; }
.friend-actions { display: inline-flex; gap: 6px; }
.friend-actions form { margin: 0; }

.btn-accept {
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  margin: 0;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-decline, .btn-remove {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 13px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-decline:hover, .btn-remove:hover {
  color: var(--like-stroke);
  border-color: var(--like);
  background: #FDECEC;
}

/* ========== Check-ins ========== */
.checkin-form { margin: 0; display: contents; }
.action-btn.here {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid var(--primary);
  font-weight: 500;
}
.checkin-share { padding: 0 16px; margin-top: 10px; }
.share-btn {
  width: 100%;
  background: transparent;
  color: var(--primary-dark);
  border: 1px dashed var(--primary);
  padding: 10px 14px;
  font-size: 13px;
  border-radius: var(--radius);
  cursor: pointer;
  margin: 0;
}
.share-btn:hover { background: var(--primary-soft); }

.checkins-banner {
  padding: 10px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.checkin-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.checkin-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 500;
  font-size: 14px;
}
.checkin-body {
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.2;
}
.checkin-body:hover .checkin-place { text-decoration: underline; }
.checkin-place { color: var(--primary-dark); font-weight: 500; }
.checkin-msg { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.checkin-x {
  background: transparent;
  border: 0;
  color: var(--text-hint);
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.checkin-x:hover { color: var(--text); background: transparent; }

/* ========== Redesign: top strip, profile tile, friend-select, invite sheet, activity, admin, settings ========== */

.top-strip {
  padding: 10px 0 4px;
  background: #fff;
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.top-strip .location-pill-row {
  border-bottom: 0;
  padding: 6px 14px 2px;
}

.stories-wrap {
  position: relative;
  padding: 0 8px;
}
.stories {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 6px 6px 8px;
}
.stories::-webkit-scrollbar { display: none; }

.profile-tile {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: linear-gradient(135deg, #378ADD 0%, #2B6CB4 100%);
  color: #fff;
  text-decoration: none;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}
.profile-tile-img { width: 100%; height: 100%; object-fit: cover; }
.profile-tile-initial { font-size: 24px; font-weight: 600; line-height: 1; }

.friend-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: 0;
  padding: 0 2px;
  cursor: pointer;
  min-width: 62px;
}
.friend-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #F3F4F6;
  border: 2px solid transparent;
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.friend-pill.is-selected .friend-ring {
  border-color: #378ADD;
  box-shadow: 0 0 0 2px rgba(55,138,221,0.25);
  transform: scale(1.04);
}
.friend-initial { font-size: 18px; }
.friend-pill-name {
  font-size: 10px;
  color: var(--text-muted);
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-pill.is-selected .friend-pill-name { color: var(--primary-dark); font-weight: 500; }

.stories-cancel {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--primary-dark);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}

.bn-icon-wrap { position: relative; display: inline-flex; }
.bn-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #E53E3E;
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 600;
}

.invite-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.invite-sheet[hidden] { display: none; }
.invite-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.invite-sheet.is-open .invite-sheet-backdrop { opacity: 1; }
.invite-sheet-panel {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  padding: 16px;
  transform: translateY(100%);
  transition: transform 0.24s ease;
  z-index: 1;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.invite-sheet.is-open .invite-sheet-panel { transform: translateY(0); }
.invite-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.invite-sheet-header h2 { font-size: 17px; margin: 0; line-height: 1.25; }
.invite-sheet-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  padding: 0 6px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.invite-restaurant {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.invite-restaurant img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 10px;
}
.invite-rest-name { font-weight: 600; }
.invite-rest-address { font-size: 12px; }
.invite-note-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.invite-note-label textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  resize: vertical;
  min-height: 60px;
}
.invite-sheet-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.btn-primary,
.btn-secondary {
  padding: 10px 16px;
  border-radius: 10px;
  border: 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: #F3F4F6; color: var(--text); }

.toast-host {
  position: fixed;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 70;
}
.toast-item {
  background: rgba(20,20,20,0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 22px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  opacity: 1;
  transition: opacity 0.3s ease;
}
.toast-item.is-leaving { opacity: 0; }

.activity { padding: 14px; max-width: 640px; margin: 0 auto; }
.activity-head h1 { margin: 0 0 4px; }
.activity-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.activity-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.activity-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #378ADD 0%, #2B6CB4 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.activity-avatar img { width: 100%; height: 100%; object-fit: cover; }
.activity-initial { font-size: 18px; font-weight: 600; }
.activity-body { flex: 1 1 auto; }
.activity-line { font-size: 14px; margin-bottom: 4px; }
.activity-note { font-size: 13px; color: var(--text-muted); font-style: italic; margin: 4px 0; }
.activity-meta { font-size: 11px; color: var(--text-hint); margin-bottom: 8px; }
.activity-actions { display: flex; gap: 8px; }
.activity-actions form { display: inline; }
.activity-status { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.activity-accepted { border-color: rgba(34,197,94,0.35); }
.activity-declined { opacity: 0.7; }

.admin { padding: 14px; max-width: 720px; margin: 0 auto; }
.admin-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.admin-head h1 { margin: 0; flex: 1 1 auto; }
.admin-add-btn { text-decoration: none; }
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.admin-kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.admin-kpi-link:hover { border-color: var(--primary); }
.admin-kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.admin-kpi-main { font-size: 32px; font-weight: 600; margin: 4px 0; }
.admin-kpi-sub { font-size: 12px; color: var(--text-muted); }

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}
.admin-users-table th, .admin-users-table td {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 0.5px solid var(--border);
}
.admin-users-table th { background: #F9FAFB; color: var(--text-muted); font-weight: 500; }
.admin-row-actions { display: flex; gap: 10px; align-items: center; }
.admin-row-actions form { display: inline; }
.link-btn {
  background: transparent;
  border: 0;
  color: #B91C1C;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}
.admin-form { max-width: 440px; }
.checkbox-row { display: inline-flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.settings { padding: 14px; max-width: 520px; margin: 0 auto; }
.settings-head h1 { margin: 0; }

.back-link {
  display: inline-block;
  color: var(--primary-dark);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 8px;
}
.back-link:hover { text-decoration: underline; }

.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
.stack-form input[type="email"],
.stack-form input[type="text"],
.stack-form input[type="password"] {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.admin-link { color: var(--primary-dark); font-weight: 500; }

.bn-plate-icon {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: contain;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}
.bn-item.is-active .bn-plate-icon { opacity: 1; }

.like-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ========== Phase B: avatar spec, home, signin banner/prompt, restaurant circles ========== */

.profile-tile {
  background: #FFFFFF;
  border: 1.5px solid #E5E7EB;
  box-shadow: none;
  color: #374151;
}
.profile-tile .profile-tile-initial { color: #374151; }

.friend-ring {
  background: #FFFFFF;
  border: 1.5px solid #E5E7EB;
  color: #374151;
  overflow: hidden;
}
.friend-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.friend-initial { font-size: 18px; color: #374151; font-weight: 600; }

.story-circle {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  padding: 0 2px;
  min-width: 62px;
}
.story-circle-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1.5px solid #E5E7EB;
  overflow: hidden;
  color: #374151;
  font-weight: 600;
}
.story-circle-ring img { width: 100%; height: 100%; object-fit: cover; }
.story-circle-fallback { font-size: 20px; color: #374151; }
.story-circle-name {
  font-size: 10px;
  color: var(--text-muted);
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 8px auto 12px;
}
.avatar-slot {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1.5px solid #E5E7EB;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.avatar-slot img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initial {
  font-size: 36px;
  color: #374151;
  font-weight: 600;
}
.avatar-edit-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  text-align: center;
  padding: 3px 0;
}
.avatar-status { font-size: 12px; min-height: 1em; }
.avatar-status.is-error { color: #B91C1C; }

.signin-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 60px;
  height: 40px;
  background: #FFFFFF;
  border-top: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  font-size: 12px;
  color: #374151;
  z-index: 45;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.signin-banner-text { flex: 1 1 auto; }
.signin-banner-links a { color: #378ADD; text-decoration: none; font-weight: 500; }
.signin-banner-dot { color: #9CA3AF; margin: 0 6px; }

.bottom-nav-anon { grid-template-columns: 1fr; }

.signin-prompt {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
}
.signin-prompt[hidden] { display: none; }
.signin-prompt-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.signin-prompt.is-open .signin-prompt-backdrop { opacity: 1; }
.signin-prompt-panel {
  position: relative;
  background: #FFFFFF;
  border-radius: 14px;
  padding: 22px;
  max-width: 360px;
  width: calc(100% - 40px);
  text-align: center;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.signin-prompt.is-open .signin-prompt-panel { transform: scale(1); opacity: 1; }
.signin-prompt-panel h2 { margin: 0 0 8px; font-size: 18px; }
.signin-prompt-panel p { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; }
.signin-prompt-actions { display: flex; flex-direction: column; gap: 8px; }
.signin-prompt-actions a { text-decoration: none; text-align: center; }
.btn-ghost {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 14px;
  padding: 8px;
  cursor: pointer;
}

.home-landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  padding: 32px 24px;
}
.home-inner {
  text-align: center;
  max-width: 360px;
  width: 100%;
}
.home-icon {
  width: 128px;
  height: 128px;
  margin: 0 auto 18px;
  display: block;
}
.home-wordmark {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #111827;
  letter-spacing: -0.01em;
}
.home-tagline {
  font-size: 18px;
  font-weight: 400;
  color: #6B7280;
  margin: 0 0 28px;
}
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.home-cta {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
}
.home-cta.btn-primary { background: #378ADD; color: #fff; }
.home-cta.btn-secondary {
  background: #FFFFFF;
  color: #378ADD;
  border: 1.5px solid #378ADD;
}
.home-browse {
  display: inline-block;
  color: #6B7280;
  font-size: 13px;
  text-decoration: none;
}
.home-browse:hover { text-decoration: underline; color: #378ADD; }

/* Phase C: card social line, like button, friends here, feed, likedby chip */

.card-social {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  background: #FFFFFF;
  border-top: 1px solid #F3F4F6;
  cursor: pointer;
}
.card-social:hover { background: #FAFBFC; }
.card-social:hover .card-social-text { color: var(--text); }
.card-social-avatars {
  display: inline-flex;
  align-items: center;
}
.card-social-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #FFFFFF;
  background: #F3F4F6;
  object-fit: cover;
  margin-left: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
}
.card-social-avatar:first-child { margin-left: 0; }
.card-social-text { flex: 1 1 auto; color: #374151; }

.like-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}
.like-btn .like-icon { margin-left: 0; }
.like-btn.is-liked { color: var(--primary-dark); }
.like-vis { font-size: 10px; color: var(--text-muted); }

.friends-here {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.friends-here h2 { font-size: 15px; margin: 0 0 8px; }
.friends-here-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.friends-here-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #E5E7EB;
  background: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-decoration: none;
  color: #374151;
  font-weight: 600;
}
.friends-here-avatar img { width: 100%; height: 100%; object-fit: cover; }
.friends-here-initial { font-size: 14px; }
.friends-here-more {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 6px;
}
.friends-here-notes { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.friends-here-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.friends-here-note-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #F3F4F6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}
.friends-here-note img.friends-here-note-avatar { object-fit: cover; }
.friends-here-note-dish { font-weight: 600; color: var(--text); }
.friends-here-note-text { color: var(--text-muted); }

.friends-tabs {
  display: flex;
  gap: 6px;
  margin: 8px 0 4px;
}
.friends-tab {
  padding: 6px 14px;
  background: #F3F4F6;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.friends-tab.is-active {
  background: #378ADD;
  color: #fff;
}

.feed-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feed-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.feed-item-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #F3F4F6;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  font-weight: 600;
  flex-shrink: 0;
}
.feed-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-item-initial { font-size: 14px; }
.feed-item-body {
  flex: 1 1 auto;
  text-decoration: none;
  color: var(--text);
}
.feed-item-line { font-size: 14px; }
.feed-item-note { font-size: 13px; color: var(--text-muted); font-style: italic; margin-top: 4px; }
.feed-item-when { font-size: 11px; color: var(--text-hint); margin-top: 4px; }
.feed-item-thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.likedby-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 14px;
  padding: 4px 10px;
  background: #EEF2FF;
  color: #3B5BDB;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 500;
}
.likedby-x {
  color: #3B5BDB;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
}

.social-form label.inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.social-form select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.profile-save {
  display: block;
  width: 100%;
  margin: 16px 0;
  padding: 14px;
  font-size: 16px;
  font-weight: 500;
  background: #378ADD;
  color: #fff;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.profile-save:hover { background: #2B6CB4; }
.profile-form .profile-section .inline-row select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.profile-form .inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.place-search {
  margin-top: 12px;
}
.place-search input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  box-sizing: border-box;
}
.place-search-state { margin-top: 6px; min-height: 1em; }
.place-search-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.place-search-result a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}
.place-search-result.is-liked a { border-color: rgba(55,138,221,0.4); background: #F5FAFF; }
.place-search-result a:hover { border-color: var(--primary); }
.place-search-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.place-search-thumb-fallback {
  background: #F3F4F6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  font-weight: 600;
  font-size: 18px;
}
.place-search-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.place-search-name {
  font-weight: 500;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.place-search-saved { vertical-align: middle; }
.place-search-meta {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
