/* =====================================================================
   style.css — how Wandertrip looks.
   Change the values in :root to re-theme the whole app.
   ===================================================================== */

:root {
  /* Surfaces and text */
  --bg: #f7f5f2;          /* warm off-white page */
  --panel: #ffffff;       /* cards, pop-ups */
  --fill: #f1eee9;        /* inputs, quiet buttons */
  --text: #1d1b26;
  --muted: #78748a;
  --border: #ebe7e1;
  --accent: #5b4cf0;      /* the one brand color: violet */
  --accent-ink: #ffffff;
  --danger: #e5484d;
  --ink-mix: #000;        /* darkens type colors for readable text */

  /* Activity type colours: a 5-colour palette, similar types share one */
  --berry: #922D50;           /* Vintage Berry */
  --crimson-violet: #501537;  /* Crimson Violet */
  --midnight-violet: #3C1B43; /* Midnight Violet */
  --olive: #B8C480;           /* Muted Olive */
  --lime-cream: #D4E79E;      /* Lime Cream */
  --air-force-blue: #50808E;  /* Air Force Blue */
  --flight: var(--air-force-blue);
  /* other transport */
  --train: var(--berry);
  --bus: var(--berry);
  --ground: var(--berry);
  --transport: var(--berry);
  --stay: var(--midnight-violet);
  --sightseeing: var(--olive);
  --tour: var(--olive);
  --activity: var(--lime-cream);
  --food: var(--crimson-violet);
  --other: #94a3b8;

  /* Colours for messages (not tied to a type) */
  --ok: #0f9d7a;    /* "gets back", tips */
  --warn: #e8590c;  /* warnings */
  --cat-ink-amount: 62%;  /* how much of the type colour is kept in its text colour */
  --on-cat: #ffffff;      /* text on top of a type colour (map pin numbers) */

  /* Shape and depth */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(29, 27, 38, 0.04);
  --shadow: 0 1px 2px rgba(29, 27, 38, 0.04), 0 8px 24px rgba(29, 27, 38, 0.07);
  --shadow-lg: 0 4px 12px rgba(29, 27, 38, 0.06), 0 24px 56px rgba(29, 27, 38, 0.16);

  /* Type */
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font);
}

/* In dark mode, type-coloured text is mixed with white: the violets need
   plenty of it to be readable on a dark background */
/* The two violets are nearly black, so on a dark background they get lifted
   versions of the same hues (otherwise Accommodation and Food disappear) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --cat-ink-amount: 45%; --midnight-violet: #7a5487; --crimson-violet: #a24d7a; }
}
:root[data-theme="dark"] { --cat-ink-amount: 45%; --midnight-violet: #7a5487; --crimson-violet: #a24d7a; }

/* Dark mode: follows the computer's setting, unless My account says
   Light or Dark (that sets data-theme on <html>, see prefs.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f14;
    --panel: #161920;
    --fill: #1f232c;
    --text: #eceaf4;
    --muted: #9792ab;
    --border: #262a34;
    --accent: #8b80ff;
    --accent-ink: #14121f;
    --danger: #ff6b70;
    --ink-mix: #fff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4), 0 32px 64px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
    --bg: #0d0f14;
    --panel: #161920;
    --fill: #1f232c;
    --text: #eceaf4;
    --muted: #9792ab;
    --border: #262a34;
    --accent: #8b80ff;
    --accent-ink: #14121f;
    --danger: #ff6b70;
    --ink-mix: #fff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4), 0 32px 64px rgba(0, 0, 0, 0.5);
  }

/* ===== Basics ===== */
* { box-sizing: border-box; }

/* Anything with the "hidden" attribute stays hidden, whatever else it's styled as */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; }

button, input, select, textarea { font: inherit; color: inherit; }

/* Buttons: quiet by default, violet for the main action */
button {
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s, color 0.15s;
}
button:hover { background: color-mix(in srgb, var(--text) 9%, var(--fill)); }
button:active { transform: scale(0.97); }
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
}
button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink-mix)); }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.6; cursor: default; }

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

/* Inputs: soft filled boxes that light up when you type */
input, select, textarea {
  background: var(--fill);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: border-color 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { font-weight: 500; color: var(--text); font-size: 0.95rem; }
.field .optional { font-weight: 500; }
.field-hint { font-size: 0.75rem; font-weight: 500; color: var(--muted); }

/* "Where are you going?": typed places become chips (recommend.js) */
.dest-picker { position: relative; }
.dest-field {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  background: var(--fill); border: 1.5px solid transparent; border-radius: var(--radius-sm);
  padding: 6px 8px; cursor: text; transition: border-color 0.15s, background 0.15s;
}
.dest-field:focus-within { border-color: var(--accent); background: var(--panel); }
.dest-chips { display: contents; }
.dest-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 8px;
  border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent); font-size: 0.85rem; font-weight: 600;
}
.dest-chip button { background: transparent; padding: 2px; width: 20px; height: 20px; display: grid; place-items: center; color: inherit; border-radius: 999px; }
.dest-chip button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.dest-input { flex: 1; min-width: 140px; border: none; background: transparent; padding: 4px; font-size: 0.95rem; font-weight: 500; color: var(--text); }
.dest-input:focus { border: none; background: transparent; }
.dest-suggestions {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column;
}
.dest-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: transparent;
  text-align: left; font-weight: 500; color: var(--text); border-radius: 8px;
}
.dest-option:hover, .dest-option.first { background: var(--fill); }
.dest-option > .i { color: var(--muted); flex-shrink: 0; }
.dest-option span { display: flex; flex-direction: column; }
.dest-option small { color: var(--muted); font-size: 0.75rem; }
.dest-message { padding: 8px 10px; font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.recs-dests { display: flex; align-items: center; gap: 6px; }
.recs-dests > span { flex: 1; min-width: 0; }
.recs-dests .link-btn { font-size: 0.8rem; }

.link-btn {
  border: none;
  background: none;
  padding: 0;
  border-radius: 4px;
  color: var(--accent);
  font-weight: 600;
  font-size: inherit;
  text-decoration: none;
}
.link-btn:hover { background: none; text-decoration: underline; }

.spacer { flex: 1; }

/* ===== Top bar ===== */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 14px;
  background: transparent;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

/* Row 1: ‹ My trips · trip name and start date · quiet extras */
.topbar-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
#go-home { background: transparent; color: var(--muted); padding: 7px 10px; align-self: flex-start; margin-top: 2px; }
#go-home:hover { background: var(--fill); color: var(--text); }
.trip-heading { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trip-name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  border: none;
  background: transparent;
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: var(--radius-sm);
  min-width: 0;
  width: 100%;
}
.trip-name:hover { background: var(--fill); }
.trip-name:focus { background: var(--fill); border-color: transparent; }

/* "📅 Dec 20 – Dec 22, 2026 · 3 days" under the name (change it from the ⋯ menu on My trips) */
.trip-when { font-size: 0.85rem; font-weight: 600; color: var(--muted); padding-left: 1px; }

.topbar-extras { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
/* Share and Backup: plain text buttons, so they don't compete with the trip tools */
button.quiet { display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--muted); padding: 6px 10px; font-size: 0.85rem; }
button.quiet:hover { background: var(--fill); color: var(--text); }
.topbar-extras > button:not(.quiet) { margin-left: 4px; }
/* My trips: "Sign in" is the one button that stands out (accent colour);
   once signed in, "My account" is a normal button */
body:not(.signed-in) .account-button {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent);
}
body:not(.signed-in) .account-button:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink-mix)); }

/* Row 2: the trip's tools on the left, how to view the plan on the right */
.trip-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.trip-tools { display: flex; flex-wrap: wrap; gap: 8px; }

/* Ideas, Documents, Expenses, Buddies: each has its own colour (--tool),
   used for its icon, hover outline and "open" state, plus a second line
   saying what's in it ("2 saved", "¥12,000 spent"...) */
