/* ===== Fonts (step 4.2d), bundled with the app so they work offline =====
   Newsreader for titles and names, Libre Caslon Display for the name WellRec and big page titles (Dec 6), Inter for
   everything else. All are free (SIL Open Font License; see fonts/LICENSE-*.txt). No italics (K: the
   slanted serif looked AI-made). Each comes in two files: everyday letters, and the
   extra accented ones (only downloaded if a page uses them). */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(../fonts/newsreader-latin-opsz-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(../fonts/newsreader-latin-ext-opsz-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Libre Caslon Display';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(../fonts/libre-caslon-display-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Libre Caslon Display';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(../fonts/libre-caslon-display-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(../fonts/inter-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ===== Colors and fonts used across the whole app ("Riviera", step 4.2d) =====
   Change a color here and it changes everywhere. */
:root {
  --paper: #ffffff;       /* background: clean white */
  --ink: #141B2B;         /* main text: deep navy-black */
  --muted: #56607A;       /* lighter text for small notes */
  --line: #E3E8EF;        /* hairlines between rows */
  --line-strong: #C9D1DC; /* borders of boxes and buttons */

  --sea: #51374A;         /* aubergine (the name "sea" is left over from the blue): the top bar, selected tabs and buttons, links */
  --sea-dark: #3E2A39;    /* aubergine, pressed */
  --sea-tint: #DFE9E1;    /* sage mist: soft highlights, the tab bar */
  --sage-line: #C9D9CD;   /* a sage hairline, for edges on sage mist */
  --sage: #B5CCBB;        /* deeper sage: the icon's ribbon, small accents on dark */
  --on-sea: #DFE9E1;      /* quieter text on the aubergine bar: sage mist */
  --lemon: #F5D547;       /* lemon: the Inbox */
  --note: #FFF3B0;        /* lemon paper: notes */
  --aperol: #51374A;      /* the + button: aubergine (it was orange) */
  --rose: #8A4E6E;        /* dusty rose */
  --aperol-text: #8A4E6E; /* dusty rose, readable as text: counts, small headings (it was orange) */
  --pink: #F7B6C2;        /* Loved */
  --pink-text: #8E2140;

  --accent: var(--sea);   /* older rules use "accent": it's aubergine now */

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Newsreader', Georgia, "Times New Roman", serif;
  --font-brand: 'Libre Caslon Display', 'Newsreader', Georgia, serif;   /* the name WellRec and big page titles */
}

/* Make sizes include padding, so layouts behave predictably */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;     /* comfortable reading size on a phone */
  line-height: 1.5;
}

/* The main column: full width on phones, capped on big screens */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px;
}

h1 {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  margin: 0 0 8px;
  color: var(--accent);
}

.small {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Make sure anything marked "hidden" really is hidden */
[hidden] {
  display: none !important;
}

/* ===== Card: a soft white panel, like a page in the journal ===== */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  margin-top: 24px;
  box-shadow: 0 2px 12px rgba(20, 27, 43, 0.08);
}

/* ===== Form fields ===== */
label {
  display: block;
  font-weight: 600;
  margin: 16px 0 6px;
}

label:first-child {
  margin-top: 0;
}

input {
  width: 100%;
  font: inherit;          /* 17px, which also stops iPhones zooming in on tap */
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}

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

/* ===== Buttons: full width with big tap targets ===== */
.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

/* Greyed out while we're waiting for Supabase */
.btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ===== Messages under the form ===== */
.message {
  margin: 16px 0 0;
}

.message.error {
  color: #b3261e;   /* red, for problems */
}

.message.success {
  color: #2e7d4f;   /* green, for good news */
}

/* ===== Home screen ===== */

/* Title on the left, "Log out" on the right */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  margin: 0;
}

/* A button that looks like a plain text link */
.btn-link {
  background: none;
  border: none;
  font: inherit;
  color: var(--accent);
  padding: 12px 0 12px 12px;   /* bigger tap area than the text itself */
  cursor: pointer;
}

/* Leave room on the right so names never sit under the A–Z strip */
.category-list {
  padding-right: 24px;
}

/* Letter headings (A, B, C…). They stick to the top while you scroll past them. */
.letter-heading {
  position: sticky;
  top: 0;
  background: var(--paper);
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent);
  padding: 12px 4px 4px;
  margin: 0;
  font-size: 1.1rem;
}

/* One category: emoji, name, count. It's a link, so drop the link styling. */
.category-row {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(81, 55, 74, 0.12);
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;            /* big tap target */
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}

.category-icon {
  font-size: 1.5rem;
  width: 32px;
  text-align: center;
}

.category-name {
  flex: 1;                     /* takes up the space, pushing the count to the right */
}

.category-count {
  color: var(--muted);
  font-size: 0.95rem;
}

/* A small "›" after the count, hinting that the row opens */
.category-count::after {
  content: '›';
  margin-left: 10px;
  font-size: 1.2rem;
}

/* ===== Category screen ===== */

.btn-back {
  padding-left: 0;
}

.category-title {
  font-size: 2rem;
  margin-top: 4px;
}

/* "Sort [Name (A–Z) ▾]" */
.sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.sort-row label {
  margin: 0;
}

select {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
}

/* Filter buttons, in a row that scrolls sideways on narrow phones */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 4px;
  margin-top: 4px;
}

