:root {
  --mauve: #c9a2c2;
  --cream: #f8ebd3;
  --ivory: #fbf5ea;
  --dark: #015f6b;
  --ink: #1f2a2e;
  --ink-soft: #56605f;
  --line: #eadfcb;
  --field-line: #d8cbb3;
  --paper: #ffffff;
  --tint: #f3eada;
  --active: #f4e7f1;
  --alert: #a4262c;
  --paid-ink: #1f6b41;
  --status-planned: #c62828;
  --status-done: #c96a00;
  --status-paid: #2e8b57;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --font-title: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  --bar-height: 68px;
  --bar-bottom: max(16px, env(safe-area-inset-bottom));
  --shadow-card: 0 4px 12px rgba(31, 42, 46, 0.06);
  --shadow-bar: 0 10px 28px rgba(31, 42, 46, 0.18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font: 500 17px/1.4 var(--font);
  font-variant-numeric: lining-nums tabular-nums;
}

h1, h2, p { margin: 0; }

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

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

.icon { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

#view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(var(--bar-height) + var(--bar-bottom) + 28px);
}

/* Sign in: the card holds everything, so nothing has to be read over the photo. */
.login { min-height: 100dvh; }
.login__photo { display: block; width: 100%; height: 56dvh; object-fit: cover; object-position: center top; background: var(--tint); }
.login__main { position: relative; max-width: 420px; margin: -36px auto 0; padding: 0 16px calc(env(safe-area-inset-bottom) + 20px); }
.login__panel { padding: 22px 20px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-bar); }
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.login__logo { flex: none; width: 56px; height: 56px; border-radius: 13px; }
.login__title { font-family: var(--font-title); font-size: 34px; font-weight: 600; line-height: 1.05; }
.login .field input { background: var(--ivory); }

/* Forms */
.form { display: grid; gap: 14px; }
.form--spaced { margin-top: 14px; }
.form__error { color: var(--alert); font-weight: 600; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 52px;
  padding: 11px 14px;
  border: 1.5px solid var(--field-line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 104px; resize: vertical; line-height: 1.35; }
.field input:focus, .field textarea:focus { border-color: var(--dark); outline: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.button {
  min-height: 54px;
  padding: 12px 18px;
  border: 1.5px solid var(--dark);
  border-radius: 27px;
  background: var(--paper);
  color: var(--dark);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.button:disabled { opacity: 0.55; }
.button--primary { min-height: 58px; border-color: var(--dark); background: var(--dark); color: var(--cream); font-size: 19px; }
.button--quiet { border-color: transparent; font-weight: 600; min-height: 44px; padding: 8px 4px; background: none; color: var(--ink); }
.button--danger { border-color: transparent; color: var(--alert); background: none; font-weight: 600; min-height: 44px; }
.button--paid { border-color: var(--status-paid); color: var(--paid-ink); }
.button--wide { width: 100%; }
.button--spaced { margin-top: 10px; }

.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chips--two { grid-template-columns: repeat(2, 1fr); }
.chips--four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chip {
  min-height: 48px;
  padding: 6px 4px;
  border: 1.5px solid var(--field-line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.15;
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--dark); border-color: var(--dark); color: var(--cream); font-weight: 700; }
.chip--icon { min-height: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 15px; }
.chips--four .chip--icon { min-height: 72px; padding: 4px 2px; font-size: 13px; line-height: 1.1; }

.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 6px; align-items: center; }
.stepper input { padding-left: 0; padding-right: 0; text-align: center; font-weight: 700; }
.stepper .button { min-height: 52px; padding: 0; border-radius: 14px; font-size: 26px; line-height: 1; }

/* Page header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -4px 6px; min-height: 44px; }
.topbar__back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; color: var(--ink); font-size: 17px; font-weight: 600; text-decoration: none; }
.topbar__icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); }
.home-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.home-head__logo { flex: none; width: 46px; height: 46px; border-radius: 11px; }
.page-title { font-family: var(--font-title); font-size: 38px; line-height: 1.05; font-weight: 600; overflow-wrap: anywhere; }
.page-meta { color: var(--ink-soft); font-size: 16px; margin-top: 4px; overflow-wrap: anywhere; }

/* Thumb-reach menu, always floating above the page. */
.floating-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: var(--bar-bottom);
  z-index: 10;
  max-width: 528px;
  height: var(--bar-height);
  margin: 0 auto;
  display: flex;
  gap: 8px;
}
.floating-bar__tabs {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow-bar);
}
.floating-bar__tabs--compact { flex: none; grid-auto-columns: 68px; gap: 2px; }
.floating-bar__tabs--compact .floating-bar__tab { font-size: 12px; }
.floating-bar__tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 28px; color: var(--ink-soft); font-size: 13px; font-weight: 600; text-decoration: none; }
.floating-bar__tab[aria-current='page'] { background: var(--active); color: var(--ink); font-weight: 700; }
.floating-bar__tab[aria-current='page'] .icon { color: var(--dark); stroke-width: 2; }
.floating-bar__action { flex: none; width: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; border-radius: 34px; background: var(--dark); color: var(--cream); font-size: 15px; font-weight: 700; text-decoration: none; box-shadow: var(--shadow-bar); cursor: pointer; }
.floating-bar__action:disabled { opacity: 0.55; }
.floating-bar__action .icon { stroke-width: 2.25; }
.floating-bar__action--wide { flex: 1; width: auto; flex-direction: row; gap: 6px; font-size: 17px; }