.tool-ideas   { --tool: #f59e0b; } /* amber, like a light bulb */
.tool-notes   { --tool: #8b5cf6; } /* violet, like a notebook */
.tool-add     { --tool: var(--accent); } /* the app's own colour: it's an action, not a section */
.tool-docs    { --tool: #3b82f6; } /* blue, like a folder */
.tool-money   { --tool: #10b981; } /* green, like money */
.tool-buddies { --tool: #e64980; } /* pink, for people */
button.tool {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
button.tool:hover { border-color: color-mix(in srgb, var(--tool) 55%, var(--border)); background: color-mix(in srgb, var(--tool) 5%, var(--panel)); }
.tool-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  background: color-mix(in srgb, var(--tool) 18%, transparent);
  font-size: 1.05rem;
}
.tool-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tool-label { font-size: 0.92rem; font-weight: 700; }
.tool-sub { font-size: 0.75rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Open (Ideas panel showing, or on the Documents page): filled with its colour */
button.tool.active {
  background: color-mix(in srgb, var(--tool) 14%, var(--panel));
  border-color: var(--tool);
  box-shadow: 0 0 0 1px var(--tool), var(--shadow-sm);
}
button.tool.active .tool-icon { background: var(--tool); }
button.tool.active .tool-sub { color: color-mix(in srgb, var(--tool) 70%, var(--text)); }

/* View switch: a small "View" label and one pill with a sliding white "chip" */
.view-switch { display: flex; align-items: center; gap: 8px; }
.view-switch-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.view-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--fill);
  border-radius: 999px;
}
.view-toggle button { display: inline-flex; align-items: center; gap: 6px; background: transparent; padding: 5px 12px; color: var(--muted); font-size: 0.85rem; }
.view-toggle button:hover { color: var(--text); background: transparent; }
.view-toggle button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm), 0 2px 6px rgba(29, 27, 38, 0.08);
}
.view-icon-sm { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
/* On the Documents page no view is in use, so none is highlighted */
.view-toggle.idle button.active { background: transparent; box-shadow: none; color: var(--muted); }

/* Phones: ‹ My trips and the extras share a line, the trip name goes below,
   tools in a 2×2 grid, view switch full width */
@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .topbar-main { gap: 4px 8px; }
  .trip-heading { order: 3; flex-basis: 100%; }
  .trip-name { font-size: 1.35rem; }
  .trip-tools { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .trip-tools .tool:last-child:nth-child(odd) { grid-column: 1 / -1; } /* five buttons: the last one gets the whole row */
  /* The view options get their own row, set apart from the buttons above by
     some space and a thin line, with "View" in front of them */
  .view-switch { width: 100%; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); gap: 12px; }
  .view-switch-label { display: block; flex: 0 0 auto; }
  .view-toggle { flex: 1; }
  .view-toggle button { flex: 1; justify-content: center; padding: 8px 4px; }
}

/* ===== My trips (home screen) ===== */
.app-title { margin: 0; font-size: 1.7rem; font-weight: 800; flex: 1 1 200px; }
.home { max-width: 1120px; margin: 0 auto; padding: 32px 20px 48px; }
.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

/* Each trip card gets a colorful cover band, cycling through a few gradients */
.trip-card {
  --cover: linear-gradient(135deg, #7c6cff, #ff8ab3);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 92px 20px 20px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.trip-card::before {
  content: "";
  position: absolute;
  inset: 8px 8px auto 8px;
  height: 72px;
  border-radius: calc(var(--radius-lg) - 6px);
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.35) 0 18px, transparent 19px),
    radial-gradient(circle at 70% 75%, rgba(255, 255, 255, 0.2) 0 10px, transparent 11px),
    var(--cover);
}
.trip-grid > .trip-card:nth-child(5n + 2) { --cover: linear-gradient(135deg, #22c1a6, #7dd3fc); }
.trip-grid > .trip-card:nth-child(5n + 3) { --cover: linear-gradient(135deg, #ff9a5a, #ffcd4d); }
.trip-grid > .trip-card:nth-child(5n + 4) { --cover: linear-gradient(135deg, #ec4899, #a855f7); }
.trip-grid > .trip-card:nth-child(5n + 5) { --cover: linear-gradient(135deg, #3b82f6, #22d3ee); }
.trip-card:hover { transform: translateY(-4px) rotate(-0.4deg); box-shadow: var(--shadow-lg); }

.trip-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.trip-card-dates { font-size: 0.75rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.trip-card-name { margin: 0; font-size: 1.45rem; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.trip-card-stats { font-size: 0.85rem; color: var(--muted); }
.trip-card-buddies { font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.trip-card-buddies:empty { display: none; }
.trip-card-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 14px; }

/* The ⋯ menu sits on the cover band */
.trip-menu { position: absolute; top: 16px; right: 16px; }
.menu-button {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.85);
  color: #1d1b26;
  backdrop-filter: blur(6px);
}
.menu-button:hover,
.menu-button[aria-expanded="true"] { background: #fff; }
.menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.menu-list button { background: transparent; text-align: left; padding: 9px 12px; border-radius: var(--radius-sm); font-weight: 500; white-space: nowrap; }
.menu-list button:hover { background: var(--fill); }

.new-trip-card {
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  padding: 20px;
  border: 2px dashed color-mix(in srgb, var(--muted) 35%, transparent);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 1rem;
}
.new-trip-card::before { display: none; }
.new-trip-card .type-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--fill);
  font-size: 1.6rem;
  transition: transform 0.2s, background 0.2s, color 0.2s;
}
.new-trip-card:hover { border-color: var(--accent); color: var(--accent); background: transparent; transform: translateY(-4px); box-shadow: none; }
.new-trip-card:hover .type-icon { background: var(--accent); color: var(--accent-ink); transform: rotate(90deg); }

/* ===== Ideas panel + board side by side ===== */
.workspace { display: flex; align-items: flex-start; }

.ideas-panel {
  flex: 0 0 290px;
  position: sticky;   /* stays in view while you scroll the days */
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 16px;
  background: color-mix(in srgb, var(--panel) 60%, var(--bg));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ideas-heading { margin: 0; font-size: 1.2rem; font-weight: 800; }
/* The Ideas heading is the fold / unfold button */
.ideas-fold {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 0;
  background: transparent; font: inherit; color: var(--text); text-align: left;
}
.ideas-fold:hover { background: transparent; color: var(--accent); }
.ideas-fold > span:first-of-type { flex: 0 1 auto; }
.ideas-fold .i:last-child { margin-left: auto; width: 1em; height: 1em; color: var(--muted); }
.ideas-fold:hover .i:last-child { color: var(--accent); }
.ideas-count {
  font-family: var(--font); font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--ideas, #f59e0b) 18%, transparent); color: color-mix(in srgb, #f59e0b 70%, var(--text));
}
.ideas-hint { margin: 0; font-size: 0.8rem; color: var(--muted); }
.ideas-panel .items { min-height: 80px; flex-shrink: 0; }
.add-idea { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--muted) 40%, transparent); color: var(--muted); }
.add-idea:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

/* "Recommended for you" (recommend.js) */
.recs { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; }
.recs-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; padding: 4px 0; font-weight: 700; font-size: 0.95rem; color: var(--text); text-align: left;
}
.recs-toggle:hover { background: transparent; color: var(--accent); }
.recs-toggle > span { flex: 1; }
.recs-toggle .i:first-child { color: var(--accent); }
.recs-body { display: flex; flex-direction: column; gap: 10px; }
.recs-hint { margin: 0; font-size: 0.8rem; color: var(--muted); }
.recs-load { align-self: flex-start; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); font-weight: 600; }
.recs-load:hover { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.recs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.recs-chip {
  padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  background: var(--fill); color: var(--muted);
}
.recs-chip.active { background: var(--text); color: var(--panel); }
.recs-list { display: flex; flex-direction: column; gap: 6px; }
.rec {
  display: flex; align-items: center; gap: 10px; padding: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.rec-photo {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  background: color-mix(in srgb, var(--sightseeing) 25%, var(--panel)); color: var(--muted);
  display: grid; place-items: center;
}
.rec-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rec-name { font-weight: 600; font-size: 0.88rem; color: var(--text); text-decoration: none; line-height: 1.25; }
.rec-name:hover { color: var(--accent); text-decoration: underline; }
.rec-desc { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rec-add, .rec-hide { flex: 0 0 auto; width: 30px; height: 30px; padding: 0; border-radius: 999px; display: grid; place-items: center; }
.rec-add { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); }
.rec-add:hover { background: var(--accent); color: var(--accent-ink); }
.rec-hide { background: transparent; color: var(--muted); }
.rec-hide:hover { background: var(--fill); color: var(--text); }
.recs-more { align-self: flex-start; font-size: 0.8rem; }

/* On narrow screens (phones), put Ideas above the days instead of beside them */
@media (max-width: 700px) {
  .workspace { flex-direction: column; align-items: stretch; }
  .ideas-panel { flex: none; position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ===== The board of days ===== */
.board {
  flex: 1;
  min-width: 0;  /* lets the board scroll sideways instead of squashing */
  display: flex;
  gap: 20px;
  padding: 24px 20px;
  overflow-x: auto;
  align-items: flex-start;
}
.day {
  flex: 0 0 300px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* List layout: days stacked top-to-bottom instead of side-by-side */
.board.list-view { flex-direction: column; align-items: stretch; width: 100%; max-width: 780px; margin: 0 auto; }
.board.list-view .day { flex: none; }

.day-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.day-header > div:first-child { min-width: 0; } /* lets the day name shrink on narrow screens */
/* The day's ⋯ menu (Delete this day) */
.day-menu { position: relative; flex: 0 0 auto; }
.menu-dots { font-size: 1.2rem; line-height: 1; padding: 4px 10px; }
.menu-dots:hover, .menu-dots[aria-expanded="true"] { color: var(--text); background: var(--fill); }
.day-label { font-size: 0.72rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.day-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  border: none;
  background: transparent;
  padding: 2px 6px;
  margin-left: -6px;
  width: 100%;
}
.day-title:hover, .day-title:focus { background: var(--fill); border-color: transparent; }
.icon-btn { background: transparent; color: var(--muted); padding: 4px 9px; }
.icon-btn:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

.items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 44px;
  border-radius: var(--radius);
  padding: 2px;
  transition: background 0.15s, outline-color 0.15s;
  outline: 2px dashed transparent;
}
.items.drop-target { background: color-mix(in srgb, var(--accent) 8%, transparent); outline-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.empty { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 16px 0; }

.day-buttons { display: flex; gap: 6px; }
.day-buttons button { flex: 1; font-size: 0.85rem; white-space: nowrap; }
.day-buttons .add-item { flex: 2; }
.day-buttons .quiet { flex: 1; justify-content: center; }
.add-item { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.add-item:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

/* ===== Day tabs (Columns view) ===== */
.board.single-view { flex-direction: column; align-items: stretch; width: 100%; max-width: 780px; margin: 0 auto; } /* width: 100% so long day tabs scroll instead of widening the page on phones */
.board.single-view .day { flex: none; padding: 20px; }

.day-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.today-badge {
  margin-left: 6px; padding: 1px 6px; border-radius: 999px; vertical-align: 1px;
  background: var(--accent); color: var(--accent-ink); font-size: 0.62rem; letter-spacing: 0.04em;
}
.day-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 130px;
  max-width: 210px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  text-align: left;
}
.day-tab:hover { background: var(--panel); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-1px); }
.tab-day { font-size: 0.68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tab-title { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-tab.active { background: var(--text); border-color: var(--text); color: var(--panel); box-shadow: var(--shadow); }
.day-tab.active .tab-day { color: color-mix(in srgb, var(--panel) 70%, transparent); }
.day-tab.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }

/* ===== Activity cards ===== */
/* Each type sets --cat; cards, map pins and type buttons use it for their color.
   --cat-ink is a darker (or, in dark mode, lighter) version for readable text. */
.card, .pin, .type-option, .view-dialog, .drag-chip { --cat: var(--other); }
.flight      { --cat: var(--flight); }
.bus         { --cat: var(--bus); }
.train       { --cat: var(--train); }
.ground      { --cat: var(--ground); }
.stay        { --cat: var(--stay); }
.sightseeing { --cat: var(--sightseeing); }
.activity    { --cat: var(--activity); }
.tour        { --cat: var(--tour); }
.food        { --cat: var(--food); }
.sightseeing, .tour, .activity { --on-cat: #2a2d16; } /* olive and lime are light: dark text on them */
.transport   { --cat: var(--transport); }

/* Each card looks like a ticket: a colored "stub" on the left with the type's
   emoji, a dashed perforation, then the details on a soft wash of the color */
.card {
  --cat-ink: color-mix(in srgb, var(--cat) var(--cat-ink-amount), var(--ink-mix));
  --stub: 56px;
  position: relative;
  min-height: 74px;
  border: 1px solid color-mix(in srgb, var(--cat) 35%, var(--border));
  border-radius: var(--radius);
  padding: 12px 14px 12px calc(var(--stub) + 14px);
  cursor: pointer;
  overflow: hidden;
  background: color-mix(in srgb, var(--cat) 6%, var(--panel)); /* a faint, flat tint of the type */
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
/* The "ticket stub": a band of the type's colour, with a little punched hole
   and a dashed tear line (all flat colours) */
.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--stub);
  background:
    radial-gradient(circle at 18px 18px, rgba(255, 255, 255, 0.35) 0 10px, transparent 10.5px), /* the hole: a flat circle */
    var(--cat);
  border-right: 2px dashed color-mix(in srgb, var(--cat) 45%, var(--panel));
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: transparent; }
.card.dragging { opacity: 0.4; }
.card:active { cursor: grabbing; }

.card-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; margin-bottom: 4px; }
.card-time { font-size: 0.78rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--cat-ink);
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  white-space: nowrap;
}
.card-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
/* the type emoji sits in a dark circle, centered on the stub */
.card-icon {
  position: absolute;
  left: calc(var(--stub) / 2 - 20px);
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-size: 1.2rem;
  transition: transform 0.2s;
}
.card:hover .card-icon { transform: translateY(-50%) rotate(-10deg) scale(1.08); }
.card-place, .card-notes, .card-details { font-size: 0.84rem; color: var(--muted); margin-top: 4px; }
.card-details strong { color: var(--text); font-weight: 600; }
.card-details a { color: var(--accent); font-weight: 600; text-decoration: none; }
.card-details .file-link { font-weight: 700; }
.single-view .items { gap: 12px; }
.single-view .card { --stub: 64px; padding: 14px 16px 14px calc(var(--stub) + 16px); min-height: 84px; }
.single-view .card-icon { width: 44px; height: 44px; left: calc(var(--stub) / 2 - 22px); font-size: 1.3rem; }
.single-view .card-title { font-size: 1.08rem; }



.resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  cursor: ns-resize;
}
.resize-handle:hover { background: color-mix(in srgb, var(--cat) 35%, transparent); }

/* ===== Map view ===== */
.board.map-mode { flex-direction: column; align-items: stretch; }
.map-layout {
  display: grid;
  grid-template-columns: minmax(290px, 390px) 1fr;
  gap: 20px;
  align-items: start;
}
.map-canvas {
  height: calc(100vh - 220px);
  min-height: 380px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  contain: paint;      /* keeps the map tiles inside the rounded frame, even while zooming */
  isolation: isolate;
  position: sticky;
  top: 20px;
}
/* "Click the map to zoom with scroll": shown until the map is clicked */
.map-hint {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #1d1b26;
  font: 600 0.75rem var(--font);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  transition: opacity 0.2s;
}
.map-awake .map-hint { opacity: 0; }
.find-missing { font-size: 0.85rem; }

/* Number circle on a card that matches its pin */
.pin-number {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--cat);
  color: var(--on-cat);
  font-size: 0.68rem;
}
.card.no-pin::after {
  content: "Not on the map yet · click to set a location";
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* The teardrop-shaped map pin */
.pin {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--cat);
  border: 2.5px solid white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  color: var(--on-cat);
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font);
}
.pin span { transform: rotate(45deg); }
.pin.idea { background: #ffffff; border-color: var(--other); font-size: 0.8rem; }

/* Leaflet's pop-up bubbles, restyled to match */
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content-wrapper { border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 12px 16px; font-size: 0.85rem; line-height: 1.4; }
.popup-edit {
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  font-size: 0.8rem;
}

/* On phones: map on top, list underneath */
@media (max-width: 700px) {
  .map-layout { grid-template-columns: 1fr; }
  /* top: 0 undoes the wide layout's sticky offset (the map library sets
     position: relative, which would otherwise push the map 20px into the gap) */
  .map-canvas { order: -1; position: static; top: 0; height: 40vh; min-height: 240px; max-height: 380px; }
}

/* ===== Travel times ===== */
.travel-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
}
.mode-toggle { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; background: var(--fill); border-radius: 999px; }
.mode-toggle button { background: transparent; padding: 5px 11px; font-size: 0.8rem; color: var(--muted); }
.mode-toggle button:hover { background: transparent; color: var(--text); }
.mode-toggle button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm), 0 2px 6px rgba(29, 27, 38, 0.08); }
.travel-total { color: var(--muted); font-weight: 600; }
.optimize-route { font-size: 0.82rem; font-weight: 600; color: var(--accent); padding: 6px 12px; }
.optimize-route:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
/* "Reordered for the shortest route … Undo" */
.route-note {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 500;
  background: color-mix(in srgb, var(--ok) 10%, var(--panel)); color: var(--text);
}
.route-note > .i { color: var(--ok); flex-shrink: 0; }
.route-note > span { flex: 1; }
.route-note .link-btn { font-size: 0.82rem; white-space: nowrap; }
.route-note-x { background: transparent; padding: 2px; width: 24px; height: 24px; display: grid; place-items: center; color: var(--muted); }
.route-note-x:hover { background: var(--fill); }

/* The "🚶 12 min · 900 m" line between two cards */
.leg {
  margin: -2px 0 -2px 27px; /* lines up with the middle of the cards' stubs */
  padding: 3px 0 3px 14px;
  border-left: 2px dashed color-mix(in srgb, var(--muted) 40%, transparent);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}
.leg.tight { color: var(--danger); font-weight: 700; border-left-color: var(--danger); }
.leg-start { display: block; margin-bottom: 1px; font-weight: 600; color: var(--text); }
.leg.from-stay { margin-top: 0; padding-top: 0; }
.leg-end { margin: 1px 0 0; }
.leg.to-stay { margin-bottom: 0; padding-bottom: 0; }
.leg a { color: var(--accent); font-weight: 600; text-decoration: none; }
.leg a:hover { text-decoration: underline; }
.fare-chip { font-weight: 700; color: var(--text); cursor: help; }

/* Train/bus line label, colored like the line's sign */
.line-chip {
  display: inline-block;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.6;
  cursor: help;
}

/* ===== Pop-ups ===== */
dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: min(440px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog[open] { animation: pop-in 0.18s ease-out; }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
dialog::backdrop { background: rgba(15, 17, 23, 0.45); backdrop-filter: blur(4px); }
dialog h2 { margin: 0 0 14px; font-size: 1.4rem; font-weight: 800; }
dialog h3 { font-size: 1.05rem; font-weight: 700; }
.dialog-buttons { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.dialog-hint { margin: 0 0 12px; font-size: 0.85rem; color: var(--muted); }

#item-form { display: flex; flex-direction: column; gap: 14px; }
#item-form .row, .row { display: flex; gap: 12px; }
.row .field { flex: 1; min-width: 0; }
#backup-dialog, #item-dialog { width: min(520px, calc(100vw - 32px)); }

/* Type picker (step 1 of adding) */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 14px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--cat) 10%, var(--panel));
  color: color-mix(in srgb, var(--cat) 60%, var(--text));
  font-weight: 700;
}
.type-option:hover {
  background: color-mix(in srgb, var(--cat) 18%, var(--panel));
  transform: translateY(-3px) rotate(-1.5deg);
}
.type-option:nth-child(even):hover { transform: translateY(-3px) rotate(1.5deg); }
.type-icon { font-size: 1.9rem; line-height: 1; }

.form-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.form-header h2 { margin: 0; }
.type-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-fields:empty { display: none; }
@media (max-width: 500px) {
  .type-fields { grid-template-columns: 1fr; }
}

/* Place search */
.place-search { display: flex; gap: 6px; }
.place-search input { flex: 1; min-width: 0; }
.place-status { font-size: 0.8rem; font-weight: 500; }
.place-results { display: flex; flex-direction: column; gap: 4px; }
.place-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 2px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.place-option span { font-size: 0.75rem; color: var(--muted); font-weight: 500; }
.place-hint { font-size: 0.8rem; color: var(--muted); }

/* Uploads and the file viewer */
.file-field { grid-column: 1 / -1; } /* full width in the two-column extras */
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text); }
.file-status { font-size: 0.85rem; font-weight: 500; }
.file-name { font-weight: 700; word-break: break-all; }
.button-like {
  display: inline-block;
  background: var(--fill);
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.button-like:hover { background: color-mix(in srgb, var(--text) 9%, var(--fill)); }

dialog.file-viewer {
  width: min(900px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  padding: 14px;
}
.viewer-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.viewer-body img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 100px);
  margin: 0 auto;
  border-radius: var(--radius);
  background: white; /* so QR codes on transparent images stay scannable */
}
.viewer-body iframe { width: 100%; height: calc(100vh - 100px); border: none; border-radius: var(--radius); background: white; }
.viewer-missing { color: var(--muted); }
.viewer-reason { font-size: 0.8rem; margin-top: 8px; }

/* Backup pop-up */
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#backup-dialog h3 { margin: 22px 0 4px; }
#history-list { max-height: 280px; overflow-y: auto; margin-bottom: 12px; }
.history-row, .buddy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.history-row span, .buddy-row span { display: block; font-size: 0.8rem; color: var(--muted); }

/* Share pop-up */
#share-dialog { width: min(580px, calc(100vw - 32px)); }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; font-weight: 500; cursor: pointer; margin-bottom: 4px; }
.check-row input { margin-top: 2px; }
.share-preview {
  width: 100%;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  resize: vertical;
}
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 8px; }
.print-frame { position: fixed; width: 0; height: 0; border: 0; visibility: hidden; }