.chip {
  flex: none;
  font: inherit;
  font-size: 0.9rem;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* One rec: title and details on the left, status on the right. It's a link, so drop the link styling. */
.rec-row {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(81, 55, 74, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}

.rec-text {
  flex: 1;
  min-width: 0;          /* lets long titles wrap instead of pushing the badge off screen */
}

.rec-title {
  font-weight: 600;
}

.rec-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Status badges, each a soft color */
.status-badge {
  flex: none;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-want_to_try { background: #EEF1F5; color: #3E4860; }
.status-tried       { background: #e3ede6; color: #2e5e40; }
.status-loved       { background: #f8e1da; color: #a3402a; }
.status-not_for_me  { background: #ebe8e5; color: #6f6862; }

/* The A–Z strip, fixed to the right edge of the page (also on wide screens) */
.az-index {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  right: max(2px, calc(50% - 280px));
  display: flex;
  flex-direction: column;
  align-items: center;
  touch-action: none;          /* lets you slide a finger along it without scrolling the page */
  user-select: none;
  -webkit-user-select: none;
}

.az-index span {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.35;
  padding: 0 6px;
  color: var(--accent);
  cursor: pointer;
}

/* Letters with no categories */
.az-index span.empty {
  color: #C2CAD6;
  cursor: default;
}

/* Leave space at the bottom of the list so the + button never covers the last rec */
#rec-list {
  padding-bottom: 0;
}

/* Room at the end of a collection so the + button never covers the last row */
body.has-tab-bar #screen-category {
  padding-bottom: calc(180px + env(safe-area-inset-bottom));
}

/* The big round + button, floating at the bottom right */
.fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));   /* stays above the iPhone's home bar */
  right: max(20px, calc(50% - 260px));
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(81, 55, 74, 0.35);
  cursor: pointer;
}

/* ===== New rec / Edit rec screen ===== */

.screen-title {
  font-size: 1.8rem;
  margin-top: 4px;
}

/* One field in the form */
.field {
  margin-bottom: 4px;
}

.field label,
#rec-form > label {
  margin-top: 16px;
}

/* The first field's label doesn't need space above it */
#quick-fields .field:first-child label {
  margin-top: 0;
}

textarea {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  resize: vertical;
}

textarea:focus,
select:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

/* Dropdowns inside the form fill the width, like the text boxes */
#rec-form select {
  width: 100%;
  background: var(--paper);
}

/* City / Region / Country, stacked with a little gap */
.location-group {
  display: grid;
  gap: 8px;
}

/* Status buttons that wrap onto a second line instead of scrolling */
.chips-wrap {
  flex-wrap: wrap;
  overflow-x: visible;
  padding-top: 4px;
}

/* "More fields ▾" */
.more-fields {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.more-fields summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  padding: 10px 0;          /* big tap target */
}

/* Red "Delete rec" button */
.btn-danger {
  background: transparent;
  color: #b3261e;
  border: 2px solid #e8b4af;
  margin-top: 24px;
}

/* ===== Rec page ===== */

#rec-status {
  margin-top: 8px;
}

/* One filled-in field: small label above, value below */
.detail {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail:last-of-type {
  border-bottom: none;
}

.detail-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.detail-value a {
  color: var(--accent);
  word-break: break-all;    /* long web addresses wrap instead of overflowing */
}

/* Notes keep their line breaks */
.multiline {
  white-space: pre-wrap;
}

/* Don't show an empty white card while the rec is loading */
#rec-details:empty {
  display: none;
}

/* ===== Field types (step 2.1) ===== */

/* Rating: five big tappable stars */
.stars {
  display: flex;
  gap: 4px;
}

.star {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  padding: 4px;
  min-width: 44px;           /* big tap target */
  min-height: 44px;
  color: var(--line-strong);            /* empty star */
  cursor: pointer;
}

.star.filled {
  color: #F0B323;            /* golden filled star */
}

/* A rating shown on the rec page */
.stars-display {
  color: #F0B323;
  font-size: 1.2rem;
  letter-spacing: 2px;
}

/* Tags: bubbles, with the typing box after them */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
}

.tags-input input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  padding: 6px 8px;
}

.tags-input input:focus {
  outline: none;
}

.tags-input:focus-within {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #EEF1F5;
  color: #3E4860;
  border-radius: 999px;
  padding: 4px 4px 4px 12px;
  font-size: 0.9rem;
  margin: 2px 6px 2px 0;
}

/* Tags on the rec page don't have an ×, so even out the padding */
.detail-value .tag {
  padding-right: 12px;
}

.tag-remove {
  background: none;
  border: none;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  color: #3E4860;
  padding: 2px 8px;
  cursor: pointer;
}

/* Checkbox: a switch with its name beside it */
.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  flex: none;
  margin: 0;
  cursor: pointer;
  transition: background 0.2s;
}

/* The round knob */
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::after {
  transform: translateX(20px);
}

.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Date boxes look like the other boxes */
input[type="date"] {
  min-height: 48px;
}

/* ===== Field editor (step 2.2) ===== */

.field-list {
  margin: 16px 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(20, 27, 43, 0.08);
  overflow: hidden;
}

.field-row {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.field-row:last-child {
  border-bottom: none;
}

/* The row being dragged: lifted off the page, following the finger */
.field-row.dragging {
  background: #F7F9FC;
  box-shadow: 0 8px 24px rgba(20, 27, 43, 0.22);
  border-radius: 12px;
  position: relative;
  z-index: 2;
}

.field-row-main {
  display: flex;
  align-items: stretch;
}

/* ≡ on the right: a big, full-height grab area about a thumb wide */
.drag-handle {
  flex: none;
  width: 52px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: grab;
  touch-action: pan-y;            /* a quick swipe here still scrolls the page */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;    /* no iPhone "hold to select" pop-up */
}

.field-row.dragging .drag-handle {
  color: var(--accent);
  cursor: grabbing;
}

/* Tap the name to open the edit panel */
.field-row-open {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 8px 4px 8px 16px;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.field-row-type {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* The panel under a field: rename, choices, delete */
.field-panel {
  padding: 4px 16px 16px 16px;
}

.field-panel label {
  margin-top: 8px;
}

.btn-delete-field {
  display: block;
  margin: 12px auto 0;
  padding: 12px;
  color: #b3261e;
}

/* "+ Add a field" form */
#add-field-form select {
  width: 100%;
  background: var(--paper);
}

/* ===== Categories: new, rename, delete (step 2.3) ===== */

/* "+ New category" under the list on the home screen */
.btn-new-category {
  margin-top: 24px;
  margin-bottom: 32px;
}

/* "Fields" heading on the Edit screen */
.section-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin: 32px 0 0;
}

/* Emoji picker: a grid of big tappable emojis, then a "type your own" box */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.emoji-choice {
  font-size: 1.6rem;
  min-height: 48px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
}

.emoji-choice.selected {
  border-color: var(--accent);
  background: var(--sea-tint);
}

.emoji-own {
  margin-top: 10px;
}

/* Space between the details card and what follows */
#category-details-form {
  margin-bottom: 8px;
}

