* { box-sizing: border-box; }

/* Display font (self-hosted for offline/PWA, SIL OFL — see /fonts/OFL.txt) */
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin-wght.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* No blue tap flash / accidental text selection on anything tappable */
html { -webkit-tap-highlight-color: transparent; }
a, button, label, summary, [role="button"], [role="tab"], [data-action],
.chip, .module-card, .segmented-btn {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Fields must stay editable even inside a non-selectable parent (iOS bug) */
input, textarea, select, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

:root {
  /* Light here, dark under [data-theme="dark"] (end of file). Declaring both themes also keeps
     Chrome's automatic darkening away (it would invert our colours). */
  color-scheme: light;

  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  --font-display: "Space Grotesk", var(--font-body);

  /* Layout: width of the content column (header aligns on it) */
  --page-width: 640px;
  /* Same header height on every page (title + subtitle line), so the bar never jumps */
  --header-h: 80px;

  /* « Doux irisé » : soft cards on an iridescent background tinted by the module of the page.
     Each module has its colour (--c-*). body.<page> sets --mod (and --mod2/--mod3 for the
     iridescent background), everything else derives from it (see the body rule below). */
  --c-brand: #E8603C;   /* app + weekend hub + home: sunset */
  /* Each module = ONE hue family in three stops: -deep (start of the gradient, dark text),
     base (buttons, accents), -glow (end of the gradient, iridescent background).
     The stops never drift towards another module's hue. Same values in icons/module-*.svg. */
  --c-trip-deep: #1D5FB0;  --c-trip: #2F80D8;  --c-trip-glow: #3DB2EC;    /* Trajets: sky blue */
  --c-shop-deep: #177F52;  --c-shop: #22A06B;  --c-shop-glow: #7DBB3C;    /* Courses: green to lime */
  --c-pay-deep: #A8235A;   --c-pay: #D63A72;   --c-pay-glow: #EC6A9C;     /* Dépenses: raspberry to rose */
  --c-lodge-deep: #5B3FD0; --c-lodge: #7C5CE6; --c-lodge-glow: #A98AF5;   /* Logement: violet */
  --c-danger: #C62828;

  --card: rgba(255, 255, 255, 0.82);
  --surface: #FFFFFF;   /* opaque: dialogs, menus, fields */
  --text: #1E2230;
  --muted: #646A7B;

  /* Soft tints (backgrounds of badges, icons, highlighted rows): text stays dark on them */
  --green: #D3F1E1;
  --green-strong: #1B8A5A;
  --pink: #FBDCE7;
  --purple: #E6E0FB;
  --mint: color-mix(in srgb, var(--c-shop) 16%, #FFFFFF);   /* = Courses */
  --teal: color-mix(in srgb, var(--c-trip) 16%, #FFFFFF);   /* = Trajets */

  /* Borders & shadows */
  --line: rgba(30, 34, 48, 0.10);
  --border: rgba(30, 34, 48, 0.22);
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(22, 26, 44, 0.05), 0 8px 24px rgba(22, 26, 44, 0.07);
  --shadow-sm: 0 1px 2px rgba(22, 26, 44, 0.06);
  --shadow-lg: 0 12px 32px rgba(22, 26, 44, 0.14);

  /* States */
  --taken-bg: rgba(255, 255, 255, 0.45);
  --conflict-bg: #FFF1E0;
  --warn: #F59E0B;
}

/* Per page: module colour + the two extra colours of its iridescent background */
body { --mod: var(--c-brand); --mod-deep: #D9482A; --mod-glow: #F2709C; --mod2: #FF8FB8; --mod3: #9AA6FF; --on-mod: #FFFFFF; }
body.shop-hub, body.shop-list { --mod: var(--c-shop); --mod-deep: var(--c-shop-deep); --mod-glow: var(--c-shop-glow); }
body.paiements { --mod: var(--c-pay); --mod-deep: var(--c-pay-deep); --mod-glow: var(--c-pay-glow); }
body.paiements.trajets { --mod: var(--c-trip); --mod-deep: var(--c-trip-deep); --mod-glow: var(--c-trip-glow); }
/* Module pages: the iridescent background reuses the stops of the module's icon, nothing else */
body:is(.shop-hub, .shop-list, .paiements) {
  --mod2: color-mix(in srgb, var(--mod-glow) 55%, #FFFFFF);
  --mod3: color-mix(in srgb, var(--mod) 30%, #FFFFFF);
}
body {
  /* The module's gradient: hub tile, header icon, add button, summary card */
  --mod-grad: linear-gradient(150deg, var(--mod-deep) 0%, var(--mod) 55%, var(--mod-glow) 100%);
  --tint: color-mix(in srgb, var(--mod) 10%, #FBFBFD);
  --accent: var(--mod);
  --accent-ink: var(--on-mod);
  --accent-soft: color-mix(in srgb, var(--mod) 16%, #FFFFFF);
  --accent-soft-2: color-mix(in srgb, var(--mod) 26%, #FFFFFF);
  --accent-text: color-mix(in srgb, var(--mod-deep) 88%, #000000);
}

input[type=checkbox], input[type=radio] {
  accent-color: var(--accent);
}

html, body {
  margin: 0;
  padding: 0;
  background: #F7F6FA;
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  min-height: 100vh;
  font-weight: 400;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
  background: var(--tint);
}

/* Iridescent background, built from the colour of the page (different on every module) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(at 0% 0%, color-mix(in srgb, var(--mod) 34%, transparent) 0, transparent 55%),
    radial-gradient(at 100% 35%, color-mix(in srgb, var(--mod2) 60%, transparent) 0, transparent 50%),
    radial-gradient(at 40% 100%, color-mix(in srgb, var(--mod3) 60%, transparent) 0, transparent 60%),
    var(--tint);
  pointer-events: none;
  z-index: 0;
}

/* Weekend page: the same background, a bit stronger (gives the hub its character; the cards
   stay white like everywhere else, glass was tried and dropped: invisible on a smooth gradient) */
body.weekend-hub { --tint: color-mix(in srgb, var(--mod) 16%, #FBFBFD); }

body.weekend-hub::before {
  background:
    radial-gradient(at 0% 0%, color-mix(in srgb, var(--mod) 48%, transparent) 0, transparent 55%),
    radial-gradient(at 100% 35%, color-mix(in srgb, var(--mod2) 78%, transparent) 0, transparent 50%),
    radial-gradient(at 40% 100%, color-mix(in srgb, var(--mod3) 78%, transparent) 0, transparent 60%),
    var(--tint);
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px max(16px, calc((100% - var(--page-width)) / 2 + 16px));
  background: color-mix(in srgb, var(--tint) 62%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  min-height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1, h2, h3, button, .dialog-title, .module-badge, .module-status {
  font-family: var(--font-display);
}

header h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}

.back {
  color: var(--text);
  text-decoration: none;
  font-size: 1.8rem;
  line-height: 1;
  padding: 4px;
  font-weight: 700;
  transition: transform 0.15s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.back:active { transform: scale(0.9); }

main {
  padding: 20px 16px;
  max-width: var(--page-width);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 700;
}

/* --- Home page --- */
.home-main {
  padding-bottom: 32px;
}

.home-intro {
  margin: 4px 0 24px;
}

.home-logo {
  color: var(--accent);
  overflow: visible;
  transform-origin: 48.6% 53.3%; /* same centroid, for the tap turn */
}

/* The logo spins now and then: one turn (with a small overshoot) as soon as
   the home page opens, then every 14 s. Centre of rotation = centroid of the
   pinwheel (242, 289 in the viewBox), so it turns on itself without wobbling.
   A tap adds an extra turn on the <svg> (home.js). Reduced motion: still. */
.home-logo path {
  transform-origin: 242px 289px;
  animation: logo-spin 14s cubic-bezier(0.45, 0, 0.2, 1) 0.2s infinite;
}

@keyframes logo-spin {
  0% { transform: rotate(0deg); }
  7% { transform: rotate(380deg); }
  10% { transform: rotate(360deg); }
  100% { transform: rotate(360deg); }
}

/* Theme of this device (Auto / Clair / Sombre), top right of the home page */
.theme-toggle,
.theme-toggle:hover {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: none;
  transform: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.theme-toggle:active {
  background: var(--accent-soft);
}

.home-tagline {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.home-sub {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
}

.home-empty {
  margin: 0;
  padding: 20px;
  border: 2px dashed var(--muted);
  border-radius: 14px;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
}

.lists-ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.lists-ul[hidden] {
  display: none;
}

.weekend-item {
  position: relative;
}

.weekend-link {
  display: flex;
  align-items: center;
  gap: 12px;
  /* right: room for the ⋯ button */
  padding: 14px 56px 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.weekend-link:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.weekend-link:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.weekend-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.weekend-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.weekend-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.weekend-when {
  flex-shrink: 0;
  padding: 3px 10px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Next weekend: the big sunset card, the countdown in large on the right */
.weekend-item.is-featured .weekend-link {
  align-items: flex-start;
  padding: 18px 56px 18px 20px;
  background: linear-gradient(135deg, #E8603C 0%, #F2709C 62%, #B78BFF 100%);
  border: 0;
  border-radius: 24px;
  color: #FFFFFF;
  box-shadow: 0 12px 26px rgba(232, 96, 60, 0.3);
}

.weekend-item.is-featured .weekend-link:hover {
  box-shadow: var(--shadow-lg);
}

.weekend-kicker {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.weekend-item.is-featured .weekend-name {
  font-size: 1.45rem;
  font-weight: 700;
}

.weekend-item.is-featured .weekend-meta {
  color: rgba(255, 255, 255, 0.9);
}

.weekend-item.is-featured .weekend-when {
  padding: 0;
  background: none;
  color: #FFFFFF;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.weekend-item.is-featured .weekend-menu-btn {
  top: 14px;
  transform: none;
  color: #FFFFFF;
}

.weekend-item.is-featured .weekend-menu-btn:hover,
.weekend-item.is-featured .weekend-menu-btn:active {
  transform: none;
  background: rgba(255, 255, 255, 0.18);
}

/* One coloured initial per participant */
.weekend-avatars {
  display: flex;
  padding-top: 8px;
}

.weekend-avatars[hidden] {
  display: none;
}

.avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: -6px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: #FFFFFF;
}

.avatar:first-child {
  margin-left: 0;
}

.avatar-more {
  width: auto;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}

/* Other weekends: smaller initials on the white card */
.weekend-item:not(.is-featured) .weekend-avatars {
  padding-top: 6px;
}

.weekend-item:not(.is-featured) .avatar {
  width: 22px;
  height: 22px;
  margin-left: -5px;
  border-color: var(--surface);
  font-size: 0.62rem;
}

.weekend-item:not(.is-featured) .avatar:first-child {
  margin-left: 0;
}

.weekend-item:not(.is-featured) .avatar-more {
  width: auto;
  background: color-mix(in srgb, var(--text) 10%, var(--surface));
  color: var(--muted);
}

.weekend-item.is-past:not(.is-due) .weekend-avatars {
  opacity: 0.7;
}

/* Countdown of a close weekend: the sunset gradient, like the big card */
.weekend-when[data-tone="near"] {
  background: linear-gradient(150deg, #E8603C 0%, #F2709C 70%, #B78BFF 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(232, 96, 60, 0.28);
}

/* Accounts of a past weekend: what I owe / am owed, or settled */
.money-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.money-badge[data-tone="owe"] { background: var(--c-pay); color: #FFFFFF; }
.money-badge[data-tone="owed"] { background: var(--green-strong); color: #FFFFFF; }
.money-badge[data-tone="ok"] { background: var(--green); color: #17774D; }

.weekend-accounts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding-top: 6px;
}

.weekend-cta {
  font-size: 0.8rem;
  font-weight: 700;
  color: #B02A5E;
}

.money-badge[data-tone="owed"] + .weekend-cta {
  color: #17774D;
}

.weekend-item.is-due .weekend-link {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

/* Past weekend, accounts settled: greyed */
.weekend-item.is-past:not(.is-due) .weekend-link {
  background: var(--taken-bg);
  box-shadow: none;
}

.weekend-item.is-past:not(.is-due) .weekend-name {
  color: var(--muted);
}

.weekend-item.is-past:not(.is-due) .money-badge {
  opacity: 0.8;
}

/* Example weekend */
.weekend-item.is-demo .weekend-link {
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: none;
}

.demo-badge,
.soon-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.soon-badge {
  background: var(--purple);
  color: #6A4BD8;
}

.weekend-group {
  margin-top: 28px;
}

.weekend-group[hidden] {
  display: none;
}

.weekend-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.weekend-group-head h3 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ⋯ options of a weekend (also opened by a long press) */
.weekend-menu-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  color: var(--text);
  z-index: 5;
}

.weekend-menu-btn:hover,
.weekend-menu-btn:active {
  transform: translateY(-50%);
  background: rgba(10, 10, 10, 0.08);
  box-shadow: none;
}

/* ⋯ menu of a card, as a bottom sheet (#menu-sheet, js/shared/menu.js):
   title = what it acts on, then one row per action, pictogram first */
.menu-sheet-head {
  min-width: 0;
}

.menu-sheet-head .dialog-title {
  margin: 0;
  overflow-wrap: anywhere;
}

.menu-sheet-sub {
  margin: 2px 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.menu-sheet-items {
  display: grid;
  gap: 2px;
  padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 12px;
  box-shadow: none;
  color: var(--text);
  font-size: 1rem;
  text-align: left;
}

.menu-item svg {
  flex-shrink: 0;
  color: var(--muted);
}

.menu-item:hover,
.menu-item:active {
  background: var(--taken-bg);
  color: var(--text);
  transform: none;
  box-shadow: none;
}

.menu-item.is-danger,
.menu-item.is-danger:hover,
.menu-item.is-danger:active,
.menu-item.is-danger svg {
  color: var(--c-danger);
}

/* Under the question of a confirmation: what it is about (the weekend's date) */
.confirm-subtitle {
  display: block;
  margin-top: 4px;
  font-family: var(--font-body);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.home-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 14px 0 0;
}

/* "Nouveau weekend": in the page under the list, and held at the bottom of the screen
   while a long list scrolls (sticky, see home.html). Same look as the modules' .pay-fab */
.home-new-btn {
  position: sticky;
  z-index: 20;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  margin: 28px auto 0;
  background: var(--mod-grad);
  box-shadow: var(--shadow);
}

.past-more-btn {
  display: block;
  margin: 10px auto 0;
}

.past-more-btn[hidden] {
  display: none;
}

.home-join-btn {
  font-size: 0.95rem;
}

.dialog-description.is-warning {
  color: #B91C1C;
}

#create-sheet .field,
#join-sheet .field {
  display: block;
}

input[type=text], input[type=search], input[type=date], input[type=time], textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  width: 100%;
  font-weight: 500;
  transition: all 0.2s;
}

input[type=text]:focus, input[type=search]:focus, input[type=date]:focus, input[type=time]:focus, textarea:focus {
  outline: none;
  background: white;
  box-shadow: var(--shadow-sm);
  transform: none;
  color: var(--text);
}

.date-input-wrapper {
  display: block;
  position: relative;
  width: 100%;
}

/* Empty date: only the custom placeholder (the native "jj/mm/aaaa" is hidden) */
.date-input-wrapper.is-empty input[type=date]::-webkit-datetime-edit-text,
.date-input-wrapper.is-empty input[type=date]::-webkit-datetime-edit-month-field,
.date-input-wrapper.is-empty input[type=date]::-webkit-datetime-edit-day-field,
.date-input-wrapper.is-empty input[type=date]::-webkit-datetime-edit-year-field {
  color: transparent;
}

.date-input-wrapper:not(.is-empty) .date-placeholder {
  opacity: 0;
}

.date-input-wrapper .date-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  z-index: 1;
}

.date-input-wrapper .date-placeholder {
  position: absolute;
  left: 44px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 500;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.2s;
}

/* .field: more specific than the compact phone padding of the sheets
   (dialog.sheet input[type=date]), otherwise the date runs over the icon */
.field .date-input-wrapper input[type=date] {
  padding-left: 44px;
}

/* Firefox ignores the ::-webkit-datetime-edit rules: its own "jj/mm/aaaa"
   and calendar button stay visible, so drop our placeholder and icon there */
@supports (-moz-appearance: none) {
  .date-input-wrapper .date-placeholder,
  .date-input-wrapper .date-icon {
    display: none;
  }
  .field .date-input-wrapper input[type=date] {
    padding-left: 14px;
  }
}

/* Hide native date format when empty */
input[type=date]::-webkit-datetime-edit-text,
input[type=date]::-webkit-datetime-edit-month-field,
input[type=date]::-webkit-datetime-edit-day-field,
input[type=date]::-webkit-datetime-edit-year-field {
  color: transparent;
}

/* Show date in black when valid */
input[type=date]:valid::-webkit-datetime-edit-text,
input[type=date]:valid::-webkit-datetime-edit-month-field,
input[type=date]:valid::-webkit-datetime-edit-day-field,
input[type=date]:valid::-webkit-datetime-edit-year-field {
  color: var(--text);
}

/* The invisible calendar button covers the whole field: the field must hold it,
   otherwise it spreads over its sheet and catches the taps on « Ajouter » */
input[type=date] {
  position: relative;
}

input[type=date]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

/* Single-line field written as a textarea (js/shared/one-line.js explains why):
   looks and scrolls like an <input type="text"> */
textarea.one-line {
  display: block;
  resize: none;
  min-height: 0;
  overflow: hidden;
  white-space: pre;
  overflow-wrap: normal;
}

textarea.one-line[hidden] {
  display: none;
}

button {
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
  transition: transform 0.15s, box-shadow 0.15s, background-color 0.15s;
  letter-spacing: 0;
  font-size: 0.98rem;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button:hover {
  transform: none;
}

button:active {
  transform: scale(0.98);
  box-shadow: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* --- Shared: empty placeholder, dialogs, buttons --- */
.empty {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  margin-top: 40px;
  font-weight: 500;
  font-size: 1.1rem;
}



dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
}

dialog::backdrop {
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  color: var(--text);
}

/* Shared confirmation (shared/dialog.js): a question, one sentence, the action, "Annuler" */
#confirm-dialog {
  width: min(400px, 90vw);
}

#confirm-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

#confirm-message {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.dialog-actions-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.dialog-actions-vertical button {
  width: 100%;
  font-size: 0.95rem;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn-secondary:hover {
  background: var(--surface);
  color: var(--text);
}
.btn-secondary:active {
  background: var(--taken-bg);
  color: var(--text);
}

.btn-danger {
  background: #DC2626;
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.25);
}
.btn-danger:hover {
  background: #C81E1E;
  color: #FFFFFF;
}
.btn-danger:active {
  background: #B91C1C;
  color: #FFFFFF;
}

/* --- Home: features (folded once the device has a weekend of its own) --- */
.features {
  margin-top: 40px;
}

.feature-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  flex-shrink: 0;
  line-height: 0;
}

.feature-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.feature-card p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  font-weight: 500;
  color: var(--muted);
}

.home-demo-btn {
  width: 100%;
  margin-top: 16px;
  background: var(--card);
  color: var(--text);
}

.home-demo-btn[hidden] {
  display: none;
}

/* --- Home: install the app (hidden in the installed app) --- */
.pwa-install {
  margin-top: 40px;
}

.pwa-install[hidden] {
  display: none;
}

.install-btn {
  width: 100%;
  margin-bottom: 16px;
}

.install-btn[hidden] {
  display: none;
}

.install-steps {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .install-steps {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.install-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.install-card[hidden] {
  display: none;
}

.install-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 700;
}

.install-card ol {
  margin: 0;
  padding-left: 20px;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.5;
}

.install-card li + li {
  margin-top: 6px;
}

.install-card strong {
  font-weight: 700;
}

.install-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* "Installe l'app" card, bottom of the weekend hub (js/shared/install-nudge.js) */
.install-nudge {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 20px;
  padding: 16px 16px 16px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.install-nudge[hidden] {
  display: none;
}

.install-nudge-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  box-shadow: 0 6px 14px rgba(232, 96, 60, 0.28);
}

.install-nudge-body {
  flex: 1;
  min-width: 0;
}

.install-nudge-body p {
  margin: 0;
}

.install-nudge-title {
  padding-right: 30px; /* room for the close button */
  line-height: 1.3;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.install-nudge-text {
  margin-top: 2px !important;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.install-nudge-steps {
  display: inline-block;
  margin-top: 10px !important;
  padding: 9px 12px;
  background: var(--accent-soft);
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.arrow {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.16em;
  flex-shrink: 0;
}

.install-nudge-glyph {
  vertical-align: -3px;
  color: var(--accent);
}

.install-nudge-actions {
  margin-top: 12px;
}

.install-nudge-btn {
  display: inline-block;
  padding: 9px 18px;
  background: linear-gradient(135deg, #E8603C 0%, #F2709C 62%, #B78BFF 100%);
  border: 0;
  border-radius: 999px;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
}

.install-nudge-btn.is-soft {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.install-nudge-btn:active {
  transform: scale(0.98);
}

.install-nudge-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
}

.install-nudge-close:active {
  background: var(--accent-soft);
}

/* --- Weekend Hub page --- */
body.weekend-hub main {
  padding: 20px 16px 40px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header: title + date stacked, icon action on the right */
.header-title {
  flex: 1;
  min-width: 0;
}

.header-title h1 {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-module-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.header-subtitle {
  margin: 2px 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Line reserved even while empty: the title must not move when the name arrives */
.header-subtitle {
  min-height: 1.5em;
}

.header-subtitle::first-letter {
  text-transform: uppercase;
}

.header-icon-btn[hidden] {
  display: none;
}

.header-icon-btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.header-icon-btn:hover {
  box-shadow: var(--shadow-sm);
}

.header-icon-btn:active {
  background: var(--taken-bg);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

/* Loading placeholders */
.skeleton-inline {
  display: inline-block;
  width: min(60vw, 240px);
  height: 1.1em;
  border-width: 2px;
  vertical-align: middle;
}

.skeleton-chip {
  display: inline-block;
  width: 72px;
  height: 34px;
  border-width: 2px;
  border-radius: 8px;
}

/* Participants */
.weekend-info {
  margin-bottom: 24px;
}

.participants-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.participant-tag {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

/* Same height for every pill; the name centred on its capitals, not on the line box
   (the font leaves more room below the letters than above) */
.participant-tag,
.participant-more:not(.is-expanded),
.participant-invite,
.participant-join {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1;
  text-box: trim-both cap alphabetic;
}

/* Me: solid orange, so I find myself at once */
.participant-tag.is-me {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* One line: initials, "5 participants", the names (mine in orange); + adds people */
.participants-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.participants-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--text);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.participants-toggle:hover,
.participants-toggle:active {
  background: none;
  box-shadow: none;
  transform: none;
  color: var(--text);
}

.participants-avatars {
  flex-shrink: 0;
  display: flex;
}

.participants-avatars:empty {
  display: none;
}

.participants-avatars .avatar {
  width: 30px;
  height: 30px;
  margin-left: -8px;
  border-color: var(--surface);
  font-size: 0.8rem;
}

.participants-avatars .avatar:first-child {
  margin-left: 0;
}

.participants-avatars .avatar.is-me {
  background: var(--accent);
}

.participants-avatars .avatar-more {
  width: auto;
  background: color-mix(in srgb, var(--text) 10%, var(--surface));
  color: var(--muted);
}

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

.participants-count {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
}

.participants-names {
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.participants-names[hidden] {
  display: none;
}

.participants-names .is-me {
  font-weight: 700;
  color: var(--accent-text);
}

.participants-add {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--accent-soft);
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  color: var(--accent-text);
}

.participants-add:hover,
.participants-add:active {
  background: var(--accent-soft-2);
  box-shadow: none;
  color: var(--accent-text);
}

/* Participants window: one pill per person, their coloured initial first */
#participants-list .participant-tag {
  gap: 8px;
  height: 40px;
  padding: 0 14px 0 5px;
  background: var(--surface);
  font-family: var(--font-display);
  font-size: 0.95rem;
  text-box: none;
}

/* The others can be removed: a real button, it reacts to the touch */
#participants-list .participant-tag.is-removable {
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--text);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

#participants-list .participant-tag.is-removable:hover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: none;
  transform: none;
  color: var(--text);
}

#participants-list .participant-tag.is-removable:active {
  transform: scale(0.96);
  background: var(--taken-bg);
  box-shadow: none;
}

.participants-remove-hint {
  margin: -8px 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

.participants-remove-hint[hidden] {
  display: none;
}

#participants-list .participant-tag.is-me {
  background: var(--accent);
}

:is(#participants-list .participant-tag, .add-chip) .avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  margin: 0;
  border: 0;
  font-size: 0.8rem;
}

#participants-list .participant-tag.is-me .avatar {
  background: #FFFFFF;
  color: var(--accent);
}

.participants-join {
  margin-top: 10px;
}

.participants-join[hidden] {
  display: none;
}

/* Participants window: the list, then "Ajouter des participants" */
.add-section-title {
  margin: 6px 0 -10px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.participants-tags[hidden] {
  display: none;
}

/* Countdown in the hub header: the sunset gradient, as on the home page */
.countdown-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 9px;
  border-radius: 999px;
  background: linear-gradient(150deg, #E8603C 0%, #F2709C 70%, #B78BFF 100%);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  color: #FFFFFF;
  vertical-align: 1px;
}

.participants-empty {
  align-self: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.participant-invite {
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: none;
  color: var(--text);
}

.participant-invite:hover {
  background: var(--card);
  transform: none;
  box-shadow: none;
  border-style: solid;
  color: var(--text);
}

.participant-invite:active {
  transform: scale(0.96);
  box-shadow: none;
  background: var(--taken-bg);
  color: var(--text);
}

.participant-more {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.participant-more.is-expanded,
.participant-more.is-expanded:hover,
.participant-more.is-expanded:active {
  order: 1; /* after "+ Ajouter" */
  flex-basis: 100%;
  padding: 4px 2px;
  background: none;
  border: 0;
  box-shadow: none;
  transform: none;
  text-align: left;
  font-family: var(--font-body);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--muted);
}

/* Identify dialog in big groups: search + compact name chips */
#identify-form .identify-search {
  padding: 10px 12px;
}

.participants-buttons.is-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
  padding: 2px 4px 6px 2px;
}

.participants-buttons.is-compact .participant-btn {
  padding: 8px 14px;
  border-width: 2px;
  border-radius: 999px;
  font-size: 0.95rem;
}

.participant-invite,
.participant-join {
  text-transform: none;
  letter-spacing: 0;
}

.participant-join {
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  box-shadow: none;
  color: var(--accent-ink);
}

/* Live summary shown at the bottom of each module card */
.module-status {
  margin-top: auto;
  align-self: center;
  max-width: 100%;
  padding: 3px 10px;
  background: var(--taken-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.module-status[hidden] {
  display: none;
}

.module-status[data-tone="empty"] {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}

.module-status[data-tone="ok"] {
  background: var(--green);
  border-color: transparent;
  color: #17774D;
}

.module-status[data-tone="todo"] {
  background: var(--c-pay);
  border-color: transparent;
  color: #FFFFFF;
}

/* Modules: 2×2 grid, even on mobile */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.module-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 12px 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  text-align: center;
}

.module-card:not(.disabled):hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.module-card:not(.disabled):active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.module-card.disabled {
  cursor: not-allowed;
  background: var(--taken-bg);
  border-style: dashed;
  box-shadow: none;
}

.module-card.disabled .module-icon,
.module-card.disabled h3,
.module-card.disabled p {
  opacity: 0.5;
}

.module-badge {
  position: absolute;
  top: -12px;
  right: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--purple);
  color: #6A4BD8;
}

.module-icon {
  margin: 0 auto 10px;
  line-height: 0;
}

.feature-icon img {
  display: block;
}

/* Hub: white pictogram on a tile in the module's full colour (the card stays white) */
.module-card .module-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--icon-bg, #F1F1F5);
  box-shadow: 0 10px 22px var(--icon-glow, transparent);
  color: #FFFFFF;
}

.module-card.disabled .module-icon {
  box-shadow: none;
}

.module-card.transport { --mod-c: var(--c-trip); --mod-d: var(--c-trip-deep); --mod-g: var(--c-trip-glow); }
.module-card.shopping { --mod-c: var(--c-shop); --mod-d: var(--c-shop-deep); --mod-g: var(--c-shop-glow); }
.module-card.payments { --mod-c: var(--c-pay); --mod-d: var(--c-pay-deep); --mod-g: var(--c-pay-glow); }
.module-card.lodging { --mod-c: var(--c-lodge); --mod-d: var(--c-lodge-deep); --mod-g: var(--c-lodge-glow); }
.module-card:is(.transport, .shopping, .payments, .lodging) {
  --icon-bg: linear-gradient(150deg, var(--mod-d) 0%, var(--mod-c) 55%, var(--mod-g) 100%);
  --icon-glow: color-mix(in srgb, var(--mod-c) 38%, transparent);
  --mod-ink: var(--mod-d);
  --veil: 16%;
}

/* Each tile tinted from the top with its module's colour (veil), border of the same hue */
.module-card:is(.transport, .shopping, .payments):not(.disabled) {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--mod-c) var(--veil), transparent) 0%, transparent 62%),
    var(--card);
  border-color: color-mix(in srgb, var(--mod-c) 18%, transparent);
}

/* Status pill in the module's colour: something to do = solid module colour, white text;
   otherwise a soft tint of the module (dashed when there is nothing yet) */
.module-card .module-status,
.module-card .module-status[data-tone] {
  background: color-mix(in srgb, var(--mod-c, #646A7B) 16%, #FFFFFF);
  border: 1px solid transparent;
  color: var(--mod-ink, var(--text));
}

.module-card .module-status[data-tone="todo"] {
  background: color-mix(in srgb, var(--mod-c) 88%, #000000);
  color: #FFFFFF;
}

/* Nothing yet: the same soft pill, lighter */
.module-card .module-status[data-tone="empty"] {
  background: color-mix(in srgb, var(--mod-c, #646A7B) 9%, #FFFFFF);
  color: color-mix(in srgb, var(--mod-ink, #646A7B) 92%, #FFFFFF);
}

.module-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.module-card p {
  margin: 0 0 12px;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 500;
}

@media (min-width: 640px) {
  .modules-grid {
    gap: 18px;
  }

  .module-card {
    padding: 24px 20px 22px;
  }

  .module-card .module-icon {
    width: 72px;
    height: 72px;
  }

  .module-card .module-icon svg {
    width: 36px;
    height: 36px;
  }

  .module-card h3 {
    font-size: 1.25rem;
  }

  .module-card p {
    font-size: 0.9rem;
  }
}

/* Secondary / destructive action: discreet text link */
.btn-link-danger {
  background: none;
  border: none;
  box-shadow: none;
  padding: 10px 12px;
  color: var(--c-danger);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link-danger:hover {
  color: var(--c-danger);
  transform: none;
  box-shadow: none;
}

.btn-link-danger:active {
  background: none;
  transform: none;
  box-shadow: none;
  color: var(--c-danger);
}

/* --- Identify dialog --- */
#identify-form {
  display: grid;
  gap: 12px;
  width: min(calc(90vw - 62px), 380px);
}

.dialog-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: -0.02em;
}

.dialog-description {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
}

.participants-buttons {
  display: grid;
  gap: 10px;
}

.participants-buttons:empty {
  display: none;
}

.participant-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
  text-align: left;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
}

.participant-btn:hover {
  background: var(--accent-soft);
  transform: none;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.participant-btn:active {
  background: var(--accent-soft-2);
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

#identify-submit {
  width: 100%;
}

.or-divider {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 16px 0;
  position: relative;
}

#identify-form .or-divider {
  margin: 4px 0;
}

.or-divider[hidden] {
  display: none;
}

.or-divider::before,
.or-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 30px);
  height: 2px;
  background: var(--border);
  color: var(--text);
}

.or-divider::before { left: 0; }
.or-divider::after { right: 0; }

/* Shared: empty placeholder (transport) and icon delete button base (transport) */
.empty-state {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 40px 20px;
  font-weight: 500;
  font-size: 1rem;
}

.btn-delete {
  background: transparent;
  color: var(--muted);
  border: 2px solid transparent;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.btn-delete:hover {
  color: #EF4444;
  background: #FEE2E2;
  border-color: #EF4444;
  transform: scale(1.1);
}

.btn-delete:active {
  transform: scale(0.95);
}

/* ========== Toast Notifications ========== */
/* White pill, top right, just under the sticky header (--toast-top, set by toast.js) */
.toast-container {
  position: fixed;
  top: calc(var(--toast-top, env(safe-area-inset-top, 0px)) + 8px);
  right: 12px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(360px, calc(100% - 24px));
  pointer-events: none;
}

/* Popover (top layer, above open dialogs): undo the browser's popover box */
.toast-container[popover] {
  inset: auto;
  top: calc(var(--toast-top, env(safe-area-inset-top, 0px)) + 8px);
  right: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  overflow: visible;
}

.toast-container[popover]:not(:popover-open) {
  display: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(-10px) scale(0.97);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  pointer-events: all;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  color: #FFFFFF;
}

.toast-success .toast-icon { background: var(--c-shop); }
.toast-error .toast-icon { background: var(--c-danger); }
.toast-warning .toast-icon { background: var(--warn); }

.toast-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ========== Skeleton Loaders ========== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--card) 0%,
    var(--taken-bg) 50%,
    var(--card) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
  border: 1px solid var(--line);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 20px;
  margin-bottom: 10px;
}

.skeleton-card {
  height: 100px;
  width: 100%;
}

.skeleton-button {
  height: 44px;
  width: 120px;
}

/* ========================================
   PAYMENTS (Dépenses)
   ======================================== */
body.paiements main {
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}

body.paiements h2 {
  margin-bottom: 12px;
}

/* --- Segmented control (tabs, type, split mode) --- */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.segmented-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 8px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  transition: background 0.1s, border-color 0.1s;
  color: var(--text);
}

.segmented-btn:hover {
  transform: none;
  box-shadow: none;
  background: var(--surface);
}

.segmented-btn:active {
  transform: scale(0.97);
  box-shadow: none;
  background: var(--taken-bg);
  color: var(--text);
}

.segmented-btn[aria-selected="true"],
.segmented-btn[aria-checked="true"],
.segmented-btn[aria-selected="true"]:hover,
.segmented-btn[aria-checked="true"]:hover {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

.segmented-sm {
  box-shadow: none;
  margin-bottom: 12px;
}

.segmented-sm .segmented-btn {
  padding: 8px 4px;
  font-size: 0.8rem;
}

/* --- Personal summary --- */
.pay-summary {
  margin-bottom: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Amount card: solid colour of the page (pink in Dépenses), white text, whatever the balance
   (owing or owed: the label says it, the colour stays the module's) */
.pay-summary[data-tone] .pay-summary-main { background: var(--mod-grad); color: var(--accent-ink); }

.pay-summary .skeleton-card {
  border: 0;
  border-radius: 0;
  height: 128px;
}

.pay-summary-main {
  padding: 16px 18px 14px;
}

.pay-summary-label,
.pay-summary-value,
.pay-summary-detail {
  margin: 0;
}

.pay-summary-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.pay-summary-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.pay-summary-done {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pay-summary-done svg {
  flex-shrink: 0;
  stroke-width: 3.5;
}

.pay-summary-detail {
  margin-top: 2px;
  font-size: 0.9rem;
  font-weight: 500;
}

.pay-summary-link {
  margin-top: 10px;
  padding: 7px 14px;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.22);
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  color: inherit;
}

.pay-summary-link:hover {
  box-shadow: var(--shadow-sm);
}

.pay-summary-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--card);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.pay-summary-foot strong {
  color: var(--text);
  font-weight: 700;
}

.pay-tabs {
  margin-bottom: 20px;
}

.pay-pane[hidden] {
  display: none;
}

/* --- Category icons --- */
.cat-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
}

.cat-icon-lg {
  width: 64px;
  height: 64px;
  border-width: 3px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

[data-cat="food"] { background: var(--pink);
  color: var(--c-pay-deep);
}
[data-cat="groceries"] { background: var(--mint);
  color: var(--c-shop-deep);
}
[data-cat="transport"] { background: var(--teal);
  color: var(--c-trip-deep);
}
[data-cat="lodging"] { background: var(--purple);
  color: var(--c-lodge-deep);
}
[data-cat="activity"] { background: #FDEBCB;
  color: #B45309;
}
[data-cat="other"] { background: #EEEFF4;
  color: var(--muted);
}
[data-cat="none"] { background: #F1F1F5;
  color: var(--text);
}
[data-cat="transfer"] { background: #FFFFFF; border: 1.5px dashed var(--border);
  color: var(--text);
}
[data-cat="settled"] { background: var(--green);
  color: #1B8A5A;
}

/* Colour families of automatic expense icons (see shared/expense-icons.js) */
[data-family="food"] { background: var(--pink);
  color: var(--c-pay-deep);
}
[data-family="groceries"] { background: var(--mint);
  color: var(--c-shop-deep);
}
[data-family="transport"] { background: var(--teal);
  color: var(--c-trip-deep);
}
[data-family="lodging"] { background: var(--purple);
  color: var(--c-lodge-deep);
}
[data-family="activity"] { background: #FDEBCB;
  color: #B45309;
}
[data-family="other"] { background: #EEEFF4;
  color: var(--muted);
}
[data-family="none"] { background: #F1F1F5;
}
[data-family="transfer"] { background: #FFFFFF; border: 1.5px dashed var(--border);
}

/* Random icon (title not recognised): a tilted "sticker" on a striped background */
[data-family="random"] {
  background: repeating-linear-gradient(-45deg, var(--card) 0 5px, var(--purple) 5px 10px);
}

[data-family="random"] > svg {
  transform: rotate(-12deg);
}


/* --- Title + icon (form) --- */
.title-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.title-row input, .title-row textarea {
  flex: 1;
  min-width: 0;
}

.icon-pick {
  position: relative;
  flex-shrink: 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--text);
}

.icon-pick:hover,
.icon-pick:active {
  transform: none;
  box-shadow: none;
  background: none;
  color: var(--text);
}

.icon-pick .cat-icon {
  width: 50px;
  height: 100%;
  min-height: 50px;
  border-width: 3px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s;
}

.icon-pick:hover .cat-icon {
  transform: none;
  box-shadow: var(--shadow-sm);
}

/* Small pencil badge: the icon can be changed */
.icon-pick::after {
  content: '';
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A0A0A' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E") center / 10px no-repeat;
  color: var(--text);
}

.icon-picker {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  display: grid;
  gap: 12px;
}

.icon-picker[hidden] {
  display: none;
}

.icon-picker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.icon-picker-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

#icon-auto[aria-pressed="true"] {
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-soft);
}

.icon-group {
  display: grid;
  gap: 6px;
}

.icon-group + .icon-group {
  margin-top: 4px;
}

.icon-group-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.icon-choice {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
}

.icon-choice:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.icon-choice[aria-pressed="true"] {
  outline: 1px solid var(--line);
  outline-offset: 2px;
}

/* --- Expense list --- */
.expense-group {
  margin-bottom: 22px;
}

.expense-day {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.expense-day::first-letter {
  text-transform: uppercase;
}

.expense-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text);
}

.expense-item:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.expense-item:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
  background: var(--card);
  color: var(--text);
}

.expense-item.is-transfer {
  background: var(--surface);
  border-style: dashed;
  box-shadow: none;
}

.expense-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.expense-name {
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-meta,
.expense-share {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.expense-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-side {
  display: grid;
  justify-items: end;
  gap: 2px;
  flex-shrink: 0;
}

.expense-amount {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
}

/* The list is a till receipt: one sheet of white paper with zigzag edges,
   dotted lines between expenses and between days */
.expense-ticket {
  padding: 16px 16px 20px;
  background: #FFFEFB;
  -webkit-mask:
    radial-gradient(circle at 7px 0, transparent 5px, #000 5.5px) top / 14px 51% repeat-x,
    radial-gradient(circle at 7px 100%, transparent 5px, #000 5.5px) bottom / 14px 51% repeat-x;
  mask:
    radial-gradient(circle at 7px 0, transparent 5px, #000 5.5px) top / 14px 51% repeat-x,
    radial-gradient(circle at 7px 100%, transparent 5px, #000 5.5px) bottom / 14px 51% repeat-x;
}

.expense-ticket .expense-group {
  margin: 0;
}

.expense-ticket .expense-group + .expense-group {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed #D6CFD6;
}

.expense-ticket .expense-day {
  margin: 2px 0 4px;
}

.expense-ticket .expense-items {
  gap: 0;
}

.expense-ticket .expense-items > li + li {
  border-top: 1px dashed #E6DFE6;
}

.expense-ticket .expense-item,
.expense-ticket .expense-item.is-transfer,
.expense-ticket .expense-item:hover,
.expense-ticket .expense-item:active {
  padding: 10px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.expense-ticket .expense-item:active {
  opacity: 0.7;
}

/* A new expense prints out of the till (payments.js, .is-printing): the line opens downwards
   while the paper slides out, with a soft highlight. --t < 0 resumes it after a re-render. */
.expense-ticket .expense-items > li.is-printing {
  overflow: hidden;
  animation: ticket-open 0.5s cubic-bezier(0.3, 0, 0.2, 1) calc(var(--t, 0ms) + 0.15s) backwards;
}

.expense-ticket li.is-printing .expense-item {
  border-radius: 12px;
  animation: ticket-feed 0.75s cubic-bezier(0.3, 0, 0.2, 1) calc(var(--t, 0ms) + 0.15s) backwards;
}

@keyframes ticket-open {
  from { max-height: 0; }
  to { max-height: 120px; }
}

@keyframes ticket-feed {
  from { transform: translateY(-70%); background-color: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
  60% { transform: none; background-color: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
}

/* A removed row folds away (utils.js, foldAwayRemoved): fades, then closes in height. The
   grid gap of the list closes with it (--gap). */
.is-removed {
  overflow: hidden;
  pointer-events: none;
  animation: row-remove 0.36s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

.shop-items > .is-removed { --gap: 5px; }

@keyframes row-remove {
  from { max-height: var(--h); }
  35% { opacity: 0; max-height: var(--h); }
  to { opacity: 0; max-height: 0; margin-bottom: calc(-1 * var(--gap, 0px)); }
}

/* Amounts rolling to a new value: fixed-width digits, so the text doesn't shake */
.num-roll {
  font-variant-numeric: tabular-nums;
}

.expense-ticket .cat-icon {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
}

/* Reimbursement: not a purchase, so not a line like the others. A band in the colour of the
   module (round icon, coloured amount). Same for everyone: whether the recipient confirmed it
   is their own memo, shown only to them in Équilibre */
.expense-ticket .expense-items .expense-item.is-transfer {
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--accent-soft);
}

/* The band is enough: no dotted line above or below it */
.expense-ticket .expense-items > li:has(.is-transfer),
.expense-ticket .expense-items > li:has(.is-transfer) + li {
  border-top: 0;
}

.expense-ticket .is-transfer .cat-icon {
  width: 32px;
  height: 32px;
  margin: 0 3px;
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--accent-text);
}

.expense-ticket .is-transfer .expense-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.expense-ticket .is-transfer .expense-amount {
  font-size: 0.95rem;
  color: var(--accent-text);
}

/* --- Empty state --- */
.pay-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 32px 16px;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
}

.pay-empty p {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.pay-empty strong {
  color: var(--text);
}

.pay-muted {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

/* --- Balance tab --- */
.pay-card {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.settlements-list,
.balance-list {
  display: grid;
  gap: 10px;
}

/* Clearly a button: a pill in the colour of the module (outlined for the others' reimbursements) */
.settlement-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
  background: var(--card);
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  box-shadow: none;
  color: var(--accent-text);
}

.settlement-btn:hover {
  background: var(--accent-soft);
  box-shadow: none;
  color: var(--accent-text);
}

.settlement-btn:active {
  transform: scale(0.96);
  box-shadow: none;
}

.settlement-btn.is-primary,
.settlement-btn.is-primary:hover {
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent-ink);
}

/* --- Reimbursements: "Me concernent" / "Tous" + one list --- */
.settle-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.settle-filter button {
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.settle-filter button:hover,
.settle-filter button:active {
  transform: none;
  box-shadow: none;
  background: var(--surface);
  color: var(--text);
}

.settle-filter button[aria-pressed="true"],
.settle-filter button[aria-pressed="true"]:hover {
  background: var(--text);
  border-color: transparent;
  color: #FFFFFF;
}

.settle-list {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.settle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 10px 10px 10px 12px;
}

.settle-row + .settle-row {
  border-top: 1px solid var(--line);
}

.person-dot {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--p) 18%, #FFFFFF);
  color: color-mix(in srgb, var(--p) 80%, #000000);
  font-family: var(--font-display);
  font-weight: 700;
}

.settle-main {
  flex: 1;
  min-width: 0;
}

.settle-text,
.settle-amount,
.settle-sub {
  margin: 0;
  overflow-wrap: anywhere;
}

.settle-text {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
}

.settle-text strong {
  font-weight: 700;
}

.settle-amount {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.settle-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.settle-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Waiting on the others / already settled: quieter */
.settle-row.is-muted .settle-text {
  font-weight: 500;
}

.settle-row.is-muted .settle-amount {
  color: var(--muted);
}

/* "Tous": plain list, no avatars */
.settle-list.is-plain .settle-row {
  padding-left: 14px;
}

.settle-done-toggle {
  margin-top: 10px;
}

.settle-done-toggle + .settle-list {
  margin-top: 8px;
}

.settled {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settled p {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.settled strong {
  color: var(--text);
}

.balance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
}

.balance-row.is-me {
  background: var(--surface);
  outline: 1px solid var(--line);
}

.balance-name {
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.balance-me {
  margin-left: 4px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent-soft);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Diverging bar: negative grows left of centre, positive grows right */
.balance-bar {
  position: relative;
  height: 10px;
  border-radius: 7px;
  background: rgba(30, 34, 48, 0.06);
}

.balance-bar::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--border);
  color: var(--text);
}

.balance-bar > span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 7px;
}

[data-tone="positive"] .balance-bar > span { left: 50%; background: var(--green-strong); }
[data-tone="negative"] .balance-bar > span { right: 50%; background: var(--c-pay); }
[data-tone="neutral"] .balance-bar > span { display: none; }

.balance-value {
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
  min-width: 6.5em;
}

[data-tone="negative"] .balance-value { color: #BE185D; }
[data-tone="positive"] .balance-value { color: #047857; }
[data-tone="neutral"] .balance-value { color: var(--muted); }

.pay-summary-link.is-todo {
  background: #FFFFFF;
  color: var(--accent-text);
}

/* --- Big groups: search, previews, folded lists --- */
.chip[hidden],
.split-row[hidden],
.split-list[hidden],
.split-collapsed[hidden],
.people-more[hidden],
.participant-btn[hidden],
.participant-tag[hidden] {
  display: none;
}

.people-more {
  margin-top: 8px;
}

.split-collapsed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.split-collapsed-text {
  font-weight: 500;
}

.list-toggle {
  width: 100%;
  padding: 10px;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  box-shadow: none;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.list-toggle:hover {
  transform: none;
  box-shadow: none;
  background: var(--card);
  border-style: solid;
  color: var(--text);
}

.list-toggle:active {
  transform: scale(0.99);
  box-shadow: none;
}

/* --- Costs tab --- */
.my-cost {
  background: var(--accent-soft);
}

.my-cost-label,
.my-cost-value,
.my-cost-meta {
  margin: 0;
}

.my-cost-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.my-cost-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.my-cost-meta {
  margin-top: 4px;
  font-size: 0.9rem;
  font-weight: 500;
}

.my-cost .family-bars {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.family-bars {
  display: grid;
  gap: 6px;
}

.family-row {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.family-label {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-track {
  height: 10px;
  border-radius: 7px;
  background: rgba(30, 34, 48, 0.06);
  overflow: hidden;
}

.family-track > span {
  display: block;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.family-value {
  font-family: var(--font-display);
  font-weight: 700;
  text-align: right;
  min-width: 5.5em;
}

.costs-list {
  display: grid;
  gap: 6px;
}

/* --- Detail of an expense (payments.js, openDetail): a tap on a line of the ticket --- */
.detail-body {
  gap: 20px;
}

.detail-hero {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.detail-hero .cat-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border: 0;
  border-radius: 16px;
}

.detail-hero .cat-icon svg {
  width: 28px;
  height: 28px;
}

.detail-hero .icon-pick {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
}

dialog.sheet .detail-hero .icon-pick .cat-icon {
  width: 56px;
  height: 56px;
  min-height: 0;
  margin-bottom: 0;
}

/* Icon picker of the detail: under the icon, full width, left-aligned like in the form */
.detail-icon-picker {
  justify-self: stretch;
  margin: 0 0 8px;
  text-align: left;
}

#detail-icon-auto[aria-pressed="true"] {
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-soft);
}

.detail-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.detail-amount {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.detail-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-meta strong {
  color: var(--text);
}

.detail-split .field-label {
  margin-bottom: 6px;
}

.detail-shares {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-share {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
}

.detail-share + .detail-share {
  border-top: 1px dashed var(--line);
}

.detail-share.is-me {
  background: var(--accent-soft);
  border-top-color: transparent;
}

.detail-share.is-me + .detail-share {
  border-top-color: transparent;
}

.detail-share-main {
  flex: 1;
  display: grid;
  min-width: 0;
}

.detail-share-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.detail-share-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-share.is-payer .detail-share-note {
  color: var(--accent);
  font-weight: 600;
}

.detail-share-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.detail-others {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.detail-transfer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--accent-soft);
}

.detail-transfer-name {
  font-weight: 700;
}

.detail-transfer-arrow {
  margin: 0 4px;
  color: var(--accent);
}

/* A reimbursement: round icon in the colour of the module, as its band on the ticket */
.detail-hero .cat-icon[data-family="transfer"],
.detail-hero .cat-icon:not([data-family]) {
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.sheet-footer .detail-edit {
  max-width: none;
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cost-entry {
  border: 2px solid transparent;
  border-radius: 12px;
}

.cost-entry.is-me {
  border-color: var(--border);
  background: var(--surface);
}

.cost-entry.is-open {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.cost-row:hover,
.cost-row:active {
  transform: none;
  box-shadow: none;
  background: rgba(10, 10, 10, 0.04);
  color: var(--text);
}

.cost-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-bar {
  height: 10px;
  border-radius: 7px;
  background: rgba(30, 34, 48, 0.06);
  overflow: hidden;
}

.cost-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 7px;
}

.cost-value {
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
  min-width: 5.5em;
}

.cost-chevron {
  transition: transform 0.15s;
}

.cost-entry.is-open .cost-chevron {
  transform: rotate(180deg);
}

.cost-detail {
  display: grid;
  gap: 12px;
  padding: 4px 12px 12px;
}

.cost-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.cost-figures > div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  text-align: center;
  color: var(--text);
}

.cost-figures dt {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.cost-figures dd {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
}

.cost-figures dd[data-tone="negative"] { color: #BE185D; }
.cost-figures dd[data-tone="positive"] { color: #047857; }

.cost-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.cost-items li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.cat-icon-sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.cost-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-item-share {
  font-weight: 700;
  white-space: nowrap;
}

/* --- Push notifications --- */
.notif-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  align-items: start;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--purple);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.notif-card[hidden] {
  display: none;
}

.notif-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
}

.notif-text strong {
  font-family: var(--font-display);
}

.notif-text p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  font-weight: 500;
}

.notif-actions {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 14px;
}

.notif-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  border-width: 2px;
  box-shadow: var(--shadow-sm);
}

.notif-btn[hidden] {
  display: none;
}

.notif-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 6px;
  margin: 0 0 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.notif-status[hidden] {
  display: none;
}

/* "Relancer": round bell button next to "Reçu" / "Payé" */
/* Reminder sent (payments.js): the bell swings twice, from its top */
.remind-btn.is-ringing svg {
  transform-origin: 50% 10%;
  animation: bell-ring 0.8s ease-in-out var(--t, 0ms) backwards;
}

@keyframes bell-ring {
  0%, 100% { transform: none; }
  15% { transform: rotate(18deg); }
  35% { transform: rotate(-16deg); }
  55% { transform: rotate(10deg); }
  75% { transform: rotate(-6deg); }
}

.remind-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-color: var(--line);
  color: var(--text);
}

.remind-btn[data-can-notify="true"] {
  background: var(--purple);
  color: var(--text);
}

/* --- Floating add button --- */
.pay-fab {
  background: var(--mod-grad);
  position: fixed;
  z-index: 20;
  right: max(16px, calc((100vw - var(--page-width)) / 2 + 16px));
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
}

.pay-fab[hidden] {
  display: none;
}

/* --- Bottom sheet (add / edit) --- */
dialog.sheet {
  padding: 0;
  width: 100%;
  max-width: 100%;
  /* --kb-inset: room taken by the on-screen keyboard (js/core/keyboard.js) */
  max-height: calc(92dvh - var(--kb-inset, 0px));
  margin: auto 0 var(--kb-inset, 0px);
  border-radius: 20px 20px 0 0;
  border-bottom: 0;
  overflow: hidden;
}

dialog.sheet[open] {
  display: flex;
  animation: sheet-up 0.25s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (min-width: 640px) {
  dialog.sheet {
    width: 560px;
    margin: auto;
    border-radius: 16px;
    border-bottom: 1px solid var(--line);
    max-height: 88vh;
  }
}

.sheet-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.sheet-header .dialog-title {
  font-size: 1.3rem;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: #F1F1F5;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  color: var(--text);
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 20px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-content: start;
}

.sheet-body > * {
  min-width: 0;
}

.sheet-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.sheet-submit {
  flex: 1;
  max-width: 260px;
  margin-left: auto;
}

/* --- Form fields --- */
.field[hidden] {
  display: none;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-optional {
  margin-left: 4px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.link-btn {
  padding: 4px 0;
  background: none;
  border: 0;
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--text);
}

.link-btn:hover,
.link-btn:active {
  transform: none;
  box-shadow: none;
  background: none;
  color: var(--text);
}

.sheet input[type="date"] {
  font: inherit;
  font-weight: 500;
}

.amount-field {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 0 16px;
}

.amount-field:focus-within {
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.amount-field textarea {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.amount-field textarea:focus {
  outline: none;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.amount-suffix {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
}

/* --- Chips (categories, people) --- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  user-select: none;
}

.chip:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.chip:active {
  transform: scale(0.97);
  box-shadow: none;
  background: var(--card);
  color: var(--text);
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip[aria-pressed="true"],
.chip:has(input:checked) {
  background: var(--accent);
  border-color: transparent;
  box-shadow: none;
  font-weight: 700;
  color: var(--accent-ink);
}

.chip:has(input:disabled) {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.chip:has(input:focus-visible) {
  outline: 1px solid var(--line);
  outline-offset: 2px;
}

.cat-dot {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

/* Quick selection next to "Pour qui ?" */
.quick-btn {
  padding: 4px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.quick-btn:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.quick-btn:active {
  transform: scale(0.97);
  box-shadow: none;
  background: var(--card);
  color: var(--text);
}

/* "Tout désélectionner": text link right above the list of names */
.split-list-head {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 6px;
}

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

/* --- Split list --- */
.split-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
}

.split-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 52px;
  padding: 6px 12px;
}

.split-row + .split-row {
  border-top: 2px solid var(--taken-bg);
}

.split-row.is-out .split-name {
  color: var(--muted);
  text-decoration: line-through;
}

.split-person {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.split-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.split-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-share {
  min-width: 4.5em;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.split-share:empty {
  display: none;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.stepper button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--surface);
  font-size: 1.1rem;
  color: var(--text);
}

.stepper button:hover {
  transform: none;
  box-shadow: none;
  background: var(--accent-soft);
  color: var(--text);
}

.stepper button:active {
  transform: none;
  box-shadow: none;
}

.stepper-value {
  min-width: 30px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
}

.split-amount-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}

.sheet .split-amount {
  width: 88px;
  padding: 7px 8px;
  border-width: 2px;
  border-radius: 8px;
  text-align: right;
}

.sheet .split-amount:focus {
  transform: none;
}

/* Not selected: the amount field stays clickable (clicking it selects the person) */
.split-row.is-out .split-amount-wrap {
  opacity: 0.45;
}

/* Amount typed by hand (locked): dashed border once the field is left.
   While typing it keeps the usual solid border + focus shadow. */
.sheet .split-amount:not(.is-auto):not(:focus) {
  border-style: dashed;
}

.split-status {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--surface);
}

.split-status[hidden] {
  display: none;
}

.split-status[data-tone="warn"] {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: var(--text);
}

.form-error {
  flex-basis: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--pink);
  font-weight: 700;
}

.form-error[hidden] {
  display: none;
}

/* "Tout désélectionner" sits on the "Pour qui ?" line (saves a row) */
.field-label-row .split-list-head {
  margin: 0;
}

/* --- Compact sheet on phones: smaller type and spacing, so more of the form fits on screen
   (above all with the keyboard open). Shared by Dépenses and Trajets. --- */
@media (max-width: 640px) {
  dialog.sheet .sheet-header {
    padding: 10px 16px;
  }

  dialog.sheet .sheet-header .dialog-title {
    font-size: 1.1rem;
  }

  dialog.sheet .sheet-close {
    width: 34px;
    height: 34px;
  }

  dialog.sheet .sheet-close svg {
    width: 18px;
    height: 18px;
  }

  dialog.sheet .sheet-body {
    padding: 12px 16px 6px;
    gap: 14px;
  }

  dialog.sheet .field-label {
    margin-bottom: 6px;
    font-size: 0.72rem;
  }

  dialog.sheet .link-btn {
    padding: 2px 0;
    font-size: 0.8rem;
  }

  dialog.sheet .segmented {
    padding: 3px;
  }

  dialog.sheet .segmented-btn {
    padding: 7px 6px;
    font-size: 0.82rem;
  }

  dialog.sheet .segmented-sm {
    margin-bottom: 8px;
  }

  dialog.sheet .segmented-sm .segmented-btn {
    padding: 6px 4px;
    font-size: 0.78rem;
  }

  dialog.sheet textarea:not(.split-amount),
  dialog.sheet input[type=text]:not(.split-amount),
  dialog.sheet input[type=date],
  dialog.sheet input[type=time] {
    padding: 9px 12px;
  }

  dialog.sheet .amount-field {
    padding: 0 14px;
  }

  dialog.sheet .amount-field textarea {
    padding: 4px 0;
    font-size: 1.5rem;
  }

  dialog.sheet .amount-suffix {
    font-size: 1.25rem;
  }

  dialog.sheet .title-row {
    gap: 8px;
  }

  dialog.sheet .icon-pick .cat-icon {
    width: 42px;
    min-height: 42px;
    border-width: 2px;
  }

  dialog.sheet .chips {
    gap: 6px;
  }

  dialog.sheet .chip {
    padding: 5px 11px;
    font-size: 0.85rem;
  }

  dialog.sheet .split-row {
    min-height: 42px;
    padding: 3px 12px;
  }

  dialog.sheet .split-check {
    width: 20px;
    height: 20px;
  }

  dialog.sheet .sheet-footer {
    gap: 10px;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  }

  dialog.sheet .sheet-submit {
    padding: 11px 20px;
  }
}

/* ========== App update banner (core/auto-update.js) ========== */
.update-banner {
  position: fixed;
  z-index: 10001;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom) + var(--kb-inset, 0px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-weight: 700;
  color: var(--text);
}

.update-banner button {
  padding: 8px 14px;
  background: var(--surface);
  border-width: 2px;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

/* ========== Accessibility ========== */
/* Visible keyboard focus everywhere (mouse/touch focus stays clean) */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
  outline: 1px solid var(--line);
  outline-offset: 3px;
}

/* Not on text fields (textarea, incl. one-line): they have their own focus look
   (white background + shadow, see textarea:focus) */
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

/* Respect the OS "reduce motion" setting */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  button:hover,
  .module-card:not(.disabled):hover,
  .weekend-link:hover {
    transform: none;
  }
}

/* --- Share / invite sheet --- */
.share-body {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.share-body .dialog-description strong {
  color: var(--text);
  font-weight: 700;
}

.share-options {
  display: grid;
  gap: 12px;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.share-option:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.share-option:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
  background: var(--taken-bg);
  color: var(--text);
}

.share-option[hidden] {
  display: none;
}

.share-option-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  /* White pictogram on the sunset gradient of the app icon (icon.svg, centre of the QR code) */
  background: linear-gradient(135deg, #E8603C 0%, #F2709C 62%, #B78BFF 100%);
  color: #FFFFFF;
  border-radius: 10px;
  box-shadow: 0 3px 8px rgba(232, 96, 60, 0.22);
}

.share-option-text {
  flex: 1;
  display: grid;
  min-width: 0;
}

.share-option-label {
  flex: 1;
}

.share-code {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.share-option-link {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.share-option-chevron {
  flex-shrink: 0;
  color: var(--muted);
}

.share-option.is-done .share-option-icon {
  background: var(--green);
  color: var(--text);
  box-shadow: none;
}

.share-qr {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 8px 0 0;
}

.share-qr-code {
  width: min(100%, 280px);
  padding: 12px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.share-qr-code svg {
  display: block;
  width: 100%;
  height: auto;
}

.share-qr figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* --- Home: archived weekends and features (folded sections) --- */
.archived-weekends {
  margin-top: 32px;
}

.archived-weekends summary,
.features summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.archived-weekends summary::-webkit-details-marker,
.features summary::-webkit-details-marker {
  display: none;
}

.archived-weekends summary::after,
.features summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-right: 2.5px solid var(--muted);
  border-bottom: 2.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.archived-weekends details[open] summary::after,
.features details[open] summary::after {
  margin-top: 2px;
  transform: rotate(-135deg);
}

.archived-weekends summary h2,
.features summary h2 {
  margin: 0;
}

.archived-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 4px;
  padding: 0 6px;
  background: var(--taken-bg);
  border: 2px solid var(--muted);
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0;
  color: var(--text);
}

/* ========================================
   SHOPPING (Courses) — built on the Dépenses patterns
   ======================================== */
body.shop-list main {
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}

body.shop-hub main {
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}

.shop-skeleton {
  height: 62px;
  margin-bottom: 10px;
  border-radius: 14px;
}

/* --- Progress bar (summary + hub cards) --- */
.shop-progress {
  display: block;
  flex: 1;
  height: 12px;
  min-width: 60px;
  background: rgba(30, 34, 48, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.shop-progress > span {
  display: block;
  height: 100%;
  /* Felt-tip stroke: translucent, slightly irregular ends */
  background: color-mix(in srgb, var(--c-shop) 62%, transparent);
  border-radius: 7px 3px 8px 2px;
  transition: width 0.3s ease-out;
}

.shop-summary-foot {
  align-items: center;
}

.shop-summary-foot > span:last-child {
  flex-shrink: 0;
}

/* --- Header: edit toggle --- */
.shop-edit-toggle {
  flex-shrink: 0;
  padding: 8px 12px;
  background: var(--card);
  border-width: 2px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.shop-edit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* "Terminé": green = validate, like "pris" */
.shop-edit-toggle[aria-pressed="true"],
.shop-edit-toggle[aria-pressed="true"]:active {
  background: var(--c-shop);
  border-color: transparent;
  color: #FFFFFF;
}

.shop-edit-toggle svg {
  width: 14px;
  height: 14px;
}

/* --- Progress card --- */
.shop-progress-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.shop-progress-card[hidden] {
  display: none;
}

.shop-progress-card[data-done="true"] {
  background: var(--green);
  color: var(--text);
}

/* Last item taken (shopping-list.js, .is-celebrating): the bar shines once, "Tout est pris !"
   pops in, the card turns green softly */
.shop-progress-card {
  transition: background-color 0.4s;
}

.shop-progress > span {
  background-image: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%);
  background-size: 250% 100%;
  background-repeat: no-repeat;
  background-position: 150% 0;
}

.shop-progress-card.is-celebrating .shop-progress > span {
  animation: shop-shine 0.9s ease-out 0.3s;
}

.shop-progress-card.is-celebrating .shop-progress-text {
  animation: shop-pop 0.5s cubic-bezier(0.34, 1.6, 0.5, 1) 0.25s backwards;
}

@keyframes shop-shine {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}

@keyframes shop-pop {
  from { transform: scale(0.6); opacity: 0; }
}

.shop-progress-text {
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.shop-progress-text strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

/* --- Edit mode --- */
.shop-edit-banner {
  margin: 0 0 14px;
  padding: 6px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
}

.shop-edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.shop-edit-actions[hidden] {
  display: none;
}

.shop-edit-action {
  flex: 1;
  padding: 12px;
  background: var(--card);
  border-style: dashed;
  box-shadow: none;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.shop-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.shop-hint code {
  padding: 1px 6px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-weight: 700;
}

.shop-sheet-secondary {
  justify-self: start;
  padding: 10px 14px;
  background: var(--card);
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  box-shadow: none;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.shop-sheet-secondary[hidden] {
  display: none;
}

/* --- Rows (compact: no shadows, thin borders, more items on screen) --- */
.shop-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}

.shop-items > li[hidden] {
  display: none;
}

/* Item: the whole row is the "je l'ai pris" button. No card: a hand-written list */
.shop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 12px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: none;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-body);
  font-weight: 500;
  transition: background 0.15s;
  color: var(--text);
}

.shop-row:hover {
  transform: none;
  box-shadow: none;
}

.shop-row:active {
  transform: scale(0.99);
  box-shadow: none;
  background: var(--taken-bg);
  color: var(--text);
}

.shop-check {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 2px solid color-mix(in srgb, var(--text) 45%, transparent);
  border-radius: 50%;
  color: var(--c-shop);
}

/* To take: a box to tick */
.shop-item[data-state="free"] .shop-check {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.shop-check svg {
  width: 14px;
  height: 14px;
}

.shop-item-text {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.shop-who {
  flex-shrink: 0;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

/* Taken: the name is crossed out with a green felt-tip stroke (orange on top if taken twice,
   see below). The stroke is a background of the inline .shop-ink, not a text-decoration, so it
   can draw itself from left to right (and line after line on a long name) when just taken. */
.shop-item[data-state="taken"] .shop-item-text,
.shop-item[data-state="conflict"] .shop-item-text {
  color: var(--muted);
}

.shop-item[data-state="taken"] .shop-ink,
.shop-item[data-state="conflict"] .shop-ink {
  background: linear-gradient(var(--shop-stroke), var(--shop-stroke)) 0 var(--shop-stroke-y) / 100% 0.48em no-repeat;
  --shop-stroke: color-mix(in srgb, var(--c-shop) 55%, transparent);
  --shop-stroke-y: 58%;
}

/* Just taken (shopping-list.js, .is-drawing): the tick is traced, then the felt-tip crosses the
   name out. --t < 0 when a re-render happens during the animation: it resumes where it was. */
.shop-item.is-drawing .shop-check path {
  stroke-dasharray: 1;
  animation: shop-tick 0.24s ease-out var(--t, 0ms) both;
}

.shop-item.is-drawing .shop-ink {
  animation: shop-stroke 0.42s cubic-bezier(0.4, 0, 0.3, 1) calc(var(--t, 0ms) + 0.12s) both;
}

.shop-item.is-drawing .shop-item-text {
  animation: shop-fade 0.4s ease-out calc(var(--t, 0ms) + 0.12s) both;
}

@keyframes shop-tick {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes shop-stroke {
  from { background-size: 0% 0.48em; }
  to { background-size: 100% 0.48em; }
}

@keyframes shop-fade {
  from { color: var(--text); }
}

/* Hand-drawn tick: no box, a bigger green check, slightly tilted */
.shop-item[data-state="taken"] .shop-check,
.shop-item[data-state="conflict"] .shop-check {
  background: transparent;
  border-color: transparent;
  color: var(--c-shop);
}

.shop-item[data-state="taken"] .shop-check svg,
.shop-item[data-state="conflict"] .shop-check svg {
  width: 20px;
  height: 20px;
  stroke-width: 3.4;
  rotate: -8deg;
}

/* Taken by several people: a second, orange tick over the green one, like the stroke */
.shop-item[data-state="conflict"] .shop-check {
  position: relative;
}

.shop-item[data-state="conflict"] .shop-check .shop-check-2 {
  position: absolute;
  color: color-mix(in srgb, var(--warn) 85%, transparent);
  translate: 4px 1px;
  rotate: -2deg;
}

/* Taken by several people: a second, orange felt-tip stroke over the green one. A transparent
   copy of the text (data-text) sits on the name, so the stroke follows its line breaks */
.shop-item[data-state="conflict"] .shop-item-text {
  position: relative;
}

.shop-item[data-state="conflict"] .shop-item-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  /* As wide as the text (same line breaks), so it tilts around the middle of the words */
  width: fit-content;
  max-width: 100%;
  color: transparent;
  pointer-events: none;
  text-decoration-line: line-through;
  text-decoration-thickness: 0.42em;
  text-decoration-color: color-mix(in srgb, var(--warn) 45%, transparent);
  text-decoration-skip-ink: none;
  translate: 0.1em -0.1em;
  /* Steeper on short names (--len = number of characters), else "Sel" looks flat */
  rotate: clamp(-10deg, calc(-80deg / var(--len, 12)), -4deg);
}

.shop-badge {
  display: inline-block;
  margin-right: 2px;
  padding: 0 6px;
  background: #FFE2B8;
  border-radius: 999px;
  color: #8A4B00;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Rayon header */
.shop-section {
  margin-top: 12px;
}

.shop-section:first-child {
  margin-top: 0;
}

.shop-section-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 4px 2px 4px 10px;
  background: transparent;
  border: 0;
  /* Felt-tip stroke in the margin: vertical, so it can't be mistaken for a crossed-out item */
  border-left: 5px solid color-mix(in srgb, var(--c-shop) 55%, transparent);
  border-radius: 2px;
  box-shadow: none;
  text-align: left;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--text);
}

.shop-section-btn:hover,
.shop-section-btn:active {
  transform: none;
  box-shadow: none;
  background: transparent;
  color: var(--text);
}

.shop-chevron {
  display: inline-block;
  transition: transform 0.15s;
}

.shop-section-btn[aria-expanded="false"] .shop-chevron {
  transform: rotate(-90deg);
}

/* A rayon folding / unfolding (shopping-list.js, startFold): its items close or open in height
   (the grid gap closes too), the chevron turns. --tf: when it starts (< 0 resumes it). */
.shop-item.is-folding,
.shop-item.is-unfolding {
  overflow: hidden;
}

.shop-item.is-folding {
  animation: shop-fold 0.32s cubic-bezier(0.4, 0, 0.6, 1) var(--tf, 0ms) forwards;
}

.shop-item.is-unfolding {
  animation: shop-fold 0.32s cubic-bezier(0.4, 0, 0.6, 1) var(--tf, 0ms) reverse backwards;
}

@keyframes shop-fold {
  from { max-height: var(--h, 48px); }
  to { max-height: 0; margin-bottom: -5px; opacity: 0; }
}

.shop-section.is-folding .shop-chevron {
  animation: shop-chevron-fold 0.32s ease var(--tf, 0ms) backwards;
}

.shop-section.is-unfolding .shop-chevron {
  animation: shop-chevron-fold 0.32s ease var(--tf, 0ms) reverse backwards;
}

@keyframes shop-chevron-fold {
  from { transform: none; }
  to { transform: rotate(-90deg); }
}

.shop-section-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.1rem;
  font-weight: 700;
}

/* Dotted line from the name to the count, like a heading in a notebook */
.shop-section-btn::after {
  content: "";
  order: 2;
  flex: 1;
  min-width: 12px;
  border-top: 2px dotted color-mix(in srgb, var(--c-shop) 45%, transparent);
}

.shop-section-alert {
  order: 3;
}

.shop-section-count {
  order: 4;
}

.shop-section-count {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0;
}

.shop-section-count svg {
  width: 12px;
  height: 12px;
}

.shop-section[data-done="true"] .shop-section-count {
  background: var(--c-shop);
  border-color: transparent;
  color: #FFFFFF;
}

.shop-section[data-done="true"] .shop-section-name {
  color: var(--muted);
}

/* --- Edit mode: same look as in the shop (rayon = header, item = card), plus tools --- */
.is-editing.shop-item {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 2px 4px 2px 0;
  /* Items: see-through, only outlined (the rayons are the white cards) */
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  border-radius: 10px;
}

/* Items that belong to a rayon are indented under it */
.is-editing.shop-item.in-section {
  margin-left: 18px;
}

.is-editing.shop-section {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin-top: 14px;
  padding: 2px 4px 2px 0;
  /* Rayons: white cards, with the same felt-tip stroke in the margin as outside edit mode */
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid color-mix(in srgb, var(--c-shop) 55%, transparent);
  border-radius: 10px;
}

.is-editing.shop-section:first-child {
  margin-top: 0;
}

.shop-kind-tag {
  flex-shrink: 0;
  padding: 1px 6px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.shop-handle {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 30px;
  align-self: stretch;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.sortable-chosen .shop-handle {
  cursor: grabbing;
}

.sortable-ghost {
  opacity: 0.35;
}

.shop-edit-name {
  flex: 1;
  min-width: 0;
  padding: 6px;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration: underline dotted var(--muted);
  text-underline-offset: 4px;
  color: var(--text);
}

.is-editing.shop-section .shop-edit-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.shop-edit-name:hover,
.shop-edit-name:active {
  transform: none;
  box-shadow: none;
  background: transparent;
  color: var(--text);
}

.shop-delete {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  /* Grey on every row (one-tap delete, with undo): red only under the finger */
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}

.shop-delete:hover {
  background: #FEE2E2;
  transform: none;
  box-shadow: none;
  color: var(--c-danger);
}

.shop-delete:active {
  background: #FECACA;
  transform: scale(0.95);
  box-shadow: none;
  color: var(--c-danger);
}

/* --- Quick add bar --- */
.shop-add {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: var(--kb-inset, 0px); /* stays above the on-screen keyboard (js/core/keyboard.js) */
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px max(16px, calc((100% - var(--page-width)) / 2 + 16px)) calc(12px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}

.shop-add textarea {
  flex: 1;
  min-height: 52px;
  max-height: 140px;
  resize: none;
  line-height: 1.4;
}

.shop-add textarea:focus {
  transform: none;
}

.shop-add button {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  box-shadow: var(--shadow-sm);
}

/* --- Hub: list cards --- */
.shop-lists {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.shop-list-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "name" "meta" "bar";
  align-items: center;
  gap: 4px 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.shop-list-card:hover {
  transform: none;
  box-shadow: var(--shadow-lg);
}

.shop-list-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.shop-list-name {
  grid-area: name;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-list-meta {
  grid-area: meta;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.shop-list-card .shop-progress {
  grid-area: bar;
  margin-top: 6px;
}

/* ⋯ menu of a list (copy, delete): sits where the arrow was, the menu reuses .weekend-menu */
.shop-list-item {
  position: relative;
}

.shop-list-card {
  padding-right: 56px;
}

/* --- Toast with an action (e.g. "Annuler") --- */
.toast-has-action {
  padding-right: 6px;
}

.toast-action {
  flex-shrink: 0;
  margin-left: 2px;
  padding: 5px 12px;
  background: color-mix(in srgb, var(--c-brand) 14%, transparent);
  border: 0;
  border-radius: 999px;
  box-shadow: none;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--c-brand);
}

/* List page header also holds the edit toggle: give the title the room */
@media (max-width: 480px) {
  body.shop-list .header-module-icon {
    display: none;
  }

  body.shop-list header h1 {
    font-size: 1.1rem;
  }
}

/* Rayon containing an item taken by several people (shown even when folded) */
.shop-section-alert {
  flex-shrink: 0;
  margin-right: 0;
  /* Same height as the "2/5" pill next to it, capitals centered (not the line box) */
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  line-height: 1;
  text-box: trim-both cap alphabetic;
}

/* --- Offline / sync --- */
.shop-sync {
  position: sticky;
  top: var(--shop-header-h, 80px);
  z-index: 9;
  margin: 0;
  padding: 7px max(16px, calc((100% - var(--page-width)) / 2 + 16px));
  background: var(--text);
  color: var(--card);
  font-size: 0.8rem;
  font-weight: 500;
}

.shop-sync[hidden] {
  display: none;
}

.shop-sync[data-state="syncing"] {
  background: var(--purple);
  color: var(--text);
}

/* Offline: the connection dot is not the only hint */
body.shop-offline .shop-edit-toggle:disabled {
  opacity: 0.45;
}

.shop-pending {
  flex-shrink: 0;
  color: var(--muted);
}

/* "Voir" from a conflict notification */
@keyframes shop-flash {
  0%, 100% { transform: none; }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.shop-item.is-flash .shop-row {
  animation: shop-flash 0.6s ease-in-out 2;
  outline: 3px solid var(--accent-soft-2);
  outline-offset: 2px;
}


/* ========== Trajets (transport) ========== */
/* The page reuses the Dépenses building blocks (body.paiements, .segmented,
   .expense-item, .pay-empty, .pay-fab, dialog.sheet, .chips). */

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.75rem;
  line-height: 1;
  color: var(--text);
}

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

/* Modes differ by pictogram, not by colour: other modules' colours would read as Courses / Dépenses */
.trip-icon[data-mode] { background: var(--accent-soft); color: var(--accent-text); }

/* Card: the clickable head is an .expense-item, extras sit under it */
.trip-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* My trips (driver, passenger or traveller) */
/* My trips: outlined in the colour of the page */
.trip-card.is-mine {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), var(--shadow-sm);
}

.trip-card .trip-head {
  align-items: flex-start;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.trip-card .trip-head:hover {
  transform: none;
  box-shadow: none;
  background: var(--surface);
  color: var(--text);
}

.trip-card .trip-head:active {
  transform: none;
  box-shadow: none;
  background: var(--taken-bg);
  color: var(--text);
}

.trip-card .expense-name {
  white-space: normal;
}

.trip-meta {
  white-space: normal;
}

.trip-route {
  color: var(--text);
  font-weight: 500;
}

.trip-route-time {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.trip-route-arrow {
  color: var(--muted);
}

.trip-time-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.trip-card .expense-amount {
  font-size: 1.3rem;
}

.trip-extra,
.trip-comments {
  padding: 10px 14px 12px;
  border-top: 1.5px dashed var(--border);
}

.trip-comments {
  display: grid;
  gap: 4px;
}

.trip-comment {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  font-style: italic;
  color: var(--muted);
}

.trip-comment strong {
  font-style: normal;
  color: var(--text);
}

/* Train / bus: a travel ticket. Main part (route) and stub (travellers) are two pieces of
   paper; each has two half-circle notches at the perforation, cut out with a mask. The
   shadow is a drop-shadow on the <li>, so it follows the notches. */
.trip-ticket {
  --paper: #FFFFFF;
  --stub-paper: color-mix(in srgb, var(--mod) 5%, #FFFEFB);
  --notch: 9px;
  filter: drop-shadow(0 1px 1px rgba(30, 34, 48, 0.08)) drop-shadow(0 6px 14px rgba(30, 34, 48, 0.08));
}

.trip-ticket-main,
.trip-ticket-main:hover,
.trip-ticket-main:active {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--paper);
  box-shadow: none;
  transform: none;
  font-family: var(--font-body);
  font-weight: 400;
  text-align: left;
  color: var(--text);
  -webkit-mask:
    radial-gradient(circle at 0 100%, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 100%, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at 0 100%, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 100%, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
}

.trip-ticket-main:active .trip-ticket-route {
  opacity: 0.65;
}

/* Coloured band at the top: mode, train number, "Ton billet" */
.trip-ticket-band {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--mod-grad);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.trip-ticket-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trip-ticket-no {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  opacity: 0.92;
}

.trip-ticket-no small {
  font-size: 0.7rem;
  opacity: 0.8;
}

.trip-ticket-mine {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--accent-text);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* My ticket is punched: a hole in the stub, bottom left (where the "Je prends" button is on the
   others). Just got on it (transport.js, .is-punching): the hole is punched, the ticket jolts and
   "Ton billet" lands like a stamp. The hole is a 3rd mask layer intersected with the notches. */
@property --punch {
  syntax: '<length>';
  inherits: true;
  initial-value: 0px;
}

.trip-ticket.is-mine .trip-ticket-stub {
  --punch: 6px;
  -webkit-mask:
    radial-gradient(circle at 26px calc(100% - 27px), transparent var(--punch), #000 calc(var(--punch) + 0.5px)),
    radial-gradient(circle at 0 0, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 0, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
  -webkit-mask-composite: source-in, source-over, source-over;
  mask:
    radial-gradient(circle at 26px calc(100% - 27px), transparent var(--punch), #000 calc(var(--punch) + 0.5px)),
    radial-gradient(circle at 0 0, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 0, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
  mask-composite: intersect, add, add;
}

.trip-ticket.is-punching {
  animation: ticket-jolt 0.4s ease-out calc(var(--t, 0ms) + 0.25s) backwards;
}

.trip-ticket.is-punching .trip-ticket-stub {
  animation: ticket-punch 0.18s cubic-bezier(0.5, 0, 0.7, 1.6) calc(var(--t, 0ms) + 0.25s) backwards;
}

.trip-ticket.is-punching .trip-ticket-mine {
  animation: ticket-stamp 0.4s cubic-bezier(0.3, 0, 0.3, 1.4) calc(var(--t, 0ms) + 0.4s) backwards;
}

@keyframes ticket-jolt {
  0% { transform: none; }
  25% { transform: translateY(3px) scale(0.99); }
  60% { transform: translateY(-1px); }
  100% { transform: none; }
}

@keyframes ticket-punch {
  from { --punch: 0px; }
  to { --punch: 6px; }
}

@keyframes ticket-stamp {
  from { transform: scale(1.7) rotate(-12deg); opacity: 0; }
  60% { opacity: 1; }
  to { transform: none; }
}

/* Route: departure | line | arrival, times big */
.trip-ticket-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 14px 16px 16px;
  transition: opacity 0.15s;
}

.trip-stop {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.trip-stop.is-arrival {
  text-align: right;
}

.trip-stop-time {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.trip-stop-time.is-unknown {
  color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.trip-stop-place {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.trip-ticket-line {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding-top: 6px;
}

/* Dotted track with the vehicle in the middle */
.trip-ticket-track {
  display: grid;
  place-items: center;
  width: 100%;
  height: 20px;
  background: radial-gradient(circle, var(--accent) 1.4px, transparent 1.8px) center / 7px 7px repeat-x;
  color: var(--accent);
}

.trip-ticket-track svg {
  padding: 0 4px;
  background: var(--paper);
  box-sizing: content-box;
}

.trip-ticket-dur {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* Stub: dashed perforation on top, notches at its two top corners */
.trip-ticket-stub {
  display: grid;
  gap: 6px;
  padding: 12px 16px 14px;
  border-radius: 0 0 16px 16px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--mod) 35%, #FFFFFF) 55%, transparent 0) top / 9px 1.5px repeat-x,
    var(--stub-paper);
  -webkit-mask:
    radial-gradient(circle at 0 0, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 0, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at 0 0, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 0, transparent var(--notch), #000 calc(var(--notch) + 0.5px)) right / 51% 100% no-repeat;
}

/* Travellers: a small table (name | coach | seat), each row edits that person's trip */
.trip-pax-head,
.trip-pax-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.2rem 4.2rem;
  align-items: center;
  gap: 6px;
}

.trip-pax-head.is-bus,
.trip-pax.is-bus .trip-pax-row {
  grid-template-columns: minmax(0, 1fr);
}

.trip-pax-head {
  padding: 0 6px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.trip-pax-head span + span {
  text-align: center;
}

.trip-pax {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.trip-pax-row,
.trip-pax-row:hover {
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  transform: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: left;
  color: var(--text);
}

.trip-pax-row:active {
  background: var(--accent-soft);
}

.trip-pax-name {
  display: grid;
  min-width: 0;
}

.trip-pax-from {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.trip-pax-cell {
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-align: center;
}

.trip-pax-cell.is-none {
  color: color-mix(in srgb, var(--muted) 55%, transparent);
}

/* My row without a seat yet: coach and seat typed right on the ticket */
.trip-pax-row.is-input {
  padding-block: 3px;
}

.trip-pax-name-btn,
.trip-pax-name-btn:hover {
  margin: -5px -6px;
  padding: 5px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  transform: none;
  font: inherit;
  text-align: left;
  color: inherit;
}

.trip-pax-name-btn:active {
  background: var(--accent-soft);
}

textarea.one-line.trip-pax-input {
  width: 100%;
  min-width: 0;
  height: 2.3rem;
  padding: 0 4px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
  font-family: var(--font-display);
  font-size: 1.05rem;
  /* One line exactly as tall as the box: the text sits in the middle */
  line-height: calc(2.3rem - 3px);
  text-align: center;
  color: var(--text);
}

textarea.one-line.trip-pax-input:focus {
  border-color: var(--accent);
  outline: none;
}

.trip-ticket .trip-comments {
  padding: 2px 6px;
  border: 0;
}

.trip-ticket-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

/* Decorative barcode */
.trip-barcode {
  flex-shrink: 0;
  width: 64px;
  height: 26px;
  margin-left: auto;
  opacity: 0.55;
  background: linear-gradient(90deg,
    var(--text) 0 2px, transparent 0 4px, var(--text) 0 5px, transparent 0 8px,
    var(--text) 0 11px, transparent 0 12px, var(--text) 0 13px, transparent 0 16px,
    var(--text) 0 17px, transparent 0 19px, var(--text) 0 22px, transparent 0 23px,
    var(--text) 0 24px, transparent 0 27px, var(--text) 0 29px, transparent 0 30px,
    var(--text) 0 31px, transparent 0 34px, var(--text) 0 37px, transparent 0 38px,
    var(--text) 0 39px, transparent 0 41px, var(--text) 0 42px, transparent 0 45px,
    var(--text) 0 47px, transparent 0 48px, var(--text) 0 49px, transparent 0 52px,
    var(--text) 0 55px, transparent 0 56px, var(--text) 0 57px, transparent 0 59px,
    var(--text) 0 60px, transparent 0 62px, var(--text) 0 64px);
}

/* --- Import from SNCF Connect --- */
/* Shortcut at the top of the trip form (train) */
.import-cta,
.import-cta:hover {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 14px;
  background: var(--accent-soft);
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  color: var(--text);
}

.import-cta[hidden] {
  display: none;
}

.import-cta strong {
  display: block;
  font-size: 0.95rem;
  color: var(--accent-text);
}

.import-cta-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--mod-grad);
  color: #FFFFFF;
}

.import-cta-text {
  flex: 1;
  min-width: 0;
}

.import-cta-arrow {
  font-size: 1.5rem;
  color: var(--accent-text);
}

/* Second way in, under "Ajouter mon trajet" of the empty list */
.import-empty,
.import-empty:hover {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.import-help {
  display: grid;
  gap: 12px;
}

.import-help[hidden] {
  display: none;
}

.import-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 500;
}

.import-steps li {
  counter-increment: step;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.import-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-text);
  transform: translateY(-1px);
}

.import-paste {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--mod-grad);
}

.import-paste[hidden] {
  display: none;
}

.import-text {
  min-height: 4.5em;
  font-size: 0.85rem;
  resize: vertical;
}

.trip-hint.is-error {
  color: #B3261E;
}

.import-legs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.import-legs:empty {
  display: none;
}

.import-leg {
  display: grid;
  gap: 8px;
}

/* Preview ticket: the list's ticket, smaller, not clickable */
.trip-ticket.is-preview {
  --notch: 7px;
}

.trip-ticket.is-preview .trip-ticket-route {
  padding: 10px 14px 12px;
}

.trip-ticket.is-preview .trip-stop-time {
  font-size: 1.3rem;
}

.trip-ticket.is-preview .trip-ticket-main:only-child {
  border-radius: 16px;
  -webkit-mask: none;
  mask: none;
}

.trip-ticket.is-preview .trip-ticket-stub {
  padding: 8px 14px 10px;
}

.trip-ticket-date {
  margin-left: auto;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.import-leg-details {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.import-leg-details strong {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
}

/* "Pour Weekend à Arbonne · Changer de weekend" (trip shared from SNCF Connect) */
.import-weekend {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.import-weekend strong {
  color: var(--text);
}

.import-weekend a {
  color: var(--accent-text);
  font-weight: 700;
}

/* --- Page "Voyage partagé" (/partage) --- */
.share-page {
  display: grid;
  gap: 22px;
}

.share-page [hidden] {
  display: none;
}

.share-weekends {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.share-weekend,
.share-weekend:hover {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius, 16px);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-body);
  font-weight: 400;
  text-align: left;
  color: var(--text);
}

.share-weekend.is-match {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), var(--shadow-sm);
}

.share-weekend-main {
  display: grid;
  flex: 1;
  min-width: 0;
}

.share-weekend-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.share-weekend-date {
  font-size: 0.85rem;
  color: var(--muted);
}

.share-weekend-date::first-letter {
  text-transform: uppercase;
}

.share-weekend-badge {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-text);
  white-space: nowrap;
}

.share-weekend-arrow {
  font-size: 1.5rem;
  color: var(--muted);
}

/* Join sheet */
.join-summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.join-summary-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 0.9rem;
}

.join-with {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.join-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--conflict-bg);
  font-size: 0.85rem;
  font-weight: 500;
}

.join-note[hidden] {
  display: none;
}

/* Place autocomplete */
.ac-wrap {
  position: relative;
}

.ac-list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
}

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

.ac-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

.ac-item:hover,
.ac-item[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--text);
}

.ac-icon {
  display: grid;
  flex-shrink: 0;
  color: var(--muted);
}

.ac-label {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* In the trip form, the list spans the place + time row */
.trip-place .ac-list {
  right: calc(-7.5rem - 8px);
}

.ac-hint {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

/* Carpooling */
.trip-car {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.trip-car-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.trip-seats {
  display: inline-flex;
  gap: 3px;
}

.trip-seat {
  width: 14px;
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}

.trip-seat.is-taken {
  background: var(--accent);
}

.trip-seats-left {
  font-size: 0.85rem;
  font-weight: 700;
}

.trip-seats-left.is-full {
  color: var(--muted);
  font-weight: 500;
}

.trip-passengers {
  flex-basis: 100%;
  order: 3;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

/* Getting on or off a car, a train, a bus: one pill, pictogram of the mode first.
   Getting on = soft fill of the module; getting off = same pill, outlined */
.trip-join {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: var(--accent-soft);
  box-shadow: none;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.trip-join svg {
  flex-shrink: 0;
}

.trip-join.is-leave {
  background: transparent;
  border-color: var(--border);
}

/* Form */
.trip-modes .segmented-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.trip-modes .segmented-btn svg {
  flex-shrink: 0;
}

.trip-place-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem;
  gap: 8px;
}

.trip-seat-row {
  grid-template-columns: 1fr 1fr;
}

.trip-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

/* Seats stepper: the Dépenses stepper, a bit larger for the thumb */
.trajets .stepper button {
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
}

.trajets .stepper-value {
  min-width: 44px;
  font-size: 1.3rem;
}

/* The global date style stretches the (invisible) calendar button over its
   nearest positioned ancestor: keep it inside the date field, otherwise it
   covers the whole sheet and steals taps (e.g. on "Ajouter"). */
.trajets input[type=date] {
  position: relative;
}

/* --- "Ajouter des participants" sheet (weekend hub) --- */
.add-input-row {
  display: flex;
  gap: 10px;
}

.add-input-row input, .add-input-row textarea {
  flex: 1;
  min-width: 0;
}

.add-name-btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 52px;
  padding: 0;
  box-shadow: var(--shadow-sm);
}

.add-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.add-hint:empty {
  display: none;
}

.add-hint.is-warning {
  color: #B45309;
  font-weight: 700;
}

.add-pending {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.add-pending:empty {
  display: none;
}

/* Names about to be added: same pill as the list, dashed (not added yet) */
.add-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 4px 0 5px;
  background: var(--surface);
  border: 1.5px dashed color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.add-chip-remove {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  box-shadow: none;
  font-size: 1.2rem;
  line-height: 1;
  text-transform: none;
  color: var(--text);
}

.add-chip-remove:hover,
.add-chip-remove:active {
  background: rgba(0, 0, 0, 0.1);
  transform: none;
  box-shadow: none;
  color: var(--text);
}

/* Version of the installed app (home page), to check an update arrived */
.app-version {
  margin: 32px 0 8px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}
.app-version { cursor: pointer; }
.app-version[data-debug="on"]::after { content: " · diagnostic activé"; }

/* Diagnostic badge (tap the version on the home page to toggle) */
.perf-badge {
  position: fixed;
  left: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 1000;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--text);
  color: var(--surface);
  font: 600 0.7rem/1.3 var(--font-body);
  opacity: 0.85;
  pointer-events: none;
}

/* Category bars (Bilan): the bar takes the colour of the icon glyph, not its pale background */
.family-track > [data-family] {
  background: currentColor;
  border: 0;
}

/* =====================================================================
   Dark theme. <html data-theme="dark"> is set by the inline script of
   index.html (no flash) and kept up to date by shared/theme.js: the
   home page button chooses Auto (phone setting) / Clair / Sombre.
   Night blue ("ink") lit in the corners by the module colours,
   dark cards, the module gradients unchanged. The train ticket and the
   receipt stay paper, a dark one.
   ===================================================================== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #0C1026;
  --card: rgba(24, 29, 56, 0.84);
  --surface: #1C2140;
  --text: #ECEEF7;
  --muted: #9AA2C2;

  --green: #183A2B;
  --green-strong: #3FC487;
  --pink: #44202F;
  --purple: #2C2550;
  --mint: color-mix(in srgb, var(--c-shop) 22%, var(--ink));
  --teal: color-mix(in srgb, var(--c-trip) 22%, var(--ink));

  --line: rgba(200, 210, 255, 0.08);
  --border: rgba(200, 210, 255, 0.18);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  --taken-bg: rgba(255, 255, 255, 0.04);
  --conflict-bg: #3A2A12;
}

/* Night blue background, lit in the corners by the module colours (sharp halos, the middle
   where the lists are stays night blue). An orange halo on a near-black grey turned brown:
   on night blue it stays a colour. */
:root[data-theme="dark"] body {
  --tint: color-mix(in srgb, var(--mod) 4%, #0E1330);
  --accent-soft: color-mix(in srgb, var(--mod) 22%, #161B38);
  --accent-soft-2: color-mix(in srgb, var(--mod) 34%, #161B38);
  --accent-text: color-mix(in srgb, var(--mod-glow) 65%, #FFFFFF);
  --halo1: var(--mod);
  --halo2: var(--mod-glow);
  --halo3: var(--mod-deep);
}

/* Home, hub: the pink of the sunset first, orange second, violet at the bottom */
:root[data-theme="dark"] body:is(.home, .weekend-hub) { --halo1: var(--mod-glow); --halo2: var(--mod); --halo3: #6C5CE6; }
:root[data-theme="dark"] body:is(.shop-hub, .shop-list) { --halo3: #2FB59A; }

:root[data-theme="dark"],
:root[data-theme="dark"] body {
  background: var(--ink);
}

:root[data-theme="dark"] body::before,
:root[data-theme="dark"] body.weekend-hub::before {
  background:
    radial-gradient(70% 45% at 0% 0%, color-mix(in srgb, var(--halo1) 46%, transparent) 0, transparent 100%),
    radial-gradient(60% 35% at 100% 38%, color-mix(in srgb, var(--halo2) 30%, transparent) 0, transparent 100%),
    radial-gradient(80% 40% at 35% 100%, color-mix(in srgb, var(--halo3) 40%, transparent) 0, transparent 100%),
    linear-gradient(180deg, #10153A 0%, #090C1F 100%);
}

:root[data-theme="dark"] header {
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

/* Paper: train ticket (top a bit lighter than the cards, stub tinted) and receipt */
:root[data-theme="dark"] .trip-ticket {
  --paper: #232846;
  --stub-paper: color-mix(in srgb, var(--mod) 7%, #1C2140);
}

:root[data-theme="dark"] .trip-ticket-stub {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--mod) 55%, var(--ink)) 55%, transparent 0) top / 9px 1.5px repeat-x,
    var(--stub-paper);
}

:root[data-theme="dark"] .trip-ticket-mine {
  background: var(--ink);
  color: #FFFFFF;
}

:root[data-theme="dark"] .expense-ticket { background: #1F2441; }
:root[data-theme="dark"] .expense-ticket .expense-group + .expense-group { border-top-color: rgba(255, 255, 255, 0.14); }
:root[data-theme="dark"] .expense-ticket .expense-items > li + li { border-top-color: rgba(255, 255, 255, 0.09); }
:root[data-theme="dark"] .expense-ticket .is-transfer .cat-icon { background: var(--ink); }

/* Category icons: dark tint, light pictogram */
:root[data-theme="dark"] :is([data-cat="groceries"], [data-family="groceries"]) { color: #6FD3A2; }
:root[data-theme="dark"] :is([data-cat="transport"], [data-family="transport"]) { color: #7CC4F2; }
:root[data-theme="dark"] :is([data-cat="lodging"], [data-family="lodging"]) { color: #BBA5FA; }
:root[data-theme="dark"] [data-family="food"] { color: #F48FB6; }
:root[data-theme="dark"] :is([data-cat="activity"], [data-family="activity"]) { background: #3B2C14; color: #F2B25C; }
:root[data-theme="dark"] :is([data-cat="other"], [data-family="other"], [data-cat="none"], [data-family="none"]) { background: #262B4A; }
:root[data-theme="dark"] :is([data-cat="transfer"], [data-family="transfer"]) { background: var(--surface); }
:root[data-theme="dark"] [data-cat="settled"] { color: #3FC487; }

/* On the module gradient (summary card): a dark pill, never a white one */
:root[data-theme="dark"] .pay-summary-link.is-todo {
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  color: #FFFFFF;
}

/* Light-only details */
:root[data-theme="dark"] .weekend-item.is-due .weekend-link { background: var(--card); }
:root[data-theme="dark"] :is(.soon-badge, .module-badge) { color: #BBA5FA; }
:root[data-theme="dark"] .weekend-menu-btn:active { background: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .module-card .module-status[data-tone] { background: color-mix(in srgb, var(--mod-c, #646A7B) 24%, var(--ink)); }
:root[data-theme="dark"] .module-card .module-status[data-tone="empty"] { background: color-mix(in srgb, var(--mod-c, #646A7B) 14%, var(--ink)); color: color-mix(in srgb, var(--mod-g, #9AA2C2) 60%, #FFFFFF); }
:root[data-theme="dark"] .module-card:is(.transport, .shopping, .payments, .lodging) { --veil: 26%; --mod-ink: color-mix(in srgb, var(--mod-g) 55%, #FFFFFF); --icon-glow: color-mix(in srgb, var(--mod-c) 55%, transparent); }
:root[data-theme="dark"] :is(.btn-delete:hover, .shop-delete:hover) { background: #4A1D1D; }
:root[data-theme="dark"] .shop-delete:active { background: #5C2222; }
:root[data-theme="dark"] .btn-secondary:hover { background: rgba(255, 255, 255, 0.06); }
:root[data-theme="dark"] .icon-pick::after {
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .person-dot { background: color-mix(in srgb, var(--p) 26%, var(--ink)); color: color-mix(in srgb, var(--p) 55%, #FFFFFF); }
:root[data-theme="dark"] :is(.balance-bar, .shop-progress) { background: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .sheet-close { background: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .shop-badge { background: #4A3212; color: #FFD08A; }
:root[data-theme="dark"] .trip-hint.is-error { color: #FF8A80; }
:root[data-theme="dark"] .add-hint.is-warning { color: #F2B25C; }
:root[data-theme="dark"] .add-chip-remove:active { background: rgba(255, 255, 255, 0.1); }
:root[data-theme="dark"] .shop-add { background: var(--surface); }
:root[data-theme="dark"] [data-tone="negative"] .balance-value,
:root[data-theme="dark"] .cost-figures dd[data-tone="negative"] { color: #F48FB6; }
:root[data-theme="dark"] [data-tone="positive"] .balance-value,
:root[data-theme="dark"] .cost-figures dd[data-tone="positive"] { color: #3FC487; }
:root[data-theme="dark"] .money-badge[data-tone="ok"] { color: #6FD3A2; }
:root[data-theme="dark"] .weekend-cta { color: #F48FB6; }
:root[data-theme="dark"] :is(.money-badge[data-tone="owed"] + .weekend-cta, .module-status[data-tone="ok"]) { color: #6FD3A2; }
:root[data-theme="dark"] { --c-danger: #FF6B6B; }
:root[data-theme="dark"] :is(input, textarea):focus { background: var(--surface); }
:root[data-theme="dark"] .btn-secondary { background: var(--surface); }
:root[data-theme="dark"] :is(.settle-filter button[aria-pressed="true"], .settle-filter button[aria-pressed="true"]:hover) { color: var(--ink); }
