:root {
  --bg: #faf6f0;
  --card: #ffffff;
  --ink: #2d2a26;
  --muted: #6b6660;
  --accent: #c1462f;
  --accent-soft: #e8a896;
  --green: #5a7a5a;
  --green-soft: #d6e8d2;
  --amber: #d4a93f;
  --amber-soft: #fdf4e0;
  --line: #e8e0d4;
  --shadow: 0 1px 3px rgba(45,42,38,0.04), 0 4px 12px rgba(45,42,38,0.06);

  --morning-bg: linear-gradient(135deg, #fef3e2 0%, #fce0bd 100%);
  --morning-ink: #8a5a1a;
  --lunch-bg: linear-gradient(135deg, #fff4d4 0%, #f7c97a 100%);
  --lunch-ink: #7a5a1c;
  --dinner-bg: linear-gradient(135deg, #fce5e2 0%, #e89d97 100%);
  --dinner-ink: #8c2a30;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Hiragino Sans", "Microsoft JhengHei", sans-serif;
  line-height: 1.65;
  padding: 28px 16px 80px;
}
.wrap { max-width: 920px; margin: 0 auto; }
body.locked .wrap { filter: blur(4px); pointer-events: none; user-select: none; }

header.top {
  background: linear-gradient(135deg, #fef8ee 0%, #fbe9d6 100%);
  border-radius: 16px;
  padding: 28px 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 24px;
  position: relative;
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.18em; font-size: 11px; color: var(--accent); font-weight: 600; }
h1 { font-size: 26px; margin: 6px 0 4px; font-weight: 700; letter-spacing: -0.01em; }
.dates { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

/* Inline-editable text (h1 title, subtitle, etc.) */
.editable {
  cursor: text;
  border-radius: 6px;
  padding: 0 4px;
  margin-left: -4px;
  margin-right: -4px;
  transition: background 0.15s, box-shadow 0.15s;
  position: relative;
}
.editable:hover {
  background: rgba(255,255,255,0.6);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.editable:hover::after {
  content: '✏️';
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.6;
  pointer-events: none;
}
.editable:empty::before,
.editable[data-empty]::before {
  content: attr(data-placeholder);
  opacity: 0.4;
}
.inline-edit-input {
  width: 100%;
  background: white;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  color: inherit;
  outline: none;
  box-shadow: 0 0 0 3px rgba(193,70,47,0.15);
}
.header-tools { position: absolute; top: 18px; right: 18px; display: flex; gap: 8px; align-items: center; }
.tool-btn {
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(193,70,47,0.2);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
}
.tool-btn:hover { background: white; border-color: var(--accent); }
.tool-btn.view-all-btn { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.tool-btn.view-all-btn.active { background: var(--ink); color: white; border-color: var(--ink); }
.tool-btn.regenerate-btn { background: var(--accent); color: white; border-color: var(--accent); font-weight: 700; }
.tool-btn.regenerate-btn:hover { background: #a3331f; border-color: #a3331f; }
.tool-btn.regenerate-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.tool-btn.view-todos-btn { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.tool-btn.view-todos-btn.active { background: var(--ink); color: white; border-color: var(--ink); }

/* Section-level discussion area (trip-overall, day-N-overall) */
.section-discuss {
  background: rgba(255,255,255,0.6);
  border: 1px dashed var(--accent-soft);
  border-radius: 12px;
  padding: 8px 14px;
  margin: 14px 0;
}
.section-discuss-trip {
  background: linear-gradient(135deg, #fef8ee 0%, #fbe9d6 100%);
  border-color: rgba(193,70,47,0.25);
  margin: 14px 0 20px;
}
.section-discuss .card-body { padding: 4px 0; }
.section-discuss-prompt {
  font-size: 13px; color: var(--muted); font-weight: 600;
  padding: 4px 0;
}
.section-discuss .comments { margin-top: 8px; }

/* TODOS list */
.todo-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: white; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
  border-left: 3px solid var(--amber);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.todo-item .todo-emoji { font-size: 28px; flex-shrink: 0; }
.todo-item .todo-body { flex: 1; min-width: 0; }
.todo-item .todo-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.todo-item .todo-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.todo-item .todo-meta {
  display: flex; gap: 8px; align-items: center; margin-top: 6px;
  font-size: 12px; color: var(--muted); flex-wrap: wrap;
}
.todo-item .todo-time { background: #fef0eb; color: var(--accent); padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.todo-item .todo-actions {
  display: flex; gap: 6px; flex-shrink: 0; align-items: center;
  flex-direction: column;
}
.todo-jump, .todo-done {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 12px; font-weight: 600;
  font-family: inherit; background: white; color: var(--ink);
  white-space: nowrap;
}
.todo-jump:hover { background: var(--ink); color: white; border-color: var(--ink); }
.todo-done {
  background: #d6e8d2; color: #3d6b3d; border-color: #82bd82;
}
.todo-done:hover { background: #5a8a5a; color: white; border-color: #5a8a5a; }
@media (max-width: 600px) {
  .todo-item .todo-actions { flex-direction: row; }
}
.view-badge {
  background: var(--accent); color: white;
  font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
  min-width: 18px; text-align: center;
}
.tool-btn.view-all-btn.active .view-badge { background: var(--accent); color: white; }
.who-am-i {
  background: rgba(255,255,255,0.6);
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid rgba(193,70,47,0.15);
  font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.who-am-i .name { font-weight: 700; color: var(--accent); }
.who-am-i .change-btn {
  background: transparent; border: none;
  color: var(--muted); cursor: pointer; font-size: 11px;
  text-decoration: underline; padding: 0; font-family: inherit;
}

nav.tabs { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
.tab {
  flex: 1; min-width: 140px;
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; font-family: inherit;
  text-align: center; transition: all 0.15s; box-shadow: var(--shadow);
}
.tab .day-num { display: block; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 0.05em; }
.tab .day-title { display: block; font-size: 14px; font-weight: 700; margin-top: 2px; color: var(--ink); }
.tab .day-date { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.tab.active { background: var(--ink); border-color: var(--ink); }
.tab.active .day-num, .tab.active .day-date { color: rgba(255,255,255,0.7); }
.tab.active .day-title { color: white; }
.tab:hover:not(.active) { border-color: var(--accent-soft); }

.day-panel { display: none; }
.day-panel.active { display: block; }

.day-overview {
  background: var(--card); border-radius: 14px;
  padding: 18px 22px; box-shadow: var(--shadow);
  border: 1px solid var(--line); margin-bottom: 18px;
}
.day-overview h2 { margin: 0 0 6px; font-size: 19px; }
.day-overview .focus { color: var(--muted); font-size: 14px; margin: 0; }
.day-overview .day-maps-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  background: white; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: all 0.15s;
}
.day-overview .day-maps-btn:hover {
  background: #e8f0fe; border-color: #4285f4; color: #1a73e8;
}

/* MEAL BLOCK */
.meal-block {
  margin: 28px 0; border-radius: 16px; overflow: hidden;
  border: 2px solid var(--line); box-shadow: var(--shadow); background: white;
}
.meal-block.morning { border-color: #f5cda3; }
.meal-block.lunch { border-color: #f7c97a; }
.meal-block.dinner { border-color: #e89d97; }
.meal-block-header { padding: 18px 22px; display: flex; align-items: center; gap: 14px; font-weight: 700; }
.meal-block.morning .meal-block-header { background: var(--morning-bg); color: var(--morning-ink); }
.meal-block.lunch .meal-block-header { background: var(--lunch-bg); color: var(--lunch-ink); }
.meal-block.dinner .meal-block-header { background: var(--dinner-bg); color: var(--dinner-ink); }
.meal-block-header .meal-icon { font-size: 28px; flex-shrink: 0; }
.meal-block-header .meal-titles { flex: 1; }
.meal-block-header .meal-title { display: block; font-size: 17px; line-height: 1.2; }
.meal-block-header .meal-subtitle { display: block; font-size: 12px; opacity: 0.75; margin-top: 4px; font-weight: 600; }
.meal-block-header .meal-time-range {
  background: rgba(255,255,255,0.65);
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 700;
}
.meal-block-body { padding: 16px 14px 18px; background: #fbfaf7; }

/* ACTIVITY CARDS */
.act-card {
  background: white; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.act-card:last-child { margin-bottom: 0; }
.card-banner {
  height: 130px; padding: 14px 18px;
  display: flex; align-items: flex-end; gap: 14px;
  color: white; position: relative;
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.card-banner::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(transparent 30%, rgba(0,0,0,0.55) 100%); z-index: 0;
}
.card-banner > * { position: relative; z-index: 1; }
.card-banner .b-emoji { font-size: 38px; flex-shrink: 0; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4)); }
.card-banner .b-text { flex: 1; min-width: 0; }
.card-banner .b-title { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.card-banner .b-subtitle { display: block; font-size: 12px; opacity: 0.95; margin-top: 3px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.card-banner .b-maps {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255,255,255,0.95); color: var(--ink);
  text-decoration: none; padding: 5px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15); z-index: 2;
}
.card-banner .b-maps:hover { background: white; }

.banner-food { background-color: #c45e3a; background-image: linear-gradient(135deg, #f7a26d 0%, #c45e3a 100%); }
.banner-cafe { background-color: #8a5e3c; background-image: linear-gradient(135deg, #d4a574 0%, #8a5e3c 100%); }
.banner-shrine { background-color: #8c3f3f; background-image: linear-gradient(135deg, #c97676 0%, #8c3f3f 100%); }
.banner-nature { background-color: #2f7a55; background-image: linear-gradient(135deg, #6cb28b 0%, #2f7a55 100%); }
.banner-water { background-color: #2c6a8c; background-image: linear-gradient(135deg, #5fa8c8 0%, #2c6a8c 100%); }
.banner-volcano { background-color: #5c2929; background-image: linear-gradient(135deg, #a85c5c 0%, #5c2929 100%); }
.banner-castle { background-color: #524628; background-image: linear-gradient(135deg, #8a7a5c 0%, #524628 100%); }
.banner-hotel { background-color: #6e5e44; background-image: linear-gradient(135deg, #b0a085 0%, #6e5e44 100%); }
.banner-transit { background-color: #3b5a7a; background-image: linear-gradient(135deg, #7c9bb5 0%, #3b5a7a 100%); }
.banner-bar { background-color: #3a1f2c; background-image: linear-gradient(135deg, #6b3e54 0%, #3a1f2c 100%); }
.banner-flight { background-color: #2f4d75; background-image: linear-gradient(135deg, #6c8eb8 0%, #2f4d75 100%); }
.banner-shopping { background-color: #7e4a66; background-image: linear-gradient(135deg, #c596b0 0%, #7e4a66 100%); }
.banner-art { background-color: #7c4862; background-image: linear-gradient(135deg, #b8849d 0%, #7c4862 100%); }
.banner-info { background-color: #555; background-image: linear-gradient(135deg, #888 0%, #555 100%); }

.card-body { padding: 14px 18px 16px; }

.act-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.act-time {
  color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: 13px; background: #fef0eb; padding: 3px 10px;
  border-radius: 6px; white-space: nowrap;
}
.act-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.tag-booked { background: var(--green-soft); color: var(--green); }
.tag-todo { background: var(--amber-soft); color: #7a5a1c; }
.tag-flag { background: #fde2dc; color: var(--accent); }
.tag-recommend { background: #e0f0e8; color: var(--green); }

/* Creator-only controls — hidden by default; body.is-creator unhides them. */
.creator-only { display: none !important; }
body.is-creator .creator-only { display: inline-flex !important; }

.booking-panel {
  background: #fff8ec; border: 1px solid #f0d8a6; border-radius: 14px;
  padding: 16px 20px; margin: 0 0 20px;
}
.booking-panel .booking-head h3 { margin: 0; font-size: 15px; color: #7a5a1c; }
.booking-panel .booking-hint { margin: 4px 0 14px; font-size: 12px; color: #8a7250; }
.booking-fields { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .booking-fields { grid-template-columns: 1fr 1fr 1fr; } }
.booking-field { display: flex; flex-direction: column; gap: 4px; }
.booking-field label { font-size: 12px; font-weight: 600; color: #5a4520; }
.booking-value {
  background: white; border: 1px solid #e5d6b0; border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--ink); cursor: text;
  min-height: 36px; line-height: 1.5;
}
.booking-value:hover { border-color: var(--accent); }
.booking-empty { color: #b0a085; font-style: italic; }
.booking-value textarea, .booking-value input {
  width: 100%; box-sizing: border-box; border: none; outline: none;
  font: inherit; color: inherit; background: transparent; padding: 0;
  resize: vertical; min-height: 60px;
}
.booking-value input { min-height: auto; }

.act-confirm-btn {
  margin-left: auto;
  background: white; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 12px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.act-confirm-btn[data-confirmed="0"]:hover { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.act-confirm-btn[data-confirmed="1"] { background: #f7f7f4; color: var(--muted); }
.act-confirm-btn[data-confirmed="1"]:hover { background: var(--amber-soft); border-color: #d4a93f; color: #7a5a1c; }

/* CONFIRMED vs DISCUSSION COLOR CODING */
.act-card.confirmed {
  border: 2px solid #82bd82; background: #f0f8ec;
  box-shadow: 0 1px 3px rgba(82,140,82,0.08), 0 4px 10px rgba(82,140,82,0.05);
}
.act-card.confirmed .card-body { background: linear-gradient(180deg, #f0f8ec 0%, #fafdf8 100%); }
.act-card.confirmed .card-banner::after {
  content: '✓'; position: absolute; top: 8px; left: 8px;
  background: #5a8a5a; color: white;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.act-card.discussion {
  border: 2px solid #e89884; background: #fef0ec;
  box-shadow: 0 1px 3px rgba(193,70,47,0.08), 0 4px 10px rgba(193,70,47,0.06);
}
.act-card.discussion .card-body { background: linear-gradient(180deg, #fef0ec 0%, #fefaf8 100%); }
.act-card.discussion .card-banner::after {
  content: '💬'; position: absolute; top: 8px; left: 8px;
  background: var(--accent); color: white;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
  z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 8px 0 0; }
.legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 6px;
}
.legend-item.confirmed-legend { background: #f0f8ec; color: #3d6b3d; border: 1px solid #82bd82; }
.legend-item.discussion-legend { background: #fef0ec; color: var(--accent); border: 1px solid #e89884; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.green { background: #5a8a5a; }
.legend-dot.red { background: var(--accent); }

/* ALL COMMENTS VIEW */
.ac-day-section { margin-bottom: 28px; }
.ac-day-title {
  font-size: 19px; font-weight: 700; margin: 0 0 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fef8ee 0%, #fbe9d6 100%);
  border-radius: 12px; border: 1px solid var(--line); color: var(--ink);
}
.ac-day-title .ac-day-count { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.ac-block-section { margin-bottom: 14px; }
.ac-block-header {
  padding: 10px 16px; border-radius: 10px;
  font-weight: 700; font-size: 14px; margin: 14px 0 8px;
  display: flex; align-items: center; gap: 10px;
}
.ac-block-header .ac-block-icon { font-size: 20px; }
.ac-block-header .ac-block-time {
  margin-left: auto; font-size: 11px;
  background: rgba(255,255,255,0.6); padding: 3px 10px;
  border-radius: 999px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ac-block-header.morning { background: var(--morning-bg); color: var(--morning-ink); }
.ac-block-header.lunch { background: var(--lunch-bg); color: var(--lunch-ink); }
.ac-block-header.dinner { background: var(--dinner-bg); color: var(--dinner-ink); }

.ac-activity {
  background: white; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.ac-activity.confirmed { border-left: 3px solid #82bd82; }
.ac-activity.discussion { border-left: 3px solid var(--accent); }
.ac-activity-header {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dashed var(--line);
}
.ac-activity-emoji { font-size: 22px; }
.ac-time {
  background: #fef0eb; color: var(--accent);
  padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ac-title { font-weight: 700; font-size: 14px; color: var(--ink); flex: 1; min-width: 0; }
.ac-comment-count {
  background: var(--accent); color: white;
  font-size: 10px; padding: 2px 7px; border-radius: 999px; font-weight: 700;
}
.ac-jump {
  background: white; border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; font-size: 11px; padding: 3px 8px;
  border-radius: 6px; cursor: pointer; font-family: inherit;
}
.ac-jump:hover { background: var(--accent); color: white; border-color: var(--accent); }
.ac-empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
  background: white; border-radius: 12px; border: 1px dashed var(--line);
}
.ac-empty .empty-emoji { font-size: 48px; margin-bottom: 10px; display: block; }

.act-body { font-size: 14px; color: var(--ink); }
.act-body p { margin: 6px 0; }
.act-body ul { padding-left: 20px; margin: 6px 0; }
.act-body li { margin: 3px 0; }
.info-grid {
  display: grid; grid-template-columns: auto 1fr;
  gap: 4px 12px; font-size: 13px;
  background: #faf6f0; padding: 10px 14px;
  border-radius: 8px; margin: 10px 0;
}
.info-grid dt { color: var(--muted); font-weight: 600; }
.info-grid dd { margin: 0; color: var(--ink); }

/* OPTIONS list — for "to be decided" activities with 3-5 candidate places */
.options-list {
  background: #faf6f0; border-radius: 10px;
  padding: 12px 14px; margin: 10px 0;
  border: 1px solid var(--line);
}
.options-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 10px;
}
.opt-card {
  background: white; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
  font-size: 13px;
}
.opt-card:last-child { margin-bottom: 0; }
.opt-card.opt-hidden { display: none; }
.opt-card.opt-hidden.opt-revealed { display: block; }
.opt-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.opt-name { font-weight: 700; color: var(--ink); font-size: 14px; }
.opt-tag {
  display: inline-block;
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: var(--green-soft); color: var(--green); font-weight: 700;
}
.opt-desc { color: var(--ink); margin: 4px 0; line-height: 1.5; }
.opt-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.opt-maps {
  display: inline-block; margin-top: 6px;
  background: #fef0eb; color: var(--accent);
  padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 700; text-decoration: none;
  border: 1px solid #fcd9cd;
}
.opt-maps:hover { background: var(--accent); color: white; }
.options-toggle {
  width: 100%; margin-top: 4px;
  background: white; border: 1px dashed var(--line);
  color: var(--muted); cursor: pointer;
  padding: 8px; border-radius: 8px;
  font-size: 12px; font-weight: 600; font-family: inherit;
}
.options-toggle:hover { border-color: var(--accent); color: var(--accent); }

.ig-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.ig-pill {
  background: #fef0eb; color: var(--accent); text-decoration: none;
  padding: 5px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  border: 1px solid #fcd9cd;
}
.ig-pill:hover { background: var(--accent); color: white; }

/* COMMENTS */
.comments { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.comments-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.comment {
  background: #f9f5ed; padding: 7px 11px; border-radius: 8px;
  margin-bottom: 5px; font-size: 13px;
  border-left: 3px solid var(--accent-soft); transition: all 0.2s;
}
.comment.addressed { background: #f0f8ec; border-left-color: #5a8a5a; opacity: 0.7; }
.comment.addressed .comment-text { text-decoration: line-through; text-decoration-color: rgba(45,42,38,0.3); }
.addressed-mark {
  display: inline-block; background: #5a8a5a; color: white;
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  font-weight: 700; margin-right: 6px;
}
.comment-actions { display: inline-flex; gap: 6px; align-items: center; }
.addressed-toggle {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  cursor: pointer; font-size: 10px; padding: 1px 6px;
  border-radius: 4px; font-family: inherit; font-weight: 600;
}
.addressed-toggle:hover { background: #f0f8ec; border-color: #5a8a5a; color: #5a8a5a; }
.comment.addressed .addressed-toggle { background: #5a8a5a; color: white; border-color: #5a8a5a; }
.comment-meta {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 11px; margin-bottom: 2px;
}
.comment-author { font-weight: 700; color: var(--ink); }
.comment-text { color: var(--ink); white-space: pre-wrap; word-wrap: break-word; }
.comment-delete {
  background: transparent; border: none;
  color: var(--accent); cursor: pointer;
  font-size: 11px; padding: 0 2px;
}
.comment-delete:hover { text-decoration: underline; }
.comment-form { display: flex; gap: 6px; margin-top: 6px; }
.comment-form textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px; font-size: 13px;
  font-family: inherit; resize: vertical; min-height: 32px;
}
.comment-form button {
  background: var(--ink); color: white; border: none; border-radius: 6px;
  padding: 0 14px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
}
.comment-form button:hover { background: var(--accent); }
.empty-comments { color: var(--muted); font-size: 12px; font-style: italic; }

/* MODAL */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(45,42,38,0.65); z-index: 1000;
  align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal-bg.show { display: flex; }
.modal {
  background: white; border-radius: 16px;
  padding: 28px 30px; max-width: 500px; width: 100%;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.modal h3 { margin: 0 0 8px; font-size: 18px; color: var(--ink); }
.modal p { font-size: 13px; color: var(--muted); margin: 0 0 14px; line-height: 1.6; }
.modal label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--ink); margin-bottom: 4px; margin-top: 12px;
}
.modal input, .modal textarea, .modal select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions button {
  padding: 9px 18px; border-radius: 8px;
  border: 1px solid var(--line);
  background: white; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
}
.modal-actions button.primary { background: var(--ink); color: white; border-color: var(--ink); }
.modal-actions button.primary:hover { background: var(--accent); border-color: var(--accent); }
.modal-hero { text-align: center; margin-bottom: 20px; }
.modal-hero .emoji { font-size: 36px; margin-bottom: 4px; }
.help-text { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* CLAIM BANNER — shown when an unclaimed (cloned) trip is opened */
.claim-banner {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #fff4d6 0%, #ffe0b3 100%);
  border: 1px solid #f0c060; border-radius: 14px;
  padding: 16px 20px; margin-bottom: 18px;
}
.claim-banner-text { flex: 1; font-size: 13px; color: #5a4520; line-height: 1.5; }
.claim-banner-text strong { color: #7a5a1c; font-size: 14px; }
.claim-banner-btn {
  flex: 0 0 auto; background: #c1462f; color: white; border: none;
  border-radius: 999px; padding: 10px 20px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: transform 0.1s;
}
.claim-banner-btn:hover { transform: translateY(-1px); background: #a23925; }
@media (max-width: 600px) {
  .claim-banner { flex-direction: column; align-items: stretch; }
  .claim-banner-btn { width: 100%; }
}

/* SHARE MODAL — two stacked clickable cards */
.share-modal { padding: 24px; max-width: 460px; }
.share-title { margin: 0 0 16px; font-size: 17px; color: var(--ink); text-align: center; font-weight: 700; }
.share-card {
  display: block; width: 100%; text-align: left;
  background: white; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.share-card:hover:not(:disabled) {
  border-color: var(--accent); background: #fef8f5;
  box-shadow: 0 2px 8px rgba(193, 70, 47, 0.08);
}
.share-card:disabled { opacity: 0.6; cursor: wait; }
.share-card-head { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.share-card-body { font-size: 13px; color: var(--muted); line-height: 1.5; }
.share-card-question { color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.share-actions { display: flex; justify-content: center; margin-top: 10px; }
.share-cancel {
  background: none; border: none; color: var(--muted);
  padding: 6px 18px; cursor: pointer; font-family: inherit;
  font-size: 13px;
}
.share-cancel:hover { color: var(--ink); }
.help-text code { background: #f5f0e6; padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* NAME GRID */
.name-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.name-btn {
  padding: 16px 12px; border: 2px solid var(--line);
  background: white; border-radius: 12px; cursor: pointer;
  font-size: 16px; font-weight: 700; font-family: inherit; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  gap: 8px; transition: all 0.15s;
}
.name-btn:hover {
  border-color: var(--accent); background: #fef5f0;
  transform: translateY(-1px); box-shadow: 0 3px 8px rgba(193,70,47,0.15);
}
.name-btn.current { border-color: var(--accent); background: var(--accent); color: white; }
.name-btn .person-emoji { font-size: 22px; }
.name-btn-wrap .name-btn { width: 100%; }
.name-btn .regen-badge {
  margin-left: 6px; font-size: 14px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}
.regen-toggle {
  position: absolute; bottom: -8px; right: -8px;
  width: 28px; height: 28px;
  background: white; border: 2px solid var(--line);
  border-radius: 50%; cursor: pointer;
  font-size: 14px; line-height: 1;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  padding: 0; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 2; opacity: 0.5;
  filter: grayscale(1);
  transition: all 0.15s;
}
.regen-toggle:hover { opacity: 1; transform: scale(1.1); border-color: var(--accent); }
.regen-toggle.on {
  opacity: 1; filter: none;
  border-color: var(--accent); background: #fef0eb;
  box-shadow: 0 0 0 2px rgba(193,70,47,0.15), 0 2px 4px rgba(0,0,0,0.1);
}
.name-delete-btn {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px;
  background: white; border: 1px solid var(--line);
  border-radius: 50%; cursor: pointer;
  font-size: 14px; font-weight: 700; line-height: 1;
  color: var(--muted); font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  padding: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  opacity: 0; transition: opacity 0.15s;
  z-index: 2;
}
.name-btn-wrap:hover .name-delete-btn,
.name-btn-wrap:focus-within .name-delete-btn { opacity: 1; }
/* On touch devices the × is always visible since there's no hover */
@media (hover: none) {
  .name-delete-btn { opacity: 1; }
}
.name-delete-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink); color: white;
  padding: 10px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  transition: transform 0.25s ease;
  z-index: 2000; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* LOADING */
.loading-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 60vh; text-align: center; color: var(--muted);
}
.loading-screen .spin {
  width: 48px; height: 48px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen .loading-msg { font-size: 14px; }
.loading-screen .loading-sub { font-size: 12px; margin-top: 6px; opacity: 0.7; }

/* HOMEPAGE / FORM */
.hero {
  background: linear-gradient(135deg, #fef8ee 0%, #fbe9d6 100%);
  border-radius: 18px; padding: 40px 30px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  text-align: center; margin-bottom: 22px;
}
.hero h1 { font-size: 28px; margin: 6px 0 8px; }
.hero p { font-size: 14px; color: var(--muted); margin: 0 0 18px; }
.hero .cta {
  display: inline-block; background: var(--accent); color: white;
  padding: 12px 28px; border-radius: 999px;
  font-size: 15px; font-weight: 700;
  text-decoration: none; border: none; cursor: pointer; font-family: inherit;
}
.hero .cta:hover { background: #a3331f; }
.form-card {
  background: white; border-radius: 14px;
  padding: 24px 28px; border: 1px solid var(--line); box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.form-card h2 { font-size: 18px; margin: 0 0 6px; }
.form-card .form-hint { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.form-row input, .form-row textarea, .form-row select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; background: white;
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row .row-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-row-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.member-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fef5f0; color: var(--accent);
  border: 1px solid #fcd9cd; border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 600;
}
.member-chip button {
  background: transparent; border: none; cursor: pointer;
  font-size: 14px; color: var(--accent); padding: 0; line-height: 1;
}
.member-add { display: flex; gap: 6px; margin-top: 10px; }
.member-add input { flex: 1; }
.member-add button {
  background: var(--ink); color: white; border: none;
  padding: 0 14px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
}
.emoji-preview {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  font-size: 24px;
  background: white; border: 2px solid var(--line); border-radius: 10px;
  cursor: pointer; user-select: none;
  transition: all 0.15s;
}
.emoji-preview:hover { border-color: var(--accent); transform: translateY(-1px); }
.emoji-picker {
  background: white; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; margin-top: 8px;
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
}
.emoji-picker .emoji-opt {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  font-size: 22px; padding: 4px; cursor: pointer; line-height: 1;
}
.emoji-picker .emoji-opt:hover { background: #fef5f0; border-color: var(--accent-soft); }
.emoji-picker .emoji-opt.taken { opacity: 0.3; cursor: not-allowed; }
@media (max-width: 600px) {
  .emoji-picker { grid-template-columns: repeat(8, 1fr); }
}
.btn-primary {
  display: inline-block; background: var(--accent); color: white;
  padding: 12px 28px; border-radius: 999px;
  font-size: 15px; font-weight: 700;
  text-decoration: none; border: none; cursor: pointer; font-family: inherit;
}
.btn-primary:hover { background: #a3331f; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

@media (max-width: 600px) {
  body { padding: 16px 10px 60px; }
  .tab { min-width: 110px; padding: 10px; }
  .tab .day-title { font-size: 13px; }
  .card-body { padding: 12px 14px 14px; }
  .meal-block-body { padding: 10px; }
  h1 { font-size: 22px; }
  header.top { padding: 20px 18px; }
  .header-tools { position: static; margin-top: 14px; flex-wrap: wrap; }
  .card-banner { height: 110px; padding: 10px 14px; }
  .card-banner .b-emoji { font-size: 32px; }
  .card-banner .b-title { font-size: 15px; }
  .name-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-pair { grid-template-columns: 1fr; }
}