/* Recommendation has no ≡ handle, so give its text some room on the right */
.field-row:not(.movable) .field-row-open {
  padding-right: 16px;
}

/* ===== Search (step 2.4) ===== */
.search-box {
  position: relative;
  margin: 16px 0 8px;
}

.search-box input {
  padding-left: 40px;                 /* room for the magnifying glass */
  padding-right: 44px;                /* room for the × */
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237a6f63' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E") no-repeat 14px center;
  border-radius: 999px;
  -webkit-appearance: none;
  appearance: none;
}

/* Hide the browser's own little × in search boxes; we have our own */
.search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
}

#search-message {
  margin-top: 8px;
}

/* ===== Tab bar (Recs | Guides) at the bottom ===== */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line-strong);
  padding-bottom: env(safe-area-inset-bottom);   /* above the iPhone's home bar */
  z-index: 10;
}

.tab-bar[hidden] {
  display: none;
}

.tab {
  flex: 1;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
}

.tab-icon {
  font-size: 1.4rem;
  line-height: 1.1;
  filter: grayscale(1);
  opacity: 0.6;
}

.tab.active {
  color: var(--accent);
  font-weight: 600;
}

.tab.active .tab-icon {
  filter: none;
  opacity: 1;
}

/* Room at the bottom so the tab bar never covers the end of the page */
body.has-tab-bar .page {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ===== Guides ===== */
#btn-new-guide {
  margin: 16px 0 8px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-weight: normal;
  cursor: pointer;
}

.option-row input {
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.option-indent {
  margin-left: 32px;
}

.preview-count {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: normal;
  color: var(--muted);
}

#guide-form > .btn-primary {
  margin-top: 24px;
}

/* A guide, as it will be shown and (later) printed */
.guide-title {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  color: var(--accent);
  margin: 0 0 6px;
}

.guide-intro {
  margin: 0 0 8px;
  white-space: pre-line;
}

.guide-progress {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.guide-empty {
  color: var(--muted);
}

.guide-group {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 20px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.guide-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.guide-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}

.guide-item-body {
  flex: 1;
  min-width: 0;
}

.guide-bullet {
  color: var(--accent);
  line-height: 1.5;
}

/* An empty square, big enough for a sticker or an X */
.guide-box {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}

.guide-item-title {
  font-weight: 600;
}

.guide-item-details,
.guide-item-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.guide-item-note {
  white-space: pre-line;
}

.guide-item-link {
  display: block;
  font-size: 0.9rem;
  color: var(--accent);
  overflow-wrap: anywhere;
}

/* ===== Hand-picked guides (step 3.2) ===== */

/* "By filters | Hand-picked": two halves of one pill */
.segmented {
  display: flex;
  margin: 12px 0 4px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  overflow: hidden;
}

.segmented button {
  flex: 1;
  min-height: 44px;
  border: none;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.segmented button.selected {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.sub-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin: 20px 0 0;
}

.filter-card-title {
  margin: 0;
  font-weight: 600;
}

/* A picked rec: × on the left, name in the middle, ≡ on the right */
.pick-row {
  align-items: center;
}

.pick-remove {
  flex: none;
  width: 44px;
  min-height: 56px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.pick-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.pick-title {
  font-weight: 600;
}

.pick-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

/* The tick list of recs to pick from */
.pick-choices {
  padding-top: 4px;
  padding-bottom: 4px;
}

.pick-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-weight: normal;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.pick-choice:last-child {
  border-bottom: none;
}

.pick-choice input {
  flex: none;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}

.pick-none {
  margin: 8px 0;
}

.pick-filters-toggle {
  display: block;
  margin: 4px 0;
  padding-left: 0;
}

/* With the tab bar showing, lift the + button above it */
body.has-tab-bar .fab {
  bottom: calc(84px + env(safe-area-inset-bottom));
}

/* ===== Sharing (step 3.3) ===== */
.share-box {
  margin-top: 20px;
}

.share-heading {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--ink);
  margin: 0 0 12px;
}

/* Three big buttons: 🔗 Link · 📄 PDF / Print · 💬 Text */
.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 72px;
  padding: 10px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}

.share-option-icon {
  font-size: 1.5rem;
  line-height: 1.1;
}

.share-option.selected {
  border-color: var(--accent);
  background: var(--sea-tint);
  color: var(--accent);
  font-weight: 600;
}

.share-panel {
  margin-top: 12px;
}

#share-text {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--ink);
}

.share-tip {
  margin: 12px 0 0;
}

#share-link {
  font-size: 0.9rem;
  color: var(--muted);
}

.share-open,
.share-stop {
  display: block;
  margin-top: 12px;
  padding-left: 0;
  text-align: left;
}

.share-stop {
  color: #a3402a;
}

/* The public share page */
.share-page .page {
  padding-top: 32px;
}

.made-with {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 24px 0 8px;
}

/* ===== Print / PDF (step 3.4) ===== */
/* Things that only appear on paper */
.print-only {
  display: none;
}