/* Account, sign-in and trip buddies */
.sync-status { font-size: 0.8rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sync-status.problem { color: var(--danger); }
#account-button { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-error { margin: 0; font-size: 0.85rem; font-weight: 500; color: var(--danger); }
.form-error:empty { display: none; }
.form-info { margin: 0; font-size: 0.85rem; font-weight: 500; color: color-mix(in srgb, var(--ok) 80%, var(--ink-mix)); }
.form-info:empty { display: none; }
.form-warning { margin: 8px 0; font-size: 0.85rem; color: color-mix(in srgb, var(--warn) 85%, var(--ink-mix)); }
#signin-form, #new-password-form, #new-trip-form { display: flex; flex-direction: column; gap: 14px; }
#signin-form h2, #new-password-form h2, #new-trip-form h2 { margin: 0; }
/* Sign in: title with a ✕, one full-width main button, and the
   "Create an account" switch as a quiet line underneath */
.signin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#forgot-password { font-size: 0.8rem; font-weight: 600; }
.signin-submit { width: 100%; padding: 12px 18px; font-size: 1rem; white-space: nowrap; margin-top: 2px; }
.signin-switch-line {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}
.signin-switch-line .link-btn { font-size: inherit; margin-left: 2px; }
/* underlined, so they read as links whatever the colour scheme */
#forgot-password, .signin-switch-line .link-btn { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
#signin-error:empty, #signin-info:empty { display: none; } /* no gap when there's no message */
#buddies-dialog { width: min(540px, calc(100vw - 32px)); }
#buddies-dialog h2 { margin: 0; }
#buddies-dialog .dialog-hint { margin-top: 6px; }
/* Title on the left, the round ✕ on the right */
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { padding-top: 4px; }
/* "Invite someone": its own box, with its button right under the fields */
.invite-box {
  display: flex; flex-direction: column; gap: 10px; margin-top: 16px; padding: 14px 16px 16px;
  border-radius: var(--radius); background: color-mix(in srgb, var(--fill) 70%, transparent); border: 1px solid var(--border);
}
.invite-box h3 { margin: 0; font-size: 1rem; display: flex; align-items: center; }
.invite-box h3 .i { color: var(--accent); }
.invite-box input { background: var(--panel); }
.invite-box .form-error:empty { display: none; }
.invite-submit { align-self: flex-end; padding-left: 22px; padding-right: 22px; }
@media (max-width: 480px) { .invite-submit { align-self: stretch; } }
.buddies-list { display: flex; flex-direction: column; }

/* ===== Details view (clicking a card) ===== */
dialog.view-dialog {
  --cat-ink: color-mix(in srgb, var(--cat) var(--cat-ink-amount), var(--ink-mix));
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0 0 20px;
  overflow: hidden; /* keeps the colored header's rounded corners... */
}
/* ...so the middle part scrolls instead, between a fixed header and fixed buttons.
   ([open] matters: a closed dialog must stay hidden) */
dialog.view-dialog[open] { display: flex; flex-direction: column; }
.view-dialog .view-cover, .view-dialog .dialog-buttons { flex: 0 0 auto; }
.view-dialog .view-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* No focus outline around a whole pop-up (buttons inside still show theirs) */
dialog:focus-visible { outline: none; }
.view-cover {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 20px 20px 24px;
  background:
    radial-gradient(circle at 92% 0%, color-mix(in srgb, var(--cat) 25%, transparent) 0 70px, transparent 71px),
    color-mix(in srgb, var(--cat) 12%, var(--panel));
}
.view-icon {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 1.8rem;
  transform: rotate(-4deg);
}
.view-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.view-heading .badge { background: var(--panel); }
.view-heading h2 { margin: 0; font-size: 1.5rem; line-height: 1.15; overflow-wrap: anywhere; }
.view-cover .close-x { align-self: flex-start; }

.view-body { display: flex; flex-direction: column; gap: 4px; padding: 16px 24px 4px; }
.view-row { display: grid; grid-template-columns: 32px 1fr; gap: 8px; padding: 8px 0; }
.view-row-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--fill);
  font-size: 0.95rem;
}
.view-label { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.view-value { font-weight: 600; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; overflow-wrap: anywhere; }
.view-map-link, .view-value a { color: var(--accent); font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.view-map-link:hover, .view-value a:hover { text-decoration: underline; }
.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px 16px;
  margin: 8px 0 4px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--fill);
}
.view-grid button { background: var(--panel); }
.view-notes { margin: 2px 0 0; font-weight: 500; white-space: pre-wrap; }
.view-empty { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.view-dialog .dialog-buttons { padding: 8px 24px 0; }
.view-heading h2:focus { outline: none; } /* the title takes focus when the view opens, so the ✕ isn't highlighted */

/* ===== Weather ===== */
.weather-chip {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text);
  cursor: help;
  font-variant-numeric: tabular-nums;
}
.weather-chip.loading { color: var(--muted); background: transparent; }
.weather-chip.typical { color: var(--muted); }
.card-top .weather-chip + .badge { margin-left: 0; }