/* List or calendar (plan 2.6, B1) */
.home-head + .segmented { margin-top: 8px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; margin-bottom: 4px; background: var(--tint); border-radius: 14px; }
.segmented__item { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border: 0; border-radius: 11px; background: none; color: var(--ink-soft); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; }
.segmented__item[aria-current='page'], .segmented__item[aria-pressed='true'] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(31, 42, 46, 0.12); }
.segmented__item .icon { width: 18px; height: 18px; stroke-width: 2; }

/* Month calendar (plan 2.6, B2) */
.month { margin-top: 10px; padding: 12px 10px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-card); }
.month__head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px; }
.month__title { font-size: 18px; font-weight: 700; }
.month__nav { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 22px; color: var(--ink); }
.month__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.month__weekday { padding-bottom: 4px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.month__day { height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 12px; color: var(--ink); font-size: 16px; font-weight: 500; text-decoration: none; }
.month__day--today { background: var(--active); font-weight: 700; }
.month__day--selected { background: var(--dark); color: var(--cream); font-weight: 700; }
.month__dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.month__dot--planned { background: var(--status-planned); }
.month__dot--done { background: var(--status-done); }
.month__dot--paid { background: var(--status-paid); }
.month__day--selected [class*='month__dot--'] { background: var(--cream); }
.month__legend { display: flex; justify-content: center; gap: 14px; padding-top: 10px; color: var(--ink-soft); font-size: 12px; }
.month__legend > span { display: flex; align-items: center; gap: 5px; }
.month__legend .month__dot { width: 8px; height: 8px; }
.service-card--day { min-height: 0; }
.service-card--day .service-card__name { font-size: 18px; font-weight: 700; }
.day-new { display: flex; align-items: center; justify-content: center; min-height: 48px; margin: 10px 0 24px; border: 1.5px dashed var(--field-line); border-radius: 16px; color: var(--dark); font-size: 16px; font-weight: 600; text-decoration: none; }

/* Earnings (plan 2.6, B4) */
.earnings-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.earnings-head .segmented { margin: 0; grid-auto-columns: auto; }
.earnings-head .segmented__item { min-height: 36px; padding: 0 12px; border-radius: 10px; }
.earnings-total { padding: 16px; margin-bottom: 16px; background: var(--dark); color: var(--cream); border-radius: 22px; }
.earnings-total__label { font-size: 14px; opacity: 0.85; }
.earnings-total__amount { margin: 2px 0 12px; font-size: 36px; font-weight: 700; letter-spacing: -0.02em; }
.earnings-total__split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.earnings-total__split > span { display: grid; font-size: 13px; }
.earnings-total__split > span > span { opacity: 0.85; }
.earnings-total__split strong { font-size: 16px; }
.earnings-total__expenses { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(248, 235, 211, 0.25); font-size: 14px; }
.month-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.month-card { display: grid; gap: 8px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.month-card__head { display: flex; align-items: baseline; justify-content: space-between; font-size: 18px; font-weight: 700; }
.month-card__line { color: var(--ink-soft); font-size: 14px; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--tint); }
.bar__part { flex: none; }
.bar__part--paid { background: var(--status-paid); }
.bar__part--done { background: var(--status-done); }
.bar__part--planned { background: var(--status-planned); }
.month-list + .month__legend { margin-bottom: calc(var(--bar-height) + 32px); }

/* Compare (plan 2.6, B5) */
.compare-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.compare-pick select { width: 100%; min-height: 50px; padding: 0 12px; border: 1.5px solid var(--field-line); border-radius: 14px; background: var(--paper); font-size: 17px; font-weight: 600; }
.compare-pick .field--strong select { border-color: var(--dark); }
.compare-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.compare-tile { display: grid; gap: 2px; padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.compare-tile--second { background: var(--dark); border-color: var(--dark); color: var(--cream); }
.compare-tile__label { font-size: 14px; color: var(--ink-soft); }
.compare-tile--second .compare-tile__label { color: var(--cream); opacity: 0.85; }
.compare-tile__amount { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.compare-line { margin-bottom: 14px; padding: 12px 14px; background: var(--tint); border-radius: 16px; font-size: 16px; font-weight: 600; }
.compare-rows { display: grid; gap: 12px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.compare-row { display: grid; gap: 6px; }
.compare-row__head { display: flex; justify-content: space-between; font-size: 15px; }
.compare-row__head > span:first-child { font-weight: 600; }
.compare-row__head > span:last-child { color: var(--ink-soft); }
.compare-row__bars { display: grid; gap: 3px; }
.compare-bar { display: block; height: 8px; border-radius: 4px; }
.compare-bar--first { background: var(--field-line); }
.compare-bar--second { background: var(--dark); }
.compare-rows + .hint { margin: 10px 4px 24px; }

/* Linda's photo on her profile (plan 2.6, B9) */
.me { display: flex; align-items: center; gap: 16px; padding: 18px; background: var(--active); border-radius: 24px; }
.me__photo { position: relative; flex: none; width: 112px; height: 112px; }
.me__img { display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%; border: 3px solid var(--paper); object-fit: cover; }
.me__img--empty { background: var(--paper); color: var(--ink-soft); }
.me__badge { position: absolute; right: -4px; bottom: -4px; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 3px solid var(--active); border-radius: 50%; background: var(--dark); color: var(--cream); cursor: pointer; }
.me__badge .icon { stroke-width: 2; }
.me__text { flex: 1; min-width: 0; display: grid; gap: 4px; }
.me__name { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; overflow-wrap: anywhere; }
.me__hint { font-size: 15px; color: #3f4a4c; line-height: 1.35; }

/* Place not found (plan 2.6, B6) */
.not-found { display: grid; gap: 12px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.not-found__head { display: flex; gap: 10px; align-items: flex-start; }
.not-found__head .icon { flex: none; margin-top: 1px; color: var(--status-done); stroke-width: 2; }
.not-found__head div { display: grid; gap: 2px; }
.not-found__head strong { font-size: 17px; }
.not-found__head span { color: var(--ink-soft); font-size: 15px; }
.not-found .button { display: flex; align-items: center; justify-content: center; gap: 8px; }
.not-found .button .icon { stroke-width: 2; }
.not-found__skip { min-height: 44px; color: var(--ink-soft); font-size: 15px; font-weight: 600; text-decoration: underline; }

/* Drop a pin (plan 2.6, B7) */
.pin-picker { position: fixed; inset: 0; z-index: 5; background: var(--tint); }
/* maplibre makes its container position: relative, so the size comes from width and height. */
.pin-picker__map { width: 100%; height: 100%; }
.pin-picker__top { position: absolute; left: 16px; right: 16px; top: max(16px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; }
.pin-picker__round { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 24px; background: var(--paper); color: var(--ink); box-shadow: 0 4px 12px rgba(31, 42, 46, 0.15); }
.pin-picker__tip { flex: 1; padding: 12px 16px; border-radius: 24px; background: var(--paper); box-shadow: 0 4px 12px rgba(31, 42, 46, 0.15); font-size: 15px; font-weight: 600; }
.pin-picker__pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.pin-picker__pin path { fill: #b07fa8; stroke: var(--paper); stroke-width: 1.5; }
.pin-picker__pin circle { fill: var(--paper); }
.pin-picker__pin span { width: 10px; height: 4px; border-radius: 50%; background: rgba(31, 42, 46, 0.35); }
.pin-picker__locate { position: absolute; right: 16px; bottom: 170px; color: var(--dark); }
.pin-picker__locate .icon { stroke-width: 2; }
.pin-picker__card { position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 12px; padding: 18px 16px max(30px, env(safe-area-inset-bottom)); background: var(--ivory); border-radius: 28px 28px 0 0; box-shadow: 0 -8px 24px rgba(31, 42, 46, 0.12); }
.pin-picker .maplibregl-ctrl-bottom-right { bottom: 150px; }
.pin-picker__name { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }

/* Service list */
.service-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.status-dot { flex: none; width: 16px; height: 16px; border-radius: 50%; }
.status-dot--planned { background: var(--status-planned); }
.status-dot--done { background: var(--status-done); }
.status-dot--paid { background: var(--status-paid); }
.service-card { display: flex; align-items: center; gap: 12px; min-height: 84px; padding: 12px 12px 12px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-card); color: inherit; text-decoration: none; }
.service-card__body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.service-card__name { font-family: var(--font-title); font-size: 23px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.service-card__meta { color: var(--ink-soft); font-size: 15px; overflow-wrap: anywhere; }
.amounts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.amounts__cell { display: grid; gap: 1px; min-width: 0; }
.amounts__label { color: var(--ink-soft); font-size: 13px; }
.amounts__value { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.page-meta + .amounts { margin: 12px 0 4px; }
.family-notes { margin: 12px 0 4px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.family-notes summary { font-weight: 700; cursor: pointer; min-height: 28px; }
.family-notes p { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.service-card .icon { color: var(--ink-soft); }
.empty { margin-top: 24px; color: var(--ink-soft); }
.section-title { font-family: var(--font-title); font-size: 22px; font-weight: 600; line-height: 1.2; margin: 20px 0 10px; }
.section-title--first { margin-top: 16px; }
.archive { margin-top: 12px; }
.archive summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 0; font-family: var(--font-title); font-size: 20px; font-weight: 600; cursor: pointer; list-style: none; }
.archive summary::-webkit-details-marker { display: none; }
.archive summary .icon { color: var(--ink-soft); }
.archive[open] summary .icon { transform: rotate(180deg); }

/* The route is the heart of the app: a line drawn through the day. */
.route { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.route__stop { position: relative; display: flex; gap: 10px; }
.route__stop:not(:last-child)::before { content: ''; position: absolute; left: 22px; top: 24px; bottom: -34px; width: 2.5px; background: var(--dark); }
.route__node { position: relative; flex: none; width: 46px; height: 46px; margin-top: 8px; display: grid; place-items: center; border: 2px solid var(--dark); border-radius: 50%; background: var(--paper); color: var(--dark); }
.route__button { flex: 1; min-width: 0; display: block; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); text-align: left; cursor: pointer; }
.route__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.route__time { font-size: 20px; line-height: 1.3; font-weight: 700; color: var(--dark); }
.route__transport { font-size: 15px; font-weight: 600; color: var(--ink-soft); overflow-wrap: anywhere; text-align: right; }
.route__place { font-size: 18px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.route__place--empty { color: var(--ink-soft); font-weight: 500; }
.route__detail { margin-top: 2px; color: var(--ink-soft); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; display: block; background: var(--tint); }

/* Expenses */
.expense-total { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 12px; padding: 14px 18px; border-radius: 20px; background: var(--dark); color: var(--cream); font-weight: 600; }
.expense-total strong { font-size: 28px; font-weight: 700; }
.expense-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.expense-row { display: flex; align-items: stretch; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); }
.expense-row__handle { flex: none; width: 44px; display: grid; place-items: center; color: var(--ink-soft); cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.expense-row--ghost { opacity: 0.4; }
.expense { flex: 1; min-width: 0; display: grid; grid-template-columns: 42px 1fr auto; gap: 0 10px; align-items: center; width: 100%; padding: 9px 14px 9px 12px; border: 0; background: none; text-align: left; cursor: pointer; }
.expense-row__handle + .expense { padding-left: 0; }
.expense__node { grid-row: 1 / span 2; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--ivory); color: var(--dark); }
.expense__name { font-weight: 700; overflow-wrap: anywhere; }
.expense__amount { font-weight: 700; }
.expense__meta { grid-column: 2 / -1; color: var(--ink-soft); font-size: 14px; overflow-wrap: anywhere; }
.expense .thumbs { grid-column: 2 / -1; margin-top: 6px; }
.expense .thumbs img { width: 56px; height: 56px; }
.expense--report { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; cursor: default; }
.expense--report .expense__meta { grid-column: 1 / -1; font-size: 15px; }
.expense__photo { grid-column: 1 / -1; width: 100%; height: auto; margin-top: 10px; border-radius: 12px; background: var(--tint); }

/* Send */
.send-actions { display: grid; gap: 10px; margin-top: 14px; }
.send-actions--paid { margin-top: 16px; }
.check-list { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.preview summary, .links__item { min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; color: var(--ink); font-size: 17px; font-weight: 600; text-decoration: none; cursor: pointer; list-style: none; }
.preview summary::-webkit-details-marker { display: none; }
.preview summary .icon, .links__item .icon { color: var(--ink-soft); }
.preview[open] summary .icon { transform: rotate(90deg); }
.preview pre { font: inherit; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 12px 16px; background: var(--ivory); }
.links__item { border-top: 1px solid var(--line); }

/* Grouped fields */
.panel { display: grid; gap: 10px; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; }
.panel .field input { background: var(--ivory); }
.panel__title { font-family: var(--font-title); font-size: 24px; font-weight: 600; }
.panel-row { display: flex; align-items: center; gap: 14px; font-weight: 600; }

/* Bottom sheet */
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 94dvh;
  margin: auto auto 0;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--ivory);
  color: var(--ink);
  overflow-y: auto;
}
.sheet::backdrop { background: rgba(31, 42, 46, 0.55); }
.sheet__title:focus { outline: none; }
.sheet__head {
  position: sticky;
  top: -8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -8px -16px 6px;
  padding: 8px 16px;
  background: var(--ivory);
}
.sheet__title { font-family: var(--font-title); font-size: 28px; font-weight: 600; }
.sheet__cancel { color: var(--dark); font-weight: 700; }
.sheet .form { gap: 10px; }
.sheet .field input { min-height: 48px; padding-top: 8px; padding-bottom: 8px; }
.sheet .stepper .button { min-height: 48px; }
.sheet .photo-add, .sheet .photo-item img { width: 72px; height: 72px; }
.amount-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }
.amount-row .amount-line { display: grid; justify-items: end; line-height: 1.15; }
.sheet .field textarea { min-height: 72px; }
.sheet__actions { display: grid; gap: 2px; margin-top: 4px; }
.time-place { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-item { position: relative; }
.photo-item img { width: 88px; height: 88px; object-fit: cover; border-radius: 14px; display: block; background: var(--tint); }
.photo-item button { position: absolute; top: -8px; right: -8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-weight: 700; cursor: pointer; }
.photo-add { width: 88px; height: 88px; padding: 4px; border: 1.5px dashed var(--dark); border-radius: 14px; display: grid; place-items: center; text-align: center; color: var(--dark); font-weight: 700; font-size: 14px; line-height: 1.15; cursor: pointer; }
.photo-add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.amount-line { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.amount-line strong { font-size: 26px; font-weight: 700; color: var(--dark); }

/* Place suggestions */
.suggestions { border: 1.5px solid var(--field-line); border-radius: 14px; overflow: hidden; background: var(--paper); }
.suggestion { display: block; width: 100%; min-height: 50px; padding: 8px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--paper); text-align: left; cursor: pointer; }
.suggestion__name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.suggestions__missing { color: var(--dark); font-weight: 600; }
.suggestion__detail { display: block; color: var(--ink-soft); font-size: 14px; overflow-wrap: anywhere; }
.suggestions__credit { padding: 4px 14px; font-size: 12px; color: var(--ink-soft); }

.links { display: block; }
.hint { color: var(--ink-soft); font-size: 15px; margin-top: 6px; }
.hint--alert { color: var(--alert); font-weight: 600; }
.app-version { text-align: center; font-size: 13px; }

/* Client keepsake: Linda's choice of photos */
.keepsake-pick { margin-top: 18px; }
.keepsake-pick__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.keepsake-pick__title { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.keepsake-pick__title span { color: var(--dark); }
.keepsake-pick__all { flex: none; min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--dark); font-size: 15px; font-weight: 700; cursor: pointer; }
.keepsake-pick__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keepsake-pick__photo { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 14px; background: var(--tint); overflow: hidden; cursor: pointer; }
.keepsake-pick__photo img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.keepsake-pick__photo[aria-pressed='true'] img { opacity: 1; }
.keepsake-pick__photo[aria-pressed='true'] { outline: 4px solid var(--dark); outline-offset: -4px; }
.keepsake-pick__photo[aria-pressed='true']::after { content: '✓'; position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--dark); color: var(--cream); font-size: 16px; font-weight: 700; }
.keepsake-note { margin-top: 20px; }
.check-list > .links__item:first-child { border-top: 0; }
.floating-bar__action--light { background: var(--paper); color: var(--dark); border: 1.5px solid var(--dark); }

.keepsake-availability { display: grid; gap: 8px; margin-top: 14px; }
.keepsake__until { margin-top: 20px; padding: 12px 14px; background: var(--cream); border-radius: 14px; font-size: 15px; font-weight: 600; }
.keepsake__export { display: grid; gap: 10px; margin-top: 12px; }

/* Client keepsake: the page clients receive, also shown as Linda's preview */
.keepsake { max-width: 560px; margin: 0 auto; padding-bottom: 32px; }
.keepsake--preview { margin-top: calc(-1 * (env(safe-area-inset-top) + 14px)); margin-left: -16px; margin-right: -16px; }
.keepsake__hero { display: block; width: 100%; height: 320px; object-fit: cover; object-position: center 42%; background: var(--tint); }
.keepsake__head { position: relative; margin: -36px 16px 0; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-bar); }
.keepsake__title { font-family: var(--font-title); font-size: 36px; font-weight: 600; line-height: 1.08; }
.keepsake__family { margin-top: 8px; font-weight: 600; overflow-wrap: anywhere; }
.keepsake__with { margin-top: 2px; font-size: 16px; color: var(--ink-soft); }
.keepsake__body { padding: 8px 16px 0; }
.keepsake__section { margin: 26px 0 12px; font-family: var(--font-title); font-size: 26px; font-weight: 600; }
.keepsake__places { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.keepsake__place { position: relative; display: flex; gap: 10px; }
.keepsake__place:not(:last-child)::before { content: ''; position: absolute; left: 22px; top: 22px; bottom: -32px; width: 2.5px; background: var(--dark); }
.keepsake__number { position: relative; flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--dark); color: var(--cream); font-size: 18px; font-weight: 700; }
.keepsake__card { flex: 1; min-width: 0; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; }
.keepsake__name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.keepsake__time { font-size: 15px; color: var(--ink-soft); }
.keepsake__photo { display: block; width: 100%; height: auto; margin-top: 8px; border-radius: 12px; background: var(--tint); }
.keepsake__action { display: inline-flex; align-items: center; min-height: 44px; margin-right: 14px; color: var(--dark); font-size: 15px; font-weight: 700; text-decoration: none; }
.keepsake__word { margin-top: 22px; padding: 18px; background: var(--active); border-radius: 22px; display: flex; gap: 14px; align-items: flex-start; }
.keepsake__author { flex: none; width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--paper); object-fit: cover; }
.keepsake__word-title { margin-bottom: 6px; font-family: var(--font-title); font-size: 22px; font-weight: 600; }
.keepsake__word-text { line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.keepsake__foot { display: flex; align-items: center; gap: 10px; margin-top: 20px; font-size: 15px; color: var(--ink-soft); }
.keepsake__logo { width: 36px; height: 36px; border-radius: 9px; }
.keepsake-back { position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: 12px; z-index: 10; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 16px 0 8px; border-radius: 22px; background: var(--paper); box-shadow: var(--shadow-bar); color: var(--ink); font-weight: 600; text-decoration: none; }

/* Route map */
/* Inside the installed app, the map credits must not open a page with no way back. */
#view .maplibregl-ctrl a { pointer-events: none; }
.route-map { height: 56vh; min-height: 320px; margin-top: 14px; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--tint); }
.map-marker { display: flex; align-items: center; gap: 4px; pointer-events: none; }
.map-marker__number { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--dark); color: var(--cream); font-size: 14px; font-weight: 700; }
.map-marker__label { max-width: 130px; padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.94); color: var(--ink); font-size: 12px; font-weight: 600; line-height: 1.25; }
.map-list { list-style: none; margin: 12px 0 0; padding: 0; }
.map-list li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--line); font-weight: 600; overflow-wrap: anywhere; }
.map-list__number { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--dark); color: var(--cream); font-size: 14px; font-weight: 700; }
.map-list__time { flex: none; font-weight: 700; color: var(--dark); }

/* Public pages and photo previews */
.share { background: var(--ivory); }
.share-head { display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top) + 14px) 16px 14px; background: var(--paper); border-bottom: 1px solid var(--line); }
.share-head__logo { flex: none; width: 48px; height: 48px; border-radius: 12px; }
.share-head__app { font-family: var(--font-title); font-size: 23px; font-weight: 600; line-height: 1.1; }
.share-head__author { font-size: 15px; color: var(--ink-soft); }
.share-main { max-width: 720px; margin: 0 auto; padding: 20px 16px 32px; }
.share-main h1 { font-family: var(--font-title); font-size: 36px; font-weight: 600; line-height: 1.05; overflow-wrap: anywhere; }
.share-stop { margin-top: 20px; }
.share-stop h2 { font-size: 19px; font-weight: 700; margin-bottom: 8px; overflow-wrap: anywhere; }
.share-stop h2 span { color: var(--dark); }
.share-stop img { display: block; width: 100%; height: auto; margin-bottom: 10px; border-radius: 20px; background: var(--tint); }
.share-foot { margin-top: 24px; color: var(--ink-soft); font-size: 15px; }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--bar-height) + var(--bar-bottom) + 12px);
  max-width: 528px;
  margin: 0 auto;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  font-weight: 600;
  z-index: 20;
}
.toast--error { background: var(--alert); }

/* Opening animation: the two strands of the knot arrive one after the other, then the app appears. */
.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  background: var(--mauve);
  color: var(--ink);
  animation: splash-out 300ms ease-in 2000ms forwards;
}
.splash__logo { width: 300px; height: 300px; }
.splash__strand { transform-box: view-box; transform-origin: center; animation: splash-strand 520ms ease-out both; }
.splash__strand--dark { fill: var(--dark); animation-delay: 100ms; }
.splash__strand--cream { fill: var(--cream); animation-delay: 480ms; }
.splash__name { margin-top: -14px; font-family: var(--font-title); font-size: 42px; font-weight: 600; animation: splash-name 350ms ease-out 1050ms both; }
@keyframes splash-strand { from { opacity: 0; transform: scale(0.82); } to { opacity: 1; transform: none; } }
@keyframes splash-name { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Ending hidden in CSS means a script failure can never leave the splash blocking the app. */
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .splash { display: none; } }

@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: sheet-rise 180ms ease-out; }
  @keyframes sheet-rise { from { transform: translateY(24px); opacity: 0.6; } }
}

[hidden] { display: none !important; }