@media print {
  @page {
    margin: 0.6in;
  }

  /* Plain white paper, ink-friendly */
  body,
  body.has-tab-bar .page {
    background: #fff;
    padding: 0;
  }

  .page {
    max-width: none;
  }

  /* Only the guide: no buttons, bars, sharing or messages */
  .topbar,
  .tab-bar,
  .share-box,
  .message,
  .fab {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  .guide {
    box-shadow: none;
    border: none;
    padding: 0;
    margin: 0;
  }

  .guide-title {
    font-size: 24pt;
  }

  .guide,
  .guide-item-title {
    font-size: 12pt;
  }

  .guide-item-details,
  .guide-item-note,
  .guide-item-link,
  .guide-progress {
    font-size: 10pt;
  }

  /* Links: printed as plain readable text */
  .guide-item-link {
    color: var(--ink);
    text-decoration: none;
  }

  /* Never split an item across two pages, and keep a category heading with its first item */
  .guide-item {
    break-inside: avoid;
  }

  .guide-group {
    break-after: avoid;
  }

  /* Sticker boxes: exactly 1/2 inch */
  .guide-box {
    width: 0.5in;
    height: 0.5in;
    border-width: 1.5pt;
    border-radius: 3pt;
    font-size: 0.32in;
    margin-top: 0;
  }

  .guide-item:has(.guide-box) {
    align-items: center;
    min-height: 0.6in;
  }

  .made-with {
    margin-top: 0.3in;
    font-size: 9pt;
  }

  /* Print colours as shown (accent title, status hearts) */
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ===== Quick actions on a rec (step 3.6) ===== */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 16px;
}

.quick-action {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  gap: 6px;
  border: 1px solid var(--sage-line);
  background: var(--sea-tint);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: rgba(81, 55, 74, 0.12);
}

.quick-action:active {
  background: var(--sea-tint);
}

.quick-actions:empty {
  display: none;
}

/* ===== Login screen: Log in / Create account ===== */
.auth-heading {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin: 0 0 4px;
}

.auth-switch {
  margin: 12px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-switch .btn-link {
  padding-left: 4px;
}

/* ===== Places (step 3.7) ===== */
#btn-place-guide {
  margin: 8px 0 4px;
}

#place-sub {
  margin-top: 0;
}

/* "Everything in Portugal": a little quieter than the cities under it */
.place-all .category-name {
  color: var(--muted);
}

#place-recs {
  margin-top: 8px;
}

/* ===== Quick add + 📥 Inbox ===== */

/* Room at the end of the home list so the + never covers "+ New category" */
#home-browse {
  padding-bottom: 72px;
}

/* The Inbox row at the top of the home screen: a soft highlight, since it's waiting for you */
.inbox-row {
  background: var(--sea-tint);
  border-radius: 12px;
  border-bottom: none;
  padding-left: 10px;
  padding-right: 10px;
  margin: 8px 24px 4px 0;      /* (24px: room for the A–Z strip) */
}

.inbox-row .category-count {
  color: var(--accent);
  font-weight: 600;
}

#quick-add-input {
  font-size: 1.1rem;
}

.quick-add-or {
  margin: 16px 0 0;
}

#home-message a {
  color: var(--accent);
  font-weight: 600;
}

#rec-category-box {
  margin-bottom: 8px;
}

#rec-category {
  width: 100%;
}

/* ---------- Pictures and book autofill (step 3.8) ---------- */