.view-weather { font-weight: 500; }
.view-weather-main { display: flex; align-items: center; gap: 10px; }
.view-weather-emoji { font-size: 1.8rem; line-height: 1; }
.view-weather-main strong { display: block; font-size: 1rem; }
.view-weather-main span { font-size: 0.85rem; color: var(--muted); }
.view-weather-note { margin-top: 6px; font-size: 0.8rem; color: var(--muted); }

/* ===== Photos & info (details view) ===== */
.place-info { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; }
.place-info-wiki:empty { display: none; }
.place-info-loading { font-size: 0.8rem; color: var(--muted); }
.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.photo-thumb {
  flex: 0 0 auto;
  width: 132px;
  height: 96px;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--fill);
  scroll-snap-align: start;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s; }
.photo-thumb:hover { background: var(--fill); }
.photo-thumb:hover img { transform: scale(1.06); }
.place-info-extract {
  margin: 8px 0 2px;
  font-size: 0.88rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;   /* about 4 lines, then "…" */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.place-info-credit { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.place-info-credit:hover { color: var(--accent); }
.google-reviews-button {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, #fbbc04 18%, var(--panel));
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.google-reviews-button:hover { background: color-mix(in srgb, #fbbc04 30%, var(--panel)); transform: translateY(-1px); }

/* ===== Expenses ===== */
.card-expense { margin-top: 6px; font-size: 0.82rem; font-weight: 700; color: var(--text); }

.expenses { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; flex: 1 1 100%; width: 100%; } /* full width, so lines end where the Edit button does */
.expenses-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.currency-select { padding: 4px 8px; font-size: 0.8rem; font-weight: 600; border-radius: 999px; }
.expense-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--fill);
  text-align: left;
  font-weight: 500;
}
/* In the details view a line is: [receipt thumbnail] [description … amount] */
div.expense-row { padding: 6px; gap: 8px; }
.expense-main {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-weight: 500;
}
.expense-main:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.expense-main strong { display: block; font-size: 0.9rem; }
.expense-main span { display: block; font-size: 0.78rem; color: var(--muted); }
.expense-main b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.expense-row strong { display: block; font-size: 0.9rem; }
.expense-row span { display: block; font-size: 0.78rem; color: var(--muted); }
.expense-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.add-expense { align-self: flex-start; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 0.85rem; }
.add-expense:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

#expense-dialog { width: min(480px, calc(100vw - 32px)); }
#expense-form { display: flex; flex-direction: column; gap: 14px; }
#expense-form h2 { margin: 0; }

/* Two-choice switch made from radio buttons */
.segmented { display: inline-flex; align-self: flex-start; padding: 3px; gap: 2px; background: var(--fill); border-radius: 999px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 6px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: var(--muted); transition: background 0.15s, color 0.15s; }
.segmented input:checked + span { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm), 0 2px 6px rgba(29, 27, 38, 0.08); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.split-options { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.split-people { display: flex; flex-direction: column; gap: 4px; }
.split-person { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-weight: 600; cursor: pointer; }
.split-name { flex: 1; }
.split-share { font-variant-numeric: tabular-nums; color: var(--muted); }
.split-input { width: 120px; text-align: right; padding: 6px 10px; }
.split-summary { margin: 0; font-size: 0.82rem; font-weight: 600; color: color-mix(in srgb, var(--ok) 80%, var(--ink-mix)); }
.split-summary.problem { color: var(--danger); }

.travelers-editor { font-size: 0.9rem; }
.travelers-editor summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  width: fit-content;
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: 8px;
}
.travelers-editor summary:focus-visible { outline-offset: 0; }

/* Every row is [name box][fixed-width button], so the boxes line up */
.travelers-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.travelers-list { display: flex; flex-direction: column; gap: 8px; }
.travelers-list:empty { display: none; }
.traveler-row { display: grid; grid-template-columns: 1fr 96px; gap: 8px; align-items: center; }
.traveler-row input { min-width: 0; }
.traveler-row button { width: 100%; padding: 9px 0; }
.remove-traveler { background: transparent; color: var(--muted); font-weight: 600; }
.remove-traveler:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
#add-traveler { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
#add-traveler:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

/* ===== Trip expenses / settle up ===== */
.settle-body { display: flex; flex-direction: column; gap: 6px; }
.expenses-page { max-width: 760px; }
.settle-body h3 { margin: 16px 0 4px; font-size: 1rem; }
.settle-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.35) 0 40px, transparent 41px),
    linear-gradient(135deg, #7c6cff, #ff8ab3);
  color: #fff;
}
.settle-total span { font-size: 0.8rem; font-weight: 600; opacity: 0.9; }
.settle-total strong { font-family: var(--font-display); font-size: 2rem; letter-spacing: -0.02em; line-height: 1.1; }

.balance-table { display: flex; flex-direction: column; }
.balance-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.balance-row:first-child { border-top: none; }
.balance-name strong { display: block; }
.balance-name span { font-size: 0.8rem; color: var(--muted); }
.balance-status { font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.balance-status.gets { color: color-mix(in srgb, var(--ok) 80%, var(--ink-mix)); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.balance-status.owes { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.balance-status.even { color: var(--muted); background: var(--fill); }

.payment-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}
.payment-row.paid { background: var(--fill); color: var(--muted); }
.payment-text { flex: 1; font-size: 0.9rem; }
.payment-arrow { color: var(--muted); }
.payment-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.payment-row button:not(.link-btn) { font-size: 0.8rem; padding: 6px 12px; background: var(--panel); }
.settle-done { margin: 4px 0; font-weight: 700; font-size: 1rem; }

/* ===== Receipt photos ===== */
.receipt-thumb {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
}
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.receipt-thumb:hover { background: var(--panel); }
.receipt-thumb:hover img { transform: scale(1.08); }
.receipt-status { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.receipt-status .file-name { color: var(--text); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.single-view .leg { margin-left: 31px; }
/* Yellow is light, so Activity's map pin and number badge use dark text */
.pin.activity, .card.activity .pin-number { color: #3d2c00; }

/* ===== Flights: legs, dates and time zones ===== */
.flight-segments { display: flex; flex-direction: column; gap: 10px; }
.flight-leg {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--flight) 30%, var(--border));
  background: color-mix(in srgb, var(--flight) 6%, var(--panel));
}
.flight-leg-head { display: flex; justify-content: space-between; align-items: center; }
.flight-leg-head strong { font-family: var(--font-display); font-size: 1rem; }
.date-time { display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px; }
.date-time input { min-width: 0; }
.tz-label { font-size: 0.78rem; font-weight: 600; color: color-mix(in srgb, var(--flight) 70%, var(--ink-mix)); }
.leg-extras { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .leg-extras { grid-template-columns: 1fr; } }
.flight-time { font-size: 0.85rem; font-weight: 700; }
.flight-time:empty { display: none; }
.flight-time.problem, .layover-line.problem { color: var(--danger); }
.layover-line {
  align-self: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--fill);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.add-connection { align-self: flex-start; background: color-mix(in srgb, var(--flight) 14%, transparent); color: color-mix(in srgb, var(--flight) 70%, var(--ink-mix)); }
.add-connection:hover { background: color-mix(in srgb, var(--flight) 22%, transparent); }

/* In the details view */
.view-flight-leg { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.view-flight-line { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: baseline; }
.view-flight-tag { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.view-flight-line strong { display: block; }
.view-flight-place { display: block; font-weight: 500; }
.view-flight-line .tz-label { display: block; }
.view-flight-facts { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.view-pass-button { align-self: flex-start; font-size: 0.85rem; background: color-mix(in srgb, var(--flight) 14%, transparent); color: color-mix(in srgb, var(--flight) 70%, var(--ink-mix)); }
.view-pass-button:hover { background: color-mix(in srgb, var(--flight) 22%, transparent); }

/* ===== Addresses ===== */
.view-address { flex-basis: 100%; font-size: 0.82rem; font-weight: 500; color: var(--muted); line-height: 1.4; }
.view-address:empty { display: none; }
.view-flight-line .view-address { margin-top: 1px; }

/* ===== Day highlights (flights, check-in/out) under the day title ===== */
/* "Flight SQ955: Soekarno-Hatta Airport → Changi Airport", in full: long
   ones wrap onto the next line, lined up after the icon */
.day-highlight {
  display: flex;
  align-items: flex-start;
  gap: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.day-highlight > .i { flex-shrink: 0; margin-top: 0.12em; }
.day-highlight:first-of-type { margin-top: 4px; }

/* ===== "+ Add day" ===== */
.add-day-tab {
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 6px;
  min-width: 120px;
  background: transparent;
  box-shadow: none;
  border: 2px dashed color-mix(in srgb, var(--muted) 35%, transparent);
  color: var(--muted);
  font-weight: 700;
}
.add-day-tab:hover { background: transparent; border-color: var(--accent); color: var(--accent); }
.add-day-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 120px;
  flex: 0 0 140px;
  border-radius: var(--radius-lg);
  border: 2px dashed color-mix(in srgb, var(--muted) 35%, transparent);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.add-day-card:hover { background: transparent; border-color: var(--accent); color: var(--accent); }
.board.list-view .add-day-card { flex: none; min-height: 80px; }
.add-day-plus { font-size: 1.2rem; line-height: 1; }

/* ===== Dragging: a small chip instead of the whole card ===== */
.drag-chip {
  position: fixed;
  top: -200px; /* off screen: the browser only takes a picture of it */
  left: -200px;
  max-width: 260px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--cat);
  background: color-mix(in srgb, var(--cat) 14%, var(--panel));
  color: var(--text);
  font: 700 0.9rem var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

/* ===== "Add to date" on idea cards ===== */
.add-to-date {
  margin-top: 8px;
  padding: 5px 12px;
  font-size: 0.8rem;
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  color: var(--cat-ink);
}
.add-to-date:hover { background: color-mix(in srgb, var(--cat) 24%, transparent); }
.day-picker { position: fixed; z-index: 1000; right: auto; width: max-content; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); max-height: 320px; overflow-y: auto; }
.day-picker button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.day-picker strong { font-size: 0.75rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.day-picker span { font-weight: 600; }
.day-picker-empty { padding: 10px 12px; font-size: 0.85rem; color: var(--muted); }

/* A card that just arrived on a day glows for a moment */
.card.just-added { animation: just-added 1.6s ease-out; }
@keyframes just-added {
  0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat) 45%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ===== Wandertrip brand ===== */
.brand-logo { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 4px 12px rgba(109, 92, 255, 0.3); flex: 0 0 auto; }
.brand-logo.small { width: 22px; height: 22px; border-radius: 7px; box-shadow: none; }
.brand-logo.large { width: 72px; height: 72px; border-radius: 20px; }
.app-title.brand { display: flex; align-items: center; gap: 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #6d5cff, #ff7fae);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tagline { font-family: var(--font); font-size: 0.78rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-top: 3px; }
#go-home { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; }
.home-heading { margin: 0 0 18px; font-size: 1.5rem; font-weight: 800; }
.home-welcome { text-align: center; max-width: 460px; margin: 24px auto 32px; }
.home-welcome h2 { margin: 16px 0 6px; font-size: 1.8rem; font-weight: 800; }
.home-welcome p { margin: 0; color: var(--muted); }

/* ===== My account ===== */
#account-dialog { width: min(460px, calc(100vw - 32px)); }
#account-dialog h3 { margin: 20px 0 8px; font-size: 1rem; }
.account-head { display: flex; align-items: center; gap: 14px; }
.account-head h2 { margin: 0; }
.account-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #6d5cff, #ff7fae);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
}
.account-email { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.scheme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.scheme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--fill);
  border: 2px solid transparent;
  font-weight: 600;
}
.scheme-option[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.scheme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--light) 50%, var(--dark) 50%); /* light and dark shades */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
@media (max-width: 460px) { .scheme-options { grid-template-columns: repeat(2, 1fr); } }

/* The chosen option in a switch gets a thin accent outline, so it stands out
   in dark mode too (where the white "chip" is only slightly lighter) */
.segmented input:checked + span,
.view-toggle button.active,
.mode-toggle button.active { box-shadow: var(--shadow-sm), inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
.account-head h2:focus { outline: none; }
body.signed-in #prefs-button { display: none; } /* signed in: My account has these settings */
.account-avatar { font-size: 1.4rem; }

/* ===== My Travel Documents ===== */
.documents-page { max-width: 900px; margin: 0 auto; padding: 24px 20px 48px; display: flex; flex-direction: column; gap: 20px; }
/* Page header (Notes, Documents, Budget & expenses): "Back to plan" on its
   own row at the top, then the title (and the page's main button, if any) */
.docs-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 16px; }
.docs-back {
  flex: 0 0 100%; width: fit-content; max-width: fit-content; /* its own row, as wide as its text */
  display: inline-flex; align-items: center; gap: 2px;
  padding: 8px 16px 8px 12px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  color: var(--text); font-weight: 600; font-size: 0.9rem;
}
.docs-back .i { color: var(--accent); }
.docs-back:hover { background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.docs-title { flex: 1 1 260px; }
.docs-title h2 { margin: 0; font-size: 1.7rem; font-weight: 800; }
.docs-title p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.docs-upload { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.docs-upload:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink-mix)); }

.docs-group { display: flex; flex-direction: column; gap: 8px; }
.docs-group h3 { margin: 4px 0 2px; font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.docs-count { font-family: var(--font); font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--fill); color: var(--muted); }

.doc-row.unassigned { --cat: var(--other); } /* the others take their type's colour (.flight, .stay, …) */
.doc-row {
  --cat-ink: color-mix(in srgb, var(--cat) var(--cat-ink-amount), var(--ink-mix));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--cat) 25%, var(--border));
  border-left: 5px solid var(--cat);
  box-shadow: var(--shadow-sm);
}
.doc-row .receipt-thumb { width: 56px; height: 56px; }
.doc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-info strong { font-size: 0.98rem; }
.doc-info span { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-info .doc-source { font-size: 0.72rem; font-weight: 700; color: var(--cat-ink); }
.doc-name-input { font-weight: 700; font-size: 0.95rem; padding: 4px 8px; margin-left: -8px; background: transparent; }
.doc-name-input:hover { background: var(--fill); }
.doc-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.doc-actions button { font-size: 0.82rem; padding: 6px 12px; }
.doc-assign { font-size: 0.82rem; padding: 6px 10px; max-width: 240px; border-radius: 999px; }
@media (max-width: 640px) {
  .doc-row { flex-wrap: wrap; }
  .doc-actions { width: 100%; justify-content: flex-start; }
  .doc-assign { max-width: 100%; flex: 1; }
}

.docs-empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.docs-empty-icon { font-size: 3rem; }
.docs-empty h3 { color: var(--text); margin: 8px 0 6px; font-size: 1.3rem; }
.docs-empty p { max-width: 460px; margin: 0 auto; }

/* in a card's details view */
.view-documents { display: flex; flex-wrap: wrap; gap: 6px; }
.view-documents button { font-size: 0.85rem; }

/* ===== Phones: a little less padding around days, so cards get the room ===== */
@media (max-width: 640px) {
  .board { padding: 16px 12px; }
  .day, .board.single-view .day { padding: 14px; }
}

/* "✈️ Check flight status ↗ · FlightAware ↗" under each flight leg */
.view-flight-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 0.85rem; font-weight: 600; }
.view-flight-links a { color: var(--accent); text-decoration: none; }
.view-flight-links a:hover { text-decoration: underline; }

/* ===== "Are you sure?" pop-up ===== */
.confirm-dialog { width: min(400px, calc(100vw - 32px)); }
.confirm-dialog h2 { font-size: 1.2rem; margin: 0 0 6px; overflow-wrap: anywhere; }
.confirm-text { margin: 0 0 16px; color: var(--muted); font-size: 0.92rem; white-space: pre-line; }
button.danger-solid { background: var(--danger); color: #fff; }
button.danger-solid:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }

/* ===== Offline banner ===== */
body:not(.signed-in) #offline-sync-note { display: none; } /* "will sync" only applies when signed in */
.offline-banner {
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  background: color-mix(in srgb, var(--warn) 16%, var(--panel));
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
}

/* ===== Icons (icons.js) ===== */
/* Thin line icons that take the colour of the text around them. Next to text
   they get a small gap; inside an icon-only badge they're centred instead. */
.i {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.2em;
  margin-right: 0.4em;
  stroke-width: 2;
}
[data-icon] { display: contents; } /* the placeholder itself takes no space */
.card-icon .i, .tool-icon .i, .type-icon .i, .view-icon .i, .view-row-icon .i, .docs-empty-icon .i,
.add-day-plus .i, .account-avatar .i, .pin .i, .view-weather-emoji .i, .receipt-thumb .i { margin: 0; vertical-align: middle; }
.type-icon .i, .view-icon .i, .docs-empty-icon .i, .view-weather-emoji .i { width: 1em; height: 1em; stroke-width: 1.75; }
.card-icon .i { width: 1.1em; height: 1.1em; }
.pin .i { width: 15px; height: 15px; }

/* Coloured by their activity type, or their tool */
.card-icon, .view-icon { color: var(--cat-ink); }
.tool-icon { color: var(--tool); }
button.tool.active .tool-icon { color: #fff; }
.docs-group h3 .i, .stat .i { color: color-mix(in srgb, var(--cat) var(--cat-ink-amount), var(--ink-mix)); }
.stat { display: inline-flex; align-items: center; margin-left: 10px; }
.stat .i { margin-right: 0.25em; }
.weather-chip .i { margin-right: 0.25em; }
.day-highlight .i, .card-place .i, .tz-label .i { color: var(--muted); }
.form-warning .i, .leg.tight .i { color: inherit; }

/* ===== "Continue with Google" (sign-in pop-up) ===== */
/* Google's sign-in button style: white with a grey border and the colour "G" */
.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px;
  font-size: 0.98rem;
  font-weight: 600;
  color: #1f1f1f;
  background: #ffffff;
  border: 1px solid #747775;
}
.google-button:hover { background: #f2f2f2; }
.google-g { width: 18px; height: 18px; flex: none; }
.or-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ===== Privacy policy page (privacy.html), and its link on My trips ===== */
.home-footer { margin-top: 40px; text-align: center; font-size: 0.82rem; }
.home-footer a { color: var(--muted); }
.legal-page { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; line-height: 1.6; }
.legal-page h1 { font-size: 2rem; margin: 16px 0 4px; }
.legal-page h2 { font-size: 1.2rem; margin: 28px 0 6px; }
.legal-page p, .legal-page li { color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.legal-page a { color: var(--accent); }
.legal-updated { margin: 0 0 20px; font-size: 0.85rem; color: var(--muted) !important; }
.legal-back { font-weight: 600; text-decoration: none; }

/* ===== Budgets (budget.js) ===== */
.budget-input { display: flex; gap: 8px; }
.budget-input select { flex: 0 0 auto; width: 120px; }
.budget-input input { flex: 1; min-width: 0; }

/* On a card: "¥12,000 of ¥15,000" */
.money-line.under { color: var(--ok); font-weight: 600; }
.money-line.over { color: var(--danger); font-weight: 700; }

/* The bar: how much of a budget is used */
.budget-bar { height: 6px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.budget-bar span { display: block; height: 100%; border-radius: inherit; background: var(--ok); transition: width 0.3s; }
.budget-bar.near span { background: var(--warn); }
.budget-bar.over span { background: var(--danger); }

/* In a card's details: budget, then expenses */
.budget-box {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; margin-bottom: 4px;
  border-radius: var(--radius-sm); background: color-mix(in srgb, var(--fill) 70%, transparent);
}
.budget-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 0.88rem; }
.budget-top strong.under { color: var(--ok); }
.budget-top strong.over { color: var(--danger); }
.budget-sub { font-size: 0.78rem; color: var(--muted); }

/* On the Budget & expenses pop-up */
.budget-summary { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.budget-summary h3 { margin: 8px 0 0; }
.budget-overall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.budget-overall > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--fill); }
.budget-overall span { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.budget-overall strong { font-size: 1.05rem; font-weight: 800; }
.budget-overall .under strong { color: var(--ok); }
.budget-overall .over strong { color: var(--danger); }
.budget-table { display: flex; flex-direction: column; }
.budget-row {
  display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr 1fr 1fr; gap: 4px 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem;
}
.budget-row > span:not(.budget-cat) { text-align: right; font-variant-numeric: tabular-nums; }
.budget-row.head { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0; }
.budget-row .budget-bar { grid-column: 1 / -1; height: 4px; }
.budget-cat { display: flex; align-items: center; gap: 8px; min-width: 0; }
.budget-cat > .i { color: var(--muted); flex-shrink: 0; }
.budget-cat > span { display: flex; flex-direction: column; min-width: 0; }
.budget-cat small { color: var(--muted); font-size: 0.72rem; }
.budget-row .under { color: var(--ok); font-weight: 700; }
.budget-row .over { color: var(--danger); font-weight: 700; }
.budget-row .none { color: var(--muted); font-size: 0.78rem; }
.extra-budgets { display: flex; flex-direction: column; gap: 6px; }
.extra-budgets b small { font-weight: 500; color: var(--muted); }
.rates-credit { margin: 0; font-size: 0.72rem; color: var(--muted); }
.rates-credit a { color: inherit; }
@media (max-width: 480px) {
  .budget-row { grid-template-columns: minmax(0, 1.3fr) 1fr 1fr 1fr; font-size: 0.8rem; }
}
.budget-row.head > span:first-child { text-align: left; }

/* Trip currency, at the top of Budget & expenses */
.trip-currency-row { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; }
.trip-currency { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; font-size: 0.95rem; }
.trip-currency select { width: 140px; font-weight: 600; }
.trip-currency-row .dialog-hint { margin: 0; font-size: 0.78rem; }

/* ===== Trip notes (notes.js) ===== */
.notes-new { display: flex; flex-wrap: wrap; gap: 8px; }
.note-new-btn { display: inline-flex; align-items: center; gap: 2px; background: var(--panel); border: 1px solid var(--border); font-weight: 600; }
.note-new-btn:hover { border-color: color-mix(in srgb, #8b5cf6 55%, var(--border)); background: color-mix(in srgb, #8b5cf6 6%, var(--panel)); }
.note-new-plus .i { color: #8b5cf6; margin-right: 2px; }
.notes-grid { columns: 2 320px; column-gap: 14px; }
.note {
  break-inside: avoid; margin: 0 0 14px; padding: 14px 14px 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px;
}
.note:focus-within { border-color: color-mix(in srgb, #8b5cf6 50%, var(--border)); }
.note-head { display: flex; align-items: flex-start; gap: 8px; }
.note-kind { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, #8b5cf6 14%, transparent); color: #8b5cf6; }
.note-kind .i { margin: 0; }
/* Every box in a note wraps long text and grows taller (notes.js) */
.note-field {
  display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; /* never wider than its note */
  resize: none; overflow: hidden; line-height: 1.4; font-family: inherit; overflow-wrap: anywhere;
}
.note, .note-body, .note-head, .link-fields, .contact-top { min-width: 0; }
.note { overflow: hidden; } /* nothing pokes out into the next note */
.note-title { flex: 1; min-width: 0; background: transparent; border: none; padding: 4px 2px; font-size: 1.05rem; font-weight: 700; color: var(--text); }
.note-title:focus { background: var(--fill); border: none; }
.note-icon-btn { flex: 0 0 auto; width: 30px; height: 30px; padding: 0; border-radius: 999px; display: grid; place-items: center; background: transparent; color: var(--muted); }
.note-icon-btn .i { margin: 0; }
.note-icon-btn:hover { background: var(--fill); color: var(--text); }
.note-head .note-icon-btn:hover { color: var(--danger); }
.note-body { display: flex; flex-direction: column; gap: 6px; }
.note-body input, .note-body textarea { font-size: 0.92rem; }
.note-textarea { width: 100%; resize: none; min-height: 72px; line-height: 1.45; }
.note-found-links, .contact-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.note-link-chip {
  display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); text-decoration: none;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-link-chip:hover { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); }
.note-add-row { align-self: flex-start; font-size: 0.85rem; padding: 4px 0; }
.note-meta { font-size: 0.72rem; color: var(--muted); text-align: right; }
.note-progress { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.note-progress.all-done { color: var(--ok); }
.note-progress:empty { display: none; }

/* Checklist */
.check-list { display: flex; flex-direction: column; gap: 2px; }
.check-row { display: flex; align-items: flex-start; gap: 8px; }
.check-row input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 8px; }
.check-text { flex: 1; min-width: 0; background: transparent; border-color: transparent; padding: 6px 6px; }
.check-row.done .check-text { text-decoration: line-through; color: var(--muted); }
.row-remove { width: 26px; height: 26px; opacity: 0; transition: opacity 0.15s; }
.check-row:hover .row-remove, .check-row:focus-within .row-remove,
.link-row:hover .row-remove, .link-row:focus-within .row-remove,
.contact-row:hover .row-remove, .contact-row:focus-within .row-remove { opacity: 1; }
@media (hover: none) { .row-remove { opacity: 1; } }

/* Links */
.links-list, .contacts-list { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; align-items: flex-start; gap: 6px; }
.link-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.link-label { font-weight: 600; }
.link-url { font-size: 0.85rem !important; color: var(--accent); }
.link-open { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); }

/* Contacts */
.contact-row { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.contact-row:last-child { border-bottom: none; padding-bottom: 0; }
.contact-top { display: flex; align-items: flex-start; gap: 6px; }
.contact-fields { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px; }
.contact-fields .contact-name { grid-column: 1 / -1; font-weight: 600; }
.contact-fields .note-field:last-child { grid-column: 1 / -1; }

/* Empty page: ready-made notes */
.note-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.note-starter { background: var(--panel); border: 1px solid var(--border); font-weight: 600; }
.note-starter .i { color: #8b5cf6; }
.note-starter:hover { border-color: #8b5cf6; }

@media (max-width: 600px) {
  .docs-title h2 { font-size: 1.45rem; }
}

/* The ✕ that closes a pop-up (a card's details, Sign in): a round button,
   big enough to see and tap */
.close-x {
  flex: 0 0 auto; width: 40px; height: 40px; padding: 0; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  position: relative; z-index: 1; /* above the cover's decoration */
}
.close-x .i { width: 20px; height: 20px; margin: 0; stroke-width: 2.25; }
.close-x:hover { background: var(--fill); border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.close-x:active { transform: scale(0.94); }

/* ===== "Import from booking" in the card form (import.js) ===== */
.import-box {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; margin-bottom: 4px;
  border-radius: var(--radius); border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
}
.import-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.import-icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.import-icon .i { margin: 0; width: 20px; height: 20px; }
.import-text { flex: 1 1 200px; display: flex; flex-direction: column; gap: 2px; font-size: 0.82rem; color: var(--muted); }
.import-text strong { font-size: 0.95rem; color: var(--text); }
.import-button { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.import-button:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink-mix)); }
.import-status { margin: 0; font-size: 0.85rem; display: flex; gap: 6px; align-items: flex-start; }
.import-status:empty { display: none; }
.import-status .i { flex-shrink: 0; margin-top: 2px; }
.import-status.working { color: var(--muted); }
.import-status.done { color: var(--text); }
.import-status.done .i { color: var(--ok); }
.import-status.problem { color: var(--danger); }
.import-status em { color: var(--muted); font-style: normal; }

/* "Add activity" in the main row: filled with the accent colour, so it reads as the one action */
button.tool.tool-add { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.tool.tool-add:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink-mix)); border-color: var(--accent); }
.tool-add .tool-icon { background: color-mix(in srgb, var(--accent-ink) 22%, transparent); color: var(--accent-ink); }
.tool-add .tool-sub { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }
/* Which day a new card goes on */
.add-to-day { margin: -4px 0 12px; }
.add-to-day select { font-weight: 600; color: var(--text); }