/* Small preview under a Picture field in the form */
.image-preview {
  display: block;
  max-width: 90px;
  max-height: 130px;
  margin-top: 8px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* The big cover on a rec's page */
.rec-cover {
  display: block;
  width: 140px;
  max-height: 210px;
  object-fit: cover;
  margin: 4px 0 16px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* The small cover in a category's list */
.rec-thumb {
  flex: none;
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* The list of matching books under the title box */
.autofill-wrapper {
  position: relative;
}

.autofill-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.autofill-list[hidden] {
  display: none;
}

.autofill-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.autofill-option:active {
  background: rgba(81, 55, 74, 0.08);
}

.autofill-cover {
  flex: none;
  width: 32px;
  height: 48px;
  object-fit: cover;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--line);
  font-size: 1.1rem;
}

.autofill-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.autofill-title {
  font-weight: 600;
  line-height: 1.3;
}

.autofill-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.autofill-credit {
  margin: 0;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

/* "Filled in from Google Books" under the title box */
.autofill-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.autofill-note img {
  width: 28px;
  height: 42px;
  object-fit: cover;
  border-radius: 3px;
}

.autofill-status {
  text-align: left;
  font-size: 0.85rem;
}

/* ---------- Swipe left to delete, with Undo ---------- */

.swipe-item {
  position: relative;
  overflow: hidden;
}

.swipe-item[hidden] {
  display: none;
}

/* The red button behind the row */
.swipe-delete {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 88px;
  border: none;
  background: #c8412f;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* The row slides over the button; it needs a background to cover it */
.swipe-row {
  position: relative;
  background: var(--paper);
  touch-action: pan-y;   /* up/down scrolls the page; sideways is ours */
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

/* "Deleted "X" · Undo" at the bottom of the screen */
.undo-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.undo-bar[hidden] {
  display: none;
}

.undo-bar span {
  flex: 1;
  min-width: 0;
}

.undo-bar button {
  border: none;
  background: none;
  color: var(--sage);
  font: inherit;
  font-weight: 700;
  padding: 6px 4px;
  cursor: pointer;
}

/* Above the tab bar on screens that have it */
body.has-tab-bar .undo-bar {
  bottom: calc(76px + env(safe-area-inset-bottom));
}

/* ---------- Suggestion lists under the boxes (step 4.2a) ---------- */
/* They reuse the look of the book/movie list (.autofill-list, .autofill-option). */
.suggest-anchor {
  position: relative;
}

.suggest-option {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-height: 44px;   /* easy to tap */
  justify-content: center;
}

/* =====================================================================
   New look (step 4.2d, pass 1): "Editorial + Riviera"
   A slim sea-blue bar at the top of every screen (always the same height),
   titles below it in a serif on white, sea blue for whatever is selected,
   lemon for the Inbox and notes, orange for the + button and counts.
   These rules come last, so they win over the older ones above.
   ===================================================================== */

body {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.page {
  padding-top: 0;
}

/* ----- The top bar: the same height on every screen ----- */
.share-page .page {
  padding-top: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(56px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);   /* below the iPhone's clock and notch */
  margin: 0 0 22px;
  background: var(--sea);
  color: #fff;
  /* Stretch the bar color to both edges of the screen, even though the page is a narrow column,
     and up above it: pulling the page down on an iPhone then shows more bar, not a white gap */
  box-shadow: 0 0 0 100vmax var(--sea);
  clip-path: inset(-100vmax -100vmax 0 -100vmax);
}

.topbar .btn-link {
  color: #fff;
  font-weight: 500;
  padding-top: 14px;
  padding-bottom: 14px;
}

/* Edit / Log out: the quieter button on the right */
.topbar .btn-link:not(.btn-back) {
  color: var(--on-sea);
}

/* "WellRec" in the bar, in its own font */
.wordmark,
.topbar h1.wordmark {
  font-family: var(--font-brand);
  font-weight: 400;
  font-size: 27px;
  letter-spacing: 0;
  line-height: 1;
  color: #fff;
  margin: 0;
}

/* ----- Titles, below the bar on white ----- */

/* The small orange line above a title: "COLLECTION", "RESTAURANTS · SAN FRANCISCO" */
.overline {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--aperol-text);
}

.overline:empty {
  display: none;
}

h1,
.screen-title,
.category-title,
#place-title {
  font-family: var(--font-brand);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin: 4px 0 12px;
}

/* Loading and login screens have no bar: a big WellRec instead */
#screen-loading h1,
#screen-auth h1,
#screen-new-password h1 {
  font-family: var(--font-brand);
  font-weight: 400;
  letter-spacing: -0.5px;
  color: var(--sea);
  font-size: 48px;
  margin-top: calc(56px + env(safe-area-inset-top));   /* below the clock in the iPhone app */
}

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

/* ----- Boxes and buttons ----- */
.card {
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(20, 27, 43, 0.05);
}

input,
textarea,
select {
  border-color: var(--line-strong);
  border-radius: 10px;
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--sea);
  border-color: transparent;
}

.btn {
  border-radius: 999px;
}

.btn-primary {
  background: var(--sea);
}

.btn-primary:active {
  background: var(--sea-dark);
}

.btn-secondary {
  color: var(--ink);
  border: 1px solid var(--ink);
}

.btn-link {
  color: var(--sea);
}

.message.error {
  color: #B3261E;
}

/* ----- Home: search and the list of categories ----- */

/* The search box: just a line underneath, like a page in a magazine */
.search-box input {
  border: none;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding-left: 2px;
  background: transparent;
}

.search-box input:focus {
  outline: none;
  border-bottom: 2px solid var(--sea);
}

/* Letter headings (A, B, C…) */
.letter-heading {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  color: var(--aperol-text);
  text-transform: uppercase;
  padding-top: 14px;
}

.category-row,
.rec-row {
  border-bottom: 1px solid var(--line);
}

.category-name {
  font-family: var(--font-heading);
  font-size: 21px;
  letter-spacing: -0.2px;
}

.category-count {
  color: var(--aperol-text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.category-count::after {
  color: var(--line-strong);
}

/* Category emoji: quieter until they become line icons (pass 2) */
.category-icon {
  font-size: 1.25rem;
}

/* The Inbox: a lemon bar at the top, like a sticky note waiting for you */
.inbox-row {
  background: var(--lemon);
  border-radius: 10px;
}

.inbox-row .category-name {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
}

.inbox-row .category-count,
.inbox-row .category-count::after {
  color: var(--ink);
}

.az-index span {
  color: var(--sea);
}

/* ----- Lists of recs ----- */
.rec-title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.25;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
}

.status-want_to_try { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
.status-tried       { background: var(--sea-tint); color: var(--sea); }
.status-loved       { background: var(--pink); color: var(--pink-text); }
.status-not_for_me  { background: #EEF1F5; color: var(--muted); }

/* The filter on a category: tabs with a sea-blue line under the chosen one */
.status-tabs {
  gap: 16px;
  padding: 4px 0 0;
  border-bottom: 1px solid var(--line);
}

.status-tabs .chip {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-tabs .chip.selected {
  background: none;
  color: var(--sea);
  border-bottom-color: var(--sea);
  font-weight: 600;
}

.chip-count {
  color: var(--aperol-text);
  font-size: 0.8rem;
  margin-left: 2px;
}

/* Other chips (status when adding a rec, guide filters): sea blue when chosen */
.chip {
  border-color: var(--line-strong);
}

.chip.selected {
  background: var(--sea);
  border-color: var(--sea);
}

/* Status on a rec's page: one segmented control, the chosen part filled sea blue */
.segmented-status {
  display: flex;
  gap: 0;
  padding: 0;
  margin: 8px 0 16px;
  border: 1px solid var(--sea);
  border-radius: 999px;
  overflow: hidden;
}

.segmented-status .chip {
  flex: 1;
  min-width: 0;
  border: none;
  border-left: 1px solid var(--sea);
  border-radius: 0;
  padding: 6px 4px;
  font-size: 0.85rem;
  color: var(--sea);
  white-space: nowrap;
}

.segmented-status .chip:first-child {
  border-left: none;
}

.segmented-status .chip.selected {
  background: var(--sea);
  color: #fff;
  font-weight: 600;
}

.segmented,
.segmented button {
  border-color: var(--sea);
}

/* ----- A rec's page ----- */
.detail-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

/* Map / Google / Share: Map filled sea blue, the rest outlined */
.quick-action {
  background: #fff;
  border: 1px solid var(--ink);
  color: var(--ink);
}

.quick-action:first-child {
  background: var(--sea);
  border-color: var(--sea);
  color: #fff;
}

.quick-action:active {
  opacity: 0.8;
}

/* ----- The + button: a round aubergine ----- */
.fab {
  width: 56px;
  height: 56px;
  background: var(--aperol);
  font-size: 2rem;
  font-weight: 300;
  box-shadow: 0 6px 16px rgba(81, 55, 74, 0.35);
}

/* ----- Tab bar: sage mist, ink for the chosen tab ----- */
.tab-bar {
  background: var(--sea-tint);
  border-top: 1px solid var(--sage-line);
}

.tab.active {
  color: var(--ink);
}

/* ----- Guides ----- */
.guide-title {
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.guide-group {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--aperol-text);
}

.guide-item-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
}

/* Notes: lemon paper */
.guide-item-note {
  background: var(--note);
  padding: 4px 8px;
  border-radius: 3px;
}

.share-option.selected {
  border-color: var(--sea);
  background: var(--sea-tint);
}

/* ----- Paper / PDF: no blue bar, ink titles ----- */
@media print {
  .guide-title {
    color: var(--ink);
  }

  .guide {
    border: none;
    box-shadow: none;
  }

  .guide-item-note {
    background: none;
    padding: 0;
  }
}

/* A rec's notes: a lemon sticky note, slightly tilted */
.detail-note .detail-value {
  margin-top: 6px;
  padding: 14px 16px;
  background: var(--note);
  font-family: var(--font-heading);
  font-size: 19px;
  line-height: 1.35;
  transform: rotate(-0.8deg);
  box-shadow: 0 3px 8px rgba(20, 27, 43, 0.12);
}

/* The rec's details: a plain list on white, not a box */
#rec-details {
  border: none;
  box-shadow: none;
  padding: 0;
  margin-top: 8px;
}

/* Home: rows have no letter headings, so jumping with the A–Z strip lands below the blue bar */
.category-row {
  scroll-margin-top: calc(64px + env(safe-area-inset-top));
}

/* A plain cover for a book (or anything with pictures) that has none: a block of color with
   a first letter, like a classic paperback. The thin band near the top is the "spine label". */
.plain-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 6px;
  font-family: var(--font-heading);
  font-size: 22px;
  line-height: 1;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 70% 1px;
  background-position: 50% 9px;
  background-repeat: no-repeat;
}

.plain-cover-sea    { background-color: var(--sea);    color: #fff; }
.plain-cover-aperol { background-color: var(--rose);   color: #fff; }
.plain-cover-lemon  { background-color: var(--lemon);  color: var(--ink); }
.plain-cover-pink   { background-color: var(--pink);   color: var(--ink); }
.plain-cover-ink    { background-color: var(--ink);    color: #fff; }

/* =====================================================================
   Line icons (step 4.2d, pass 2). Each icon takes the color of its text.
   ===================================================================== */
.icon {
  display: inline-flex;
  flex: none;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.18em;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* Collections and places in lists: a navy line icon, no circle */
.category-icon {
  width: 24px;
  height: 24px;
  color: var(--ink);
}

.inbox-row .category-icon {
  color: var(--ink);
}

/* Tab bar */
.tab-icon {
  width: 24px;
  height: 24px;
  filter: none;
  opacity: 1;
  margin-bottom: 2px;
}

/* Status pills and buttons: a small icon before the word */
.status-badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-badge .icon {
  width: 13px;
  height: 13px;
}

.chip .icon {
  width: 15px;
  height: 15px;
}

.status-loved .icon svg,
.loved-heart svg {
  fill: currentColor;
}

.segmented-status .chip {
  justify-content: center;
  gap: 4px;
}

/* A heart after a loved rec's name (guides) */
.loved-heart {
  color: #E0486B;
  width: 0.8em;
  height: 0.8em;
  vertical-align: -0.05em;
}

/* Google / Maps / Goodreads buttons */
.quick-action .icon {
  width: 16px;
  height: 16px;
}

/* Guides: the collection heading's icon */
.guide-group .icon {
  width: 14px;
  height: 14px;
  vertical-align: -0.2em;
  margin-right: 2px;
}

/* Places: collection headings on a place's page */
.letter-heading .icon {
  width: 14px;
  height: 14px;
  vertical-align: -0.2em;
}

/* Share options (Link, PDF / Print, Text) */
.share-option-icon {
  width: 24px;
  height: 24px;
}

/* A match without a picture in the autofill list */
.autofill-cover .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

/* The icon picker for a collection */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.icon-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.icon-choice .icon {
  width: 22px;
  height: 22px;
}

.icon-choice.selected {
  border-color: var(--sea);
  background: var(--sea-tint);
  color: var(--sea);
}

/* "Make a guide from this" */
#btn-place-guide .icon {
  width: 18px;
  height: 18px;
  margin-right: 4px;
}

/* Status on a rec's page: icon above the word, so all four fit on a phone */
.segmented-status {
  border-radius: 14px;
}

.segmented-status .chip {
  flex-direction: column;
  gap: 3px;
  min-height: 56px;
  padding: 8px 2px 6px;
  font-size: 0.78rem;
  line-height: 1.1;
}

.segmented-status .chip .icon {
  width: 18px;
  height: 18px;
}

/* =====================================================================
   For me (step 4.2f): the to-try list, Done circles, swipe right
   ===================================================================== */

/* The empty circle on the right of a to-try row: tap = Done */
.done-circle {
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.done-circle::before {
  content: '';
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  box-sizing: border-box;
}

.done-circle:active::before {
  border-color: var(--sea);
  background: var(--sea-tint);
}

/* Done ones (under "Show done"): quieter */
.rec-row-done .rec-title,
.rec-row-done .rec-sub {
  color: var(--muted);
}

.rec-row-done .rec-title {
  font-weight: 400;
}

.row-heart {
  width: 18px;
  height: 18px;
  color: #E0486B;
}

.row-heart svg {
  fill: currentColor;
}

/* Buttons behind the row's left side, shown by swiping right */
.swipe-left-actions {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
}

.swipe-action {
  width: 76px;
  padding: 0;
  border: none;
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.swipe-action .icon {
  width: 22px;
  height: 22px;
}

.swipe-check,
.swipe-bookmark {
  background: var(--sea);
}

.swipe-heart {
  background: #E0486B;
}

.swipe-heart .icon svg {
  fill: currentColor;
}

/* While swiping right, hide the red Delete behind the right edge */
.swiping-right .swipe-delete {
  visibility: hidden;
}

/* While swiping left, hide the Done / Recommend buttons */
.swipe-item:not(.swiping-right) .swipe-left-actions {
  visibility: hidden;
}

.list-hint {
  margin-top: 14px;
}

#rec-list:empty + .list-hint {
  display: none;
}

.show-done {
  display: block;
  margin: 18px 0 4px;
  padding-left: 0;
  font-weight: 600;
}

/* ----- Settings ----- */
.topbar .btn-settings {
  display: inline-flex;
  align-items: center;
  padding: 10px 0 10px 12px;
  color: var(--on-sea);
}
.topbar .btn-settings .icon {
  width: 22px;
  height: 22px;
}
.founding-card {
  margin: 8px 0 28px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--sea-tint);
}
.founding-card p {
  margin: 0;
  font-size: 0.95rem;
}
.founding-card .founding-title {
  margin-bottom: 4px;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--sea);
}
.settings-heading {
  margin: 0 0 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--aperol-text);
}
.settings-group {
  margin-bottom: 28px;
  border-top: 1px solid var(--line);
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}
.settings-button {
  cursor: pointer;
}
.settings-button::after {
  content: "›";
  color: var(--muted);
  font-size: 1.3rem;
}
.settings-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}
.settings-form {
  padding: 14px 0 6px;
}
.settings-form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.settings-form-buttons .btn {
  flex: 1;
}
.btn-logout {
  width: 100%;
  margin-top: 4px;
}

#home-sub {
  margin: 0 0 6px;
}

/* The Notes box after tapping Recommend (step 4.2f) */
.note-box {
  margin: 0 0 20px;
  padding: 16px;
  background: var(--note);
  border-radius: 12px;
}
.note-box-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--ink);
}
.note-box textarea {
  width: 100%;
  background: #fff;
}
.note-box-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}
.note-box-buttons .btn {
  padding: 10px 22px;
  width: auto;
  margin: 0;
}

/* For you (step 4.2f, part 3) */
body.has-tab-bar #screen-foryou,
body.has-tab-bar #screen-foryou-category {
  padding-bottom: calc(180px + env(safe-area-inset-bottom));
}

#foryou-rec-list:empty + .list-hint {
  display: none;
}

/* The send button on each row (shares just that rec) */
.send-button {
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--sea);
  cursor: pointer;
}

.send-button .icon {
  width: 22px;
  height: 22px;
}


.hint-icon .icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}


/* The Send button on a rec's page is a <button>: same look as the link buttons */
button.quick-action {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

/* Places (step 4.2f): a place's two halves, "FOR ME · 6 TO TRY" and "FOR YOU · 4 LOVED" */
.place-section {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 32px 0 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--ink);
}

.place-section-count {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}

#place-recs > .place-section:first-child {
  margin-top: 12px;
}

/* "6 to try · 4 loved" on the Places list: smaller, so city names keep their room */
#places-list .category-count {
  font-size: 0.85rem;
  white-space: nowrap;
}

body.has-tab-bar #screen-place {
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

/* First time (step 4.2b): the welcome card on For me, and the nudge after the first recs */
.welcome-card {
  margin: 12px 24px 20px 0;   /* room on the right for the A–Z strip, like the list */
  padding: 22px 20px 20px;
  border-radius: 16px;
  background: var(--sea-tint);
  border: 1px solid var(--sage-line);
}

.welcome-card[hidden],
.welcome-nudge[hidden] {
  display: none;
}

.welcome-title {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.15;
  color: var(--ink);
}

.welcome-card p {
  margin: 0 0 16px;
  color: var(--ink);
  line-height: 1.5;
}

.welcome-card .btn {
  margin: 0;
}

.welcome-nudge {
  margin: 8px 24px 16px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--note);
  color: var(--ink);
  font-size: 0.95rem;
}

/* "Forgot password?" under the password box (log in only) */
.forgot-link {
  display: block;
  margin: -4px 0 4px auto;
  padding: 8px 0 8px 12px;
  font-size: 0.875rem;
}
.forgot-link[hidden] {
  display: none;
}

/* ----- Loading placeholders and Try again (4.2c) ----- */
.skeleton {
  opacity: 0;
  animation: skeleton-in 0.2s ease 0.25s forwards;   /* only shows if loading takes a moment */
}
@keyframes skeleton-in { to { opacity: 1; } }
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.skeleton-page .skeleton-row {
  border-bottom: none;
  padding: 8px 0;
}
.skeleton-dot,
.skeleton-lines span {
  background: #EEF1F5;
  border-radius: 8px;
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}
.skeleton-dot {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skeleton-lines span {
  height: 14px;
  width: 70%;
}
.skeleton-lines span + span {
  height: 10px;
  width: 40%;
}
.skeleton-row:nth-child(2n) .skeleton-lines span:first-child { width: 55%; }
.skeleton-row:nth-child(3n) .skeleton-lines span:first-child { width: 80%; }
@keyframes skeleton-pulse { 50% { opacity: 0.5; } }

.try-again {
  padding: 4px 0;
  font-weight: 600;
  text-decoration: underline;
}

/* For you's intro (when nothing is loved yet) sits above the collections */
#foryou-message:not(:empty) {
  margin-bottom: 16px;
}

/* Quick add's "+ New collection" button, after the collections */
.chip-new {
  border-style: dashed;
  color: var(--sea);
}

/* ----- Offline (4.2g) ----- */
/* Under the blue bar while there's no signal */
.offline-strip {
  margin: -14px 0 16px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #FFF3B0;   /* lemon */
  font-size: 0.85rem;
}
/* "2 recs are saved on this phone, waiting…" on For me and For you */
.pending-note {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed var(--sea);
  color: var(--ink);
  font-size: 0.9rem;
}
.offline-strip[hidden],
.pending-note[hidden] {
  display: none;
}

/* Lists screen: the examples under the title, one line for yourself, one for a friend */
.list-examples {
  margin-bottom: 20px;
}
.list-examples p {
  margin: 0 0 10px;
  line-height: 1.5;
}
.list-examples strong {
  display: block;            /* the label on its own line, the examples under it */
  color: var(--sea);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Share box: the hint about the link staying up to date */
.share-hint {
  color: var(--sea);
  font-weight: 600;
}

/* ----- Form & fields redesign: Add a detail, Customize, Location, Dates ----- */
/* "Add a detail": small dashed buttons, one per field not on the form yet */
.detail-chips-box {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.detail-chips-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.detail-chip {
  font: inherit;
  font-size: 0.92rem;
  padding: 8px 12px;
  min-height: 40px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--sea);
  cursor: pointer;
}
.detail-chip:active { background: var(--sea-tint); }

/* "Customize this form" under the form, and "Customize" in the bar */
.customize-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 18px auto 0;
  color: var(--sea);
  font-weight: 600;
}
.btn-customize {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* For me / For you: "+ New collection" and "Edit collections" side by side */
.collection-buttons {
  display: flex;
  gap: 10px;
  margin: 24px 0 32px;
}
.collection-buttons .btn {
  flex: 1;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-left: 8px;
  padding-right: 8px;
}

/* Edit collections: a row per collection, with a trash button on the right */
.collection-edit-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}
.collection-edit-row .category-row {
  flex: 1;
  border-bottom: none;
}
.collection-edit-count {
  color: var(--muted);
  font-size: 0.9rem;
}
.collection-edit-icon {
  color: var(--sea);
  width: 20px;
  height: 20px;
}
.collection-delete {
  flex: none;
  width: 52px;
  border: none;
  background: none;
  color: #B3261E;
  cursor: pointer;
}
.collection-delete .icon { width: 20px; height: 20px; }

/* Customize: "On the form" / "Under Add a detail" headings in the field list */
.field-group-heading {
  padding: 18px 16px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--aperol-text);
  border-bottom: 1px solid var(--line);
}
.field-group-heading.field-divider {
  border-top: 2px dashed var(--line-strong);
  margin-top: 4px;
}
#btn-delete-category { margin-top: 32px; }

/* Location: "Lazio, Italy · change" under the City box */
.location-where {
  margin: -2px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.location-where .location-change {
  font-size: inherit;
  padding: 0;
  min-height: 0;
  color: var(--sea);
}
.location-where.location-ask { color: var(--aperol-text); }
.location-extra {
  display: grid;
  gap: 8px;
}

/* Dates: a button that opens a month calendar (tap the first day, then the last) */
.dates-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.dates-summary .icon { color: var(--sea); width: 20px; height: 20px; }
.dates-summary.dates-empty { color: var(--muted); }
.dates-summary[aria-expanded="true"] { border-color: var(--sea); box-shadow: 0 0 0 3px var(--sea-tint); }

.dates-calendar {
  margin-top: 10px;
  padding: 12px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 6px 20px rgba(20, 27, 43, 0.08);
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cal-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
}
.cal-nav {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--sea);
  cursor: pointer;
}
.cal-nav:active { background: var(--sea-tint); }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 2px;
}
.cal-weekday {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0 6px;
}
.cal-day {
  height: 40px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  border-radius: 0;
}
.cal-day.cal-today { font-weight: 700; color: var(--sea); }
.cal-day.cal-in-range { background: var(--sea-tint); }
.cal-day.cal-start { border-radius: 20px 0 0 20px; }
.cal-day.cal-end { border-radius: 0 20px 20px 0; }
.cal-day.cal-start.cal-end { border-radius: 20px; }
.cal-day.cal-start,
.cal-day.cal-end {
  background: var(--sea);
  color: #fff;
  font-weight: 600;
}
.cal-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.cal-hint {
  flex: 1;
  font-size: 0.82rem;
  color: var(--muted);
}
.cal-foot .btn-link { padding: 6px 0; min-height: 0; }
.cal-done { font-weight: 600; color: var(--sea); }

/* A cover or poster autofill found: small, with Remove */
.cover-preview {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.cover-preview img {
  width: 64px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(20, 27, 43, 0.18);
}
/* The name field's row: its hint goes under the name, and wraps */
.field-row[data-field-id="title"] .field-row-open {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}
.field-row[data-field-id="title"] .field-row-type {
  white-space: normal;
}
#collections-list .category-row { border-bottom: none; }

/* ----- Autofill 4.2i: the results are part of the page (not a floating box), so the page
   scrolls normally; more load at the end of the list ----- */
.autofill-list {
  position: static;
  margin-top: 6px;
  box-shadow: none;
  border-color: var(--line);
}
.autofill-status {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.autofill-more {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--sea);
  cursor: pointer;
}
.autofill-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
}
.autofill-foot .autofill-credit {
  padding: 8px 0;
  text-align: left;
}
.autofill-hide {
  font-size: 0.85rem;
  padding: 8px 0;
  min-height: 0;
}

/* Duplicate warning under the name box (the rec is already in this collection) */
.duplicate-note {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: #B3261E;
}
.duplicate-note a { color: var(--sea); font-weight: 600; }
