/* Lifeqora's look: the family's shared fridge door.
   Quiet system type and controls everywhere; the brand lives in one place – a chore that is done
   blooms into the Lifeqora flower. Loaded last, after every other stylesheet. */
:root {
  --display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Spring curves sampled from a damped spring (response .3–.38 s). CSS transitions retarget from
     the current value, so a spring can always be interrupted mid-move. */
  --spring: linear(0, .047, .156, .292, .431, .56, .673, .766, .839, .896, .937, .966, .986, .999, 1.006, 1.01, 1.011, 1.011, 1.01, 1.008, 1.007, 1.005, 1.004, 1.003, 1.002, 1.001, 1.001, 1, 1);
  --spring-smooth: linear(0, .042, .136, .25, .367, .476, .573, .656, .726, .783, .83, .867, .897, .92, .938, .953, .964, .972, .979, .984, .988, .991, .993, .995, .996, .997, .998, .998, 1);
  --spring-bloom: linear(0, .054, .185, .353, .529, .691, .828, .936, 1.012, 1.061, 1.087, 1.095, 1.09, 1.078, 1.063, 1.046, 1.03, 1.017, 1.007, .999, .995, .992, .991, .991, .992, .994, .996, .997, 1);
  --seg-track: #ecebef;
  --track: #eee9f4;
  --seg-on: #ffffff;
  --seg-text: #57505f;
  --seg-text-on: #2b2733;
  --ring: #8c8495;          /* unticked checkbox ring, 3.6:1 on white */
  --field-line: #8f8899;    /* text field edge, 3.1:1 on the page and 3.4:1 on a card */
  --gold-bg: #fcf0d9; --gold-ink: #7a4b08;   /* points: 6.6:1 */
  --bloom-bg: #fff3ee;
  --sheet-bg: #ffffff;
  --grabber: #c9c4cf;
  --avatar-ink: #5e4683;
}
:root[data-theme="dark"] {
    --seg-track: #2a282e;
    --track: #3b3742;   /* progress bars: the empty part stays visible on dark cards */
    --seg-on: #3a3740;
    --seg-text: #c4bfca;
    --seg-text-on: #f4f2f6;
    --ring: #8f8899;        /* 4.0:1 on the dark card */
    --field-line: #7a7484;  /* 3.2–3.8:1 on the dark surfaces */
    --gold-bg: #3b2d12; --gold-ink: #f3c879;
    --bloom-bg: #3a2620;
    --sheet-bg: #232126;
    --grabber: #5c5763;
    --avatar-ink: #ddd0f2;

  --person-0: #73a9f9; --person-0-tint: #22334c; --person-0-ink: #c6e0ff;
  --person-1: #6abe78; --person-1-tint: #203a24; --person-1-ink: #c4eac8;
  --person-2: #d79b3c; --person-2-tint: #422f13; --person-2-ink: #f6d9b2;
  --person-3: #e584b0; --person-3-tint: #462835; --person-3-ink: #ffcee2;
  --person-4: #00bece; --person-4-tint: #093a3f; --person-4-ink: #b0eaf1;
  --person-5: #ca8cdc; --person-5-tint: #3d2a43; --person-5-ink: #efd2f8;
  --person-6: #a1b24c; --person-6-tint: #303617; --person-6-ink: #dae4b7;
  --person-7: #e98d5b; --person-7-tint: #482b1b; --person-7-ink: #ffd3bc;
  --person-8: #3cb5eb; --person-8-tint: #143748; --person-8-ink: #b7e6ff;
  --person-9: #31c29e; --person-9-tint: #123b30; --person-9-ink: #b6ecd9;
  --person-10: #a09bf6; --person-10-tint: #302f4b; --person-10-ink: #d9d9ff;
  --person-11: #ee8582; --person-11-tint: #492827; --person-11-ink: #ffcfcc;
}
:root[data-theme="dark"] .brand-logo { content: url("/assets/lifeqora-logo-dark.svg"); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --seg-track: #2a282e;
    --track: #3b3742;   /* progress bars: the empty part stays visible on dark cards */
    --seg-on: #3a3740;
    --seg-text: #c4bfca;
    --seg-text-on: #f4f2f6;
    --ring: #8f8899;        /* 4.0:1 on the dark card */
    --field-line: #7a7484;  /* 3.2–3.8:1 on the dark surfaces */
    --gold-bg: #3b2d12; --gold-ink: #f3c879;
    --bloom-bg: #3a2620;
    --sheet-bg: #232126;
    --grabber: #5c5763;
    --avatar-ink: #ddd0f2;

  --person-0: #73a9f9; --person-0-tint: #22334c; --person-0-ink: #c6e0ff;
  --person-1: #6abe78; --person-1-tint: #203a24; --person-1-ink: #c4eac8;
  --person-2: #d79b3c; --person-2-tint: #422f13; --person-2-ink: #f6d9b2;
  --person-3: #e584b0; --person-3-tint: #462835; --person-3-ink: #ffcee2;
  --person-4: #00bece; --person-4-tint: #093a3f; --person-4-ink: #b0eaf1;
  --person-5: #ca8cdc; --person-5-tint: #3d2a43; --person-5-ink: #efd2f8;
  --person-6: #a1b24c; --person-6-tint: #303617; --person-6-ink: #dae4b7;
  --person-7: #e98d5b; --person-7-tint: #482b1b; --person-7-ink: #ffd3bc;
  --person-8: #3cb5eb; --person-8-tint: #143748; --person-8-ink: #b7e6ff;
  --person-9: #31c29e; --person-9-tint: #123b30; --person-9-ink: #b6ecd9;
  --person-10: #a09bf6; --person-10-tint: #302f4b; --person-10-ink: #d9d9ff;
  --person-11: #ee8582; --person-11-tint: #492827; --person-11-ink: #ffcfcc;
  }
  :root[data-theme="auto"] .brand-logo { content: url("/assets/lifeqora-logo-dark.svg"); }
}

/* ---------- Every person has a colour: avatar, name dot, calendar, tasks ----------
   Colours follow the order people joined the household (cloud.js personIndex). People can choose their own colour in
   Indstillinger (lq_members.color, unique in the household); the rest get the first free one. Ink on tint is 6.3–7.2:1; dots are ≥3.5:1. */
:root {
  --person-0: #4d86d9; --person-0-tint: #dfeeff; --person-0-ink: #264f8b;  /* Blå */
  --person-1: #3f9c53; --person-1-tint: #def4e0; --person-1-ink: #175f2a;  /* Grøn */
  --person-2: #b67700; --person-2-tint: #fbead4; --person-2-ink: #724400;  /* Rav */
  --person-3: #c45f8f; --person-3-tint: #ffe4ef; --person-3-ink: #7b3256;  /* Rosa */
  --person-4: #009dae; --person-4-tint: #d3f4f8; --person-4-ink: #005f6c;  /* Petrol */
  --person-5: #a968bc; --person-5-tint: #f7e6fc; --person-5-ink: #683976;  /* Lilla */
  --person-6: #7f9110; --person-6-tint: #eaf0d6; --person-6-ink: #4b5700;  /* Oliven */
  --person-7: #c86830; --person-7-tint: #ffe6d9; --person-7-ink: #7e390b;  /* Orange */
  --person-8: #0093cb; --person-8-tint: #d7f2ff; --person-8-ink: #005881;  /* Himmel */
  --person-9: #00a07c; --person-9-tint: #d6f5ea; --person-9-ink: #006249;  /* Mint */
  --person-10: #7f78d6; --person-10-tint: #eaeaff; --person-10-ink: #4b4589;  /* Indigo */
  --person-11: #cd5f5f; --person-11-tint: #ffe4e2; --person-11-ink: #813233;  /* Rød */
}
.person-avatar { background: var(--pc-tint, var(--lavender-light)); color: var(--pc-ink, var(--avatar-ink)) !important; }
/* Inline, so the name sits on the same line as the text around it (inline-flex lifted it). */
.person-name { display: inline; white-space: nowrap; }
.person-name > i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: var(--pc); vertical-align: middle; position: relative; top: -1px; }
.point-person.selected { border-color: var(--pc, var(--line)); }
.point-person .point-balance, .point-person strong + span { color: var(--pc-ink, inherit); }
.task[style*="--pc"] { box-shadow: inset 3px 0 0 var(--pc); padding-left: 12px; }
#sidebar-avatar.person-avatar, #profile.person-avatar { background: var(--pc-tint); color: var(--pc-ink); }

/* ---------- Type: system type for reading, rounded numerals for the family's numbers ---------- */
h1, h2, .dashboard-greeting h1, .page-heading h1, .metric-value, .budget-stat-value, .bo-hero-amount,
.point-balance, .household-scoreboard .point-balance, .reward-bottom strong, .shop-balance strong,
.goal-value strong, .habit-value, .habit-today-summary > strong, .dashboard-goal-value, .point-person strong + span,
.completion-feedback strong {
  font-family: var(--display);
}
.metric-value, .budget-stat-value, .bo-hero-amount, .point-balance, .reward-bottom strong, .shop-balance strong,
.goal-value strong, .dashboard-goal-value { font-variant-numeric: tabular-nums; }
h1, .page-heading h1, .dashboard-greeting h1 { letter-spacing: -.02em; font-weight: 700; }

/* Labels that only decorate go: no shouting eyebrows, no repeated logo, no tagline footer. */
.greeting-date, .welcome-date, .nav-label, .eyebrow, .member-table td[data-label]::before {
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
#dialog .modal-heading .eyebrow, .mobile-menu-heading .eyebrow { display: none; }
.greeting-flower, .greeting-dot, .sidebar .quote, .app-shell > footer, body > footer { display: none; }

/* Summary cards: the number leads, the card hugs its content. */
.metric { min-height: 0; }
.dashboard-metric .metric-foot { min-height: 0; }
.metric-value { margin-top: 14px; }

/* ---------- One segmented control style: neutral track, the selection carries the meaning ---------- */
.tabs, .budget-tabs, .task-tabs, .view-toggle { background: var(--seg-track); }
.tabs button, .budget-tabs button, .task-tabs button { color: var(--seg-text); font-weight: 550; }
.tabs button.selected, .budget-tabs button.active, .task-tabs button.active {
  background: var(--seg-on); color: var(--seg-text-on); box-shadow: 0 1px 2px #0000001a, 0 0 0 .5px #0000000d;
}
/* On a phone the status filter wraps instead of hiding "Sprunget over" and "Alle" off-screen. */
@media (max-width: 650px) {
  .task-list-toolbar .tabs { flex-wrap: wrap; overflow: visible; }
}

/* ---------- Press states: react on press, spring back on release, interruptible ---------- */
.button, .nav-item, .mobile-navigation button, .tabs button, .budget-tabs button, .task-tabs button,
.icon-button, .point-person, .reward-card, .cal-day, .bo-month-link {
  transition: transform .45s var(--spring), background-color .15s, border-color .15s, color .15s, box-shadow .2s;
}
.button:active:not(:disabled), .nav-item:active, .mobile-navigation button:active, .tabs button:active,
.budget-tabs button:active, .task-tabs button:active, .icon-button:active, .point-person:active,
.cal-day:active, .bo-month-link:active {
  transform: scale(.96); transition-duration: .06s, .06s, .06s, .06s, .06s;
}
/* No lifting on hover: hover is frequent, and on touch screens it sticks after a tap. */
.button.primary:hover:not(:disabled):not(:active), .reward-card:hover { transform: none; }
.button.primary:active:not(:disabled) { transform: scale(.96); }

/* ---------- Signature: a done chore blooms into the Lifeqora flower ---------- */
.check {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--ring); background: transparent center / 0 no-repeat;
  display: inline-grid; place-items: center; position: relative; cursor: pointer;
  transition: transform .45s var(--spring), border-color .2s, background-color .2s;
}
.check::before {
  content: ""; width: 100%; height: 100%; grid-area: 1 / 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23e2694a' d='M46 4C22.8 4 4 22.8 4 46C27.2 46 46 27.2 46 4Z'/%3E%3Cpath fill='%23a090c8' d='M54 4C77.2 4 96 22.8 96 46C72.8 46 54 27.2 54 4Z'/%3E%3Cpath fill='%23a090c8' d='M4 54C4 77.2 22.8 96 46 96C46 72.8 27.2 54 4 54Z'/%3E%3Cpath fill='%23e2694a' d='M54 96C77.2 96 96 77.2 96 54C72.8 54 54 72.8 54 96Z'/%3E%3C/svg%3E") center / 78% no-repeat;
  transform: scale(0) rotate(-90deg); opacity: 0;
  transition: transform .6s var(--spring-bloom), opacity .15s;
}
.check:checked { border-color: transparent; background-color: var(--bloom-bg); }
.check:checked::after { content: none; }   /* the flower replaces the old tick */
.check:checked::before { transform: scale(1) rotate(0); opacity: 1; }
.check:active:not(:disabled) { transform: scale(.86); transition-duration: .06s; }
.check:focus-visible { outline: 3px solid var(--k-fg-8971b4, #8971b4); outline-offset: 3px; }
.check:disabled:not(:checked) { opacity: .45; cursor: default; }
.task-pending .check { border-style: dashed; border-color: var(--k-fg-b1864d, #b1864d); opacity: 1; }
.subtask .check { width: 22px; height: 22px; }
@media (max-width: 650px) { .task-check-target .check { width: 28px; height: 28px; } }

/* ---------- Completion feedback springs in from where the eye already is ---------- */
.completion-feedback { transition: opacity .2s, transform .5s var(--spring); }
@media (max-width: 900px) { .completion-feedback { left: 50%; } }

/* ---------- Phone: forms open as a bottom sheet with a grabber (see sheet.js) ---------- */
.sheet-grabber { display: none; }
@media (max-width: 650px) {
  #dialog.as-sheet {
    margin: auto 0 0; width: 100%; max-width: none; max-height: calc(100dvh - 44px);
    border-radius: 22px 22px 0 0; border-bottom: 0; padding: 8px 20px calc(18px + env(safe-area-inset-bottom));
    background: var(--sheet-bg); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y pinch-zoom;
  }
  #dialog.as-sheet .sheet-grabber {
    display: block; position: sticky; top: 0; z-index: 2; height: 26px; margin: -8px -20px 18px;
    background: var(--sheet-bg); touch-action: none; cursor: grab;
  }
  #dialog.as-sheet .sheet-grabber::after {
    content: ""; position: absolute; left: 50%; top: 9px; width: 38px; height: 5px; margin-left: -19px;
    border-radius: 3px; background: var(--grabber);
  }
  #dialog.as-sheet .modal-heading { touch-action: none; }
}

/* ---------- Comfortable targets on touch ---------- */
@media (pointer: coarse) {
  .button, .action-button, .heading-actions .button { min-height: 44px; }
}

/* ---------- Reduced motion: no springs, no bloom spin, sheets fade ---------- */
@media (prefers-reduced-motion: reduce) {
  .check::before { transform: none; }
  .check:not(:checked)::before { opacity: 0; }
}

/* ---------- Colour means one thing ---------- */
/* Calendar colour marks which calendar an event belongs to (the bar); the time itself is text. */
.cal-event-time, .cal-chip strong { color: var(--ink); }
/* The budget's first figure was white on a coral card (2.6:1). Coral is for actions; the card is a card. */
.budget-stats > .card:first-child { background: var(--bloom-bg); border-color: var(--line); color: var(--ink); }
.budget-stats > .card:first-child .metric-label, .budget-stats > .card:first-child .metric-foot { color: var(--muted); }

/* ---------- Phone: the primary action leads the greeting's actions ---------- */
@media (max-width: 650px) {
  .greeting-side .heading-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .greeting-side .heading-actions .button.primary { grid-column: 1 / -1; order: -1; }
}

/* Initials and counters read at 4.5:1 or better on their tinted chips. */
.point-avatar, .count-bubble { color: var(--avatar-ink); }
.cal-view-switch button { color: var(--seg-text); }

/* ---------- Indstillinger › Udseende ---------- */
.theme-choice { display: inline-flex; gap: 3px; padding: 3px; border-radius: 11px; background: var(--seg-track); margin: 4px 0 10px; }
.theme-choice button { min-height: 40px; min-width: 96px; padding: 8px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--seg-text); font-weight: 550;
  transition: transform .45s var(--spring), background-color .15s, color .15s; }
.theme-choice button.selected { background: var(--seg-on); color: var(--seg-text-on); box-shadow: 0 1px 2px #0000001a, 0 0 0 .5px #0000000d; }
.theme-choice button:active { transform: scale(.96); transition-duration: .06s; }
.person-color-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); }
.person-color-row .point-avatar { width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; font-weight: 650; flex-shrink: 0; }
@media (max-width: 650px) { .theme-choice { display: flex; } .theme-choice button { flex: 1; min-width: 0; } }

/* ---------- Colour picker (Indstillinger › Din farve, Husstanden › Skift farve) ---------- */
.color-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 6px; }
.color-swatch { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 8px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--ink); font-size: .875rem; text-align: left; transition: transform .45s var(--spring), border-color .15s; }
.color-swatch i { width: 18px; height: 18px; border-radius: 50%; background: var(--sw); flex-shrink: 0; }
.color-swatch span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-swatch.selected { border: 2px solid var(--sw); padding: 7px 7px; font-weight: 650; }
.color-swatch.selected i { box-shadow: inset 0 0 0 3px var(--paper); border: 2px solid var(--sw); }
.color-swatch:disabled { opacity: 1; cursor: default; color: var(--muted); }
.color-swatch:disabled i { opacity: .45; }
.color-swatch:active:not(:disabled) { transform: scale(.96); transition-duration: .06s; }
.color-link { display: block; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--k-fg-6d538e, #6d538e); font-size: .8125rem; text-decoration: underline; text-underline-offset: 2px; min-height: 24px; }

/* ---------- Rewards: the gift sits in the middle of its circle ---------- */
.reward-art-orbit { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.reward-art::after { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.reward-art-icon { display: grid; place-items: center; transform: none; }
.reward-art-icon .ui-icon { transform: rotate(-8deg); }

/* ---------- Calendar list: "+ Ny kalender" gets its own line instead of being squeezed ---------- */
.cal-sidebar-heading { flex-wrap: wrap; row-gap: 10px; }
.cal-sidebar-heading h2 { margin: 0; }
.cal-sidebar-heading .button { flex: 1 0 auto; white-space: nowrap; }

/* ---------- Front page appointments: Mine / Hele husstanden, and what's coming ---------- */
.dashboard-scope { margin: 2px 0 14px; }
.dashboard-scope button { min-width: 0; }
.dashboard-upcoming-title { font-size: .9375rem; margin: 18px 0 8px; }
.dashboard-upcoming { display: grid; gap: 6px; }
.dashboard-upcoming-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px;
  border: 0; border-left: 3px solid var(--cal-color); border-radius: 8px; background: var(--k-bg-faf8fc, #faf8fc); color: var(--ink); text-align: left;
  transition: transform .45s var(--spring), background-color .15s; }
.dashboard-upcoming-row:active { transform: scale(.98); transition-duration: .06s; }
.dashboard-upcoming-day { color: var(--muted); font-size: .8125rem; font-weight: 600; text-transform: capitalize; }
.dashboard-upcoming-text strong { display: block; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-upcoming-text small { color: var(--muted); font-size: .8125rem; }
.dashboard-upcoming-day { text-transform: none; }
.dashboard-upcoming-day::first-letter { text-transform: uppercase; }
/* Cards on the front page hug their content instead of stretching to the tallest neighbour. */
.personal-dashboard-grid > .dashboard-kind-calendar, .personal-dashboard-grid > .dashboard-kind-tasks, .personal-dashboard-grid > .dashboard-kind-goals { align-self: start; }

/* ---------- Tasks in narrow cards: the buttons move under the task instead of squeezing the title ---------- */
.dashboard-widget, .stack > .card, main > article.card { container-type: inline-size; }
@container (max-width: 620px) {
  .task-primary { flex-wrap: wrap; }
  .task-primary { flex-wrap: wrap; align-items: flex-start; }
  .task-primary > .task-check-target { flex: 0 0 auto; }
  .task-primary .task-body { flex: 1 1 0; min-width: 0; }
  .task-row-actions { flex: 0 0 100%; max-width: none !important; width: auto; margin-left: 0; justify-content: flex-start; flex-wrap: wrap; padding-left: 42px; }
}

/* Text for screen readers only (the month picker's arrows and value already say what it is). */
.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; }
.month-navigation { flex-wrap: nowrap; align-items: center; }
.month-select input { margin-top: 0; }

/* ---------- Phone tidy-up (≤650 px) ---------- */
.habit-card .eyebrow { letter-spacing: 0; }
.member-table td[data-label]:not([data-label="Medlem"])::before { text-transform: none; letter-spacing: 0; }
.meal-dashboard-row > span { width: 68px; white-space: nowrap; }
.budget-stats > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 650px) {
  /* Task buttons: one row from the left edge, not three stacked rows under an indent. */
  .task-row-actions { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); padding-left: 0 !important; margin-left: 0 !important; gap: 6px; width: 100% !important; }
  .task-row-actions:empty { display: none !important; }
  #main .task-row-actions .button { padding: 9px 4px; font-size: .8125rem; white-space: nowrap; min-width: 0; }
  .task-list-toolbar { flex-direction: column; align-items: stretch; }
  .task-scope select { max-width: none; }
  /* Status filter: separate chips that wrap, instead of a grey box with two rows. */
  .task-list-toolbar .tabs { background: none; padding: 0; gap: 6px; }
  .task-list-toolbar .tabs button { border: 1px solid var(--line); background: var(--paper); }
  .task-list-toolbar .tabs button.selected { border-color: var(--seg-text-on); background: var(--seg-text-on); color: var(--paper); }
  .task-scope { display: grid; gap: 6px; width: 100%; }
  .task-scope select { width: 100%; }
  /* Calendar list: the new-calendar button is a normal button, and calendars line up in two columns. */
  .cal-sidebar-heading .button { flex: 0 0 auto; }
  .cal-sidebar .cal-calendar-choice { display: inline-flex; width: calc(50% - 6px); margin: 6px 0; }
  /* Household: the member's name leads the card. */
  .member-table td[data-label="Medlem"] strong { font-size: 1.0625rem; }
  .budget-stats { grid-template-columns: 1fr 1fr; }
}

/* ---------- Full-app audit fixes (PC + phone) ---------- */
/* Selections are neutral segmented controls; coral stays for the main action. */
.meal-period-options { display: inline-flex; gap: 3px; padding: 3px; border-radius: 11px; background: var(--seg-track); }
.meal-period-options .button { border: 0; background: transparent; color: var(--seg-text); box-shadow: none; min-height: 38px; }
.meal-period-options .button[aria-pressed="true"] { background: var(--seg-on); color: var(--seg-text-on); box-shadow: 0 1px 2px #0000001a, 0 0 0 .5px #0000000d; }
/* Calendar month cells: titles are cut with "…" instead of breaking mid-word. */
.cal-chip { overflow: hidden; overflow-wrap: normal; word-break: normal; }
.cal-chip > *, .cal-chip { text-overflow: ellipsis; }
.cal-grid:not(.cal-week-grid) .cal-chip small { display: none; }
.cal-grid:not(.cal-week-grid) .cal-chip { white-space: nowrap; }
/* Week title: "19. okt." not "19. Okt." */
.cal-navigation h2 { text-transform: none; }
.cal-navigation h2::first-letter { text-transform: uppercase; }
/* Budget plan rows: the four actions sit in a tidy 2 × 2 block and are never cut off. */
.budget-period-actions { display: grid !important; grid-template-columns: repeat(2, max-content); gap: 6px; justify-content: end; }
.budget-period-actions .button { white-space: nowrap; }
.card-header .button, .heading-actions .button { white-space: nowrap; }
@media (max-width: 650px) {
  /* Tabs that held more than fits: chips that wrap instead of disappearing off the edge. */
  .budget-tabs, .meal-tabs { display: flex !important; flex-wrap: wrap; background: none !important; padding: 0 !important; gap: 6px !important; overflow: visible !important; }
  .budget-tabs button, .meal-tabs button { flex: 0 0 auto !important; border: 1px solid var(--line) !important; background: var(--paper) !important; min-height: 40px; }
  .budget-tabs button.active, .meal-tabs button.selected, .meal-tabs button.active, .meal-tabs button[aria-selected="true"] { background: var(--seg-text-on) !important; color: var(--paper) !important; border-color: var(--seg-text-on) !important; }
  /* Tables scroll sideways as one piece instead of squeezing words letter by letter. */
  .table-scroll th, .table-scroll td { white-space: nowrap; }
  /* The week view becomes a list of days. */
  .cal-week-grid { min-width: 0 !important; grid-template-columns: minmax(0, 1fr) !important; }
  .cal-week-grid .cal-weekday, .cal-week-grid .cal-week-heading, .cal-week-grid .cal-week-number { display: none; }
  .cal-week-grid .cal-day { min-height: 0 !important; padding: 10px 12px; }
  /* Comfortable taps for the buttons in card headers and links. */
  #main .card-header .button, #main .cal-view-switch button, #main .theme-choice button { min-height: 44px; }
  .color-link { min-height: 44px; display: inline-flex; align-items: center; }
  .budget-period-actions { grid-template-columns: repeat(2, max-content); justify-content: start; }
}
td:has(> .budget-period-actions) { width: 1%; white-space: nowrap; }
.budget-period-actions { grid-template-columns: repeat(2, auto) !important; }
/* The plan table's four row actions sit in a compact 2 × 2 block so none are cut off. */
.budget-workspace .budget-period-actions, .budget-period-actions { min-width: 0 !important; grid-template-columns: repeat(2, auto) !important; justify-items: stretch; }
.budget-period-actions .button { min-height: 34px; padding: 6px 10px; font-size: .8125rem; }
@media (pointer: coarse) { .budget-period-actions .button { min-height: 44px; } }
/* Budget tables: a little less air per cell, so the whole row fits on a laptop screen. */
.budget-table th { padding: 12px 9px; }
.budget-table td { padding: 13px 9px; }
.budget-table td:first-child { min-width: 120px; }
/* If a budget table is still wider than the screen, its actions stay in view at the right edge while the rest scrolls. */
.table-scroll td:has(> .budget-period-actions) { position: sticky; right: 0; z-index: 1; background: var(--paper); box-shadow: -10px 0 12px -10px #0000002e; }
@media (max-width: 650px) {
  .table-scroll td:has(> .budget-period-actions) { position: static; box-shadow: none; }
  /* Tables become a list of small cards with the column name beside each value. */
  .table-scroll { overflow: visible; }
  table.stack-on-phone, table.stack-on-phone tbody, table.stack-on-phone tr, table.stack-on-phone td { display: block; width: 100%; }
  table.stack-on-phone thead { display: none; }
  table.stack-on-phone tr { border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; background: var(--paper); }
  table.stack-on-phone td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0 !important; border-bottom: 1px solid var(--line) !important; white-space: normal !important; text-align: right; min-width: 0 !important; }
  table.stack-on-phone td:last-child { border-bottom: 0 !important; }
  table.stack-on-phone td::before { content: attr(data-label); color: var(--muted); font-size: .8125rem; text-align: left; flex-shrink: 0; max-width: 45%; }
  table.stack-on-phone td:first-child { font-weight: 600; font-size: 1rem; }
  table.stack-on-phone td:first-child::before { display: none; }
  table.stack-on-phone td:first-child { justify-content: flex-start; text-align: left; flex-wrap: wrap; }
  table.stack-on-phone td[data-label=""]::before, table.stack-on-phone td:not([data-label])::before { display: none; }
  table.stack-on-phone td:has(> .budget-period-actions), table.stack-on-phone td:has(> .row-actions) { justify-content: stretch; }
  table.stack-on-phone .budget-period-actions, table.stack-on-phone .row-actions { width: 100%; grid-template-columns: 1fr 1fr !important; display: grid !important; }
  table.stack-on-phone .actual-input { width: 140px; }
}
@media (max-width: 650px) {
  #main .budget-period-actions .button, #main .meal-dashboard-row button { min-height: 44px; }
}

/* ---------- Accessibility (WCAG 2.1 AA) ---------- */
/* 1.4.11: a text field's edge reads at 3:1 or better, so you can see where to type. */
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]):not([type=file]):not(:focus):not([aria-invalid="true"]),
select:not(:focus):not([aria-invalid="true"]), textarea:not(:focus):not([aria-invalid="true"]) {
  border: 1px solid var(--field-line);
}
/* 2.4.1: "Gå til indholdet" appears for keyboard users as the first stop. */
.skip-link {
  position: fixed; left: 12px; top: 12px; z-index: 2147483000; padding: 10px 16px; border-radius: 10px;
  background: var(--ink); color: var(--sheet-bg); font-weight: 600; text-decoration: none;
  transform: translateY(-160%); transition: transform .2s;
}
.skip-link:focus { transform: none; outline: 3px solid var(--k-fg-8971b4, #8971b4); outline-offset: 2px; }
/* A page heading takes focus after navigation (so a screen reader says where you are) without a ring. */
#main h1[tabindex="-1"]:focus { outline: none; }
#main:focus { outline: none; }
/* 2.5.8: the 22 px sub-task check gets a 26 px hit area without changing how it looks.
   (Calendar check boxes sit inside their label, so the whole label is the target.) */
.subtask .check::after { content: ""; position: absolute; inset: -2px; }
.subtask .check:checked::after { content: ""; }
/* 2.5.5: segmented controls are 44 px tall on touch screens. */
@media (pointer: coarse) {
  .tabs button, .budget-tabs button, .task-tabs button, .icon-button { min-height: 44px; }
  .icon-button { min-width: 44px; }
}

/* ---------- Points you can see: "+9" rises from the ticked box, the card names who got them ---------- */
.points-float {
  position: fixed; z-index: 2000; pointer-events: none; translate: -50% -100%;
  padding: 4px 10px; border-radius: 999px; font: 700 1.05rem/1.2 var(--display); font-variant-numeric: tabular-nums;
  background: var(--gold-bg); color: var(--gold-ink); box-shadow: 0 6px 18px #00000022;
  animation: points-rise 1.15s var(--spring-smooth) forwards;
}
@keyframes points-rise {
  0% { opacity: 0; transform: translateY(6px) scale(.7); }
  18% { opacity: 1; transform: translateY(-6px) scale(1.08); }
  70% { opacity: 1; transform: translateY(-34px) scale(1); }
  100% { opacity: 0; transform: translateY(-52px) scale(.96); }
}
.completion-feedback.is-points { padding: 14px 20px 14px 14px; gap: 14px; }
.completion-feedback .feedback-points {
  display: grid; place-items: center; min-width: 54px; height: 54px; padding: 0 8px; border-radius: 16px;
  background: var(--gold-bg); color: var(--gold-ink);
  font: 800 1.35rem/1 var(--display); font-variant-numeric: tabular-nums;
}
.completion-feedback.is-points strong { font-size: 1.2rem; }
.completion-feedback.is-points small { font-size: .82rem; }
.balance-pulse { animation: balance-pulse .9s var(--spring); }
@keyframes balance-pulse { 0% { transform: scale(1); } 30% { transform: scale(1.18); color: var(--gold-ink); } 100% { transform: scale(1); } }
.point-balance { display: inline-block; transform-origin: right center; }
@media (prefers-reduced-motion: reduce) { .balance-pulse { animation: none; } }

/* ---------- "Klaret sammen": pick who took part ---------- */
.together-people { border: 0; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.together-person {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--sheet-bg);
  transition: border-color .15s, background-color .15s, transform .45s var(--spring);
}
.together-person:active { transform: scale(.97); transition-duration: .06s; }
.together-person:has(input:checked) { border-color: var(--pc, var(--line)); background: var(--pc-tint, var(--sheet-bg)); }
.together-person:has(input:disabled) { cursor: default; }
.together-person input { width: 20px; height: 20px; margin: 0; accent-color: var(--pc, currentColor); flex: none; }
.together-person:has(input:focus-visible) { outline: 3px solid var(--k-fg-8971b4, #8971b4); outline-offset: 2px; }
.together-person .point-avatar, .together-person .person-avatar { width: 30px; height: 30px; flex: none; }
.together-summary { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--seg-track); color: var(--ink); }

/* Phone: the bottom menu is fixed over the page, so the page keeps room for it under the last card,
   and anything that scrolls into view (focus, "jump to") stops above it. sheet.js measures the menu. */
@media (max-width: 650px) {
  :root { --mobile-nav-room: calc(var(--mobile-nav-space, calc(72px + env(safe-area-inset-bottom))) + 24px); }
  html { scroll-padding-bottom: var(--mobile-nav-room); }
  #main { padding-bottom: var(--mobile-nav-room); }
}

/* "Sprunget over" shows the whole household, so the "Vis" picker is hidden there. */
.task-scope[hidden] { display: none !important; }

/* ---------- Forms never slide sideways on a phone (Safari's date fields have a width of their own) ---------- */
#dialog { overflow-x: hidden; touch-action: pan-y pinch-zoom; }
#dialog #modal-form, #dialog #modal-fields, #dialog .field, #dialog .form-row > * { min-width: 0; max-width: 100%; }
#dialog .form-row { min-width: 0; align-items: flex-end; }
#dialog input, #dialog select, #dialog textarea { min-width: 0; max-width: 100%; box-sizing: border-box; }
#dialog input[type="date"], #dialog input[type="time"], #dialog input[type="month"] {
  -webkit-appearance: none; appearance: none; width: 100%; display: block; min-height: 46px; line-height: normal;
}
#dialog input[type="date"]::-webkit-date-and-time-value, #dialog input[type="time"]::-webkit-date-and-time-value { text-align: left; min-width: 0; }

/* ---------- Tabular numbers where amounts and dates stand in columns or lists ----------
   Large single figures and running text keep the normal digits (a tabular "1" looks gappy at a big size). */
table, td, th, .numeric, .point-tag, .bo-legend, .bo-trend-month, .bo-account-head, .bo-person, .bo-largest,
.bw-section-heading, .cal-date, .cal-week-number, .week-day, .coupon-history { font-variant-numeric: tabular-nums; }

/* ---------- Phone sheets always fill the width – a form's own max-width (madplan) must not leave a strip at the side ---------- */
@media (max-width: 650px) {
  #dialog.as-sheet, #dialog.as-sheet:has(#meal-ingredients-editor), #dialog.as-sheet:has(.meal-swap) {
    width: 100%; max-width: none; max-height: calc(100dvh - 44px);
  }
}
/* Same space between every field: the row's own gap would be added to the field's bottom margin. */
#dialog .form-row { row-gap: 0; }
/* The status line under "Ret" ("1 gemte retter matcher") is for screen readers; the list already shows the matches.
   Hidden visually, so it neither leaves a gap nor pushes the form down while typing. */
.meal-autocomplete { margin-bottom: 15px; }
.meal-autocomplete > #meal-dish-status {
  position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Vejledning: føj til hjemmeskærm */
.install-steps { margin: 0 0 12px; padding-left: 1.25rem; display: grid; gap: 8px; font-size: 0.875rem; line-height: 1.6; }

/* Budget: ét kort øverst (hvilket budget + hvilken måned); metodevalget bor i Overblik og Overførsler */
.budget-context.budget-bar { justify-content: space-between; gap: 12px 18px; padding: 10px 14px; margin-bottom: 16px; }
.budget-bar .budget-scope-bar { margin: 0; gap: 0; }
.budget-bar .month-navigation { margin-left: auto; }
.budget-scope-note { margin: -6px 2px 14px; color: var(--muted); font-size: 0.8125rem; line-height: 1.6; }
.bo-hero-note .method-choice { display: grid; gap: 8px; width: 100%; margin: 0 0 14px; padding: 10px; }
.bo-hero-note .method-choice > .ui-icon { display: none; }
.bo-hero-note .method-choice-label { font-size: 0.75rem; }
.bo-hero-note .method-choice-options { display: grid; gap: 4px; }
.bo-hero-note .method-choice-options button { text-align: left; white-space: normal; line-height: 1.35; min-height: 40px; }
.bw-transfers > .method-choice { margin-bottom: 16px; width: fit-content; max-width: 100%; flex-wrap: wrap; }
@media (max-width: 650px) {
  .budget-context.budget-bar { padding: 10px; }
  .budget-bar .budget-scope-bar { width: 100%; }
  .budget-bar .month-navigation { width: 100%; justify-content: space-between; }
  .budget-bar .month-navigation .month-select { flex: 1; }
  .budget-bar .month-navigation input { width: 100%; }
  .bw-transfers > .method-choice { width: 100%; }
}

/* Budget: tre hovedfaner med underpunkter (lille, rolig linje under fanerne) */
.budget-toolbar { display: grid; gap: 10px; }
.budget-subtabs { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0 4px; border-bottom: 1px solid var(--line); }
.budget-subtabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 2px; min-height: 44px; font-size: 0.875rem; color: var(--muted); font-weight: 550; border-radius: 0; }
.budget-subtabs button:hover { color: var(--ink); }
.budget-subtabs button.active { color: var(--ink); border-bottom-color: var(--coral); font-weight: 650; }
.budget-toolbar > .budget-tabs { width: fit-content; max-width: 100%; justify-self: start; }

/* Guidet start i budgettet + enklere overblik */
.bstart { max-width: 640px; margin: 8px auto 0; display: grid; gap: 14px; padding: 22px; }
.bstart h2 { margin: 0; font-size: 1.35rem; line-height: 1.25; }
.bstart-step { margin: 0; font-size: 0.8125rem; font-weight: 650; color: var(--muted); }
.bstart-track { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bstart-track span { display: block; height: 100%; background: var(--coral); border-radius: 99px; transition: width 0.2s; }
.bstart-help { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.bstart-field, .bstart-row { display: grid; gap: 6px; }
.bstart-field input, .bstart-row input { min-height: 48px; font-size: 1.0625rem; width: 100%; box-sizing: border-box; }
.bstart-rows { display: grid; gap: 10px; }
.bstart-row { grid-template-columns: minmax(0, 1fr) minmax(110px, 160px); align-items: center; gap: 12px; }
.bstart-row > span { font-weight: 550; }
.bstart-other { grid-template-columns: minmax(0, 1fr) minmax(110px, 160px); }
.bstart-actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.bstart-actions .button { min-height: 48px; }
.bstart-actions .button.primary:only-child { margin-left: auto; }
.bstart-skip { margin: 0; text-align: center; }
.bstart .link-button { background: none; border: 0; padding: 10px; min-height: 44px; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 0.875rem; }
@media (max-width: 520px) {
  .bstart { padding: 16px; }
  .bstart-row, .bstart-other { grid-template-columns: 1fr; gap: 6px; }
}
.bo-more { margin-top: 14px; }
.bo-more > summary { cursor: pointer; list-style: none; display: grid; gap: 2px; padding: 14px 16px; min-height: 44px; border: 1px solid var(--line); border-radius: 14px; font-weight: 650; background: var(--k-bg-ffffff, transparent); }
.bo-more > summary::-webkit-details-marker { display: none; }
.bo-more > summary small { font-weight: 400; color: var(--muted); font-size: 0.8125rem; }
.bo-more > summary::after { content: "⌄"; position: absolute; }
.bo-more > summary { position: relative; padding-right: 44px; }
.bo-more > summary::after { right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.1rem; }
.bo-more[open] > summary { margin-bottom: 14px; }
.bo-more[open] > summary::after { content: "⌃"; }
.bo-more > * + * { margin-top: 14px; }
.bo-more > summary + * { margin-top: 0; }
.bstart input { border: 1px solid var(--k-border-cfc1df, #cfc1df); border-radius: 12px; padding: 0 14px; background: var(--k-bg-ffffff, #fff); color: inherit; font: inherit; font-size: 1.0625rem; }
.bstart input:focus-visible { outline: 3px solid var(--coral); outline-offset: 1px; }
.bstart-row input::placeholder, .bstart-field input::placeholder { color: var(--muted); }

/* Poster: samlet liste */
.budget-post-filters { width: fit-content; max-width: 100%; }
.bw-post-status { margin-top: 10px; align-items: center; }
.bw-post-status p { margin: 0; color: var(--muted); font-size: 0.8125rem; }
.post-more { display: block; margin-top: 6px; }
.post-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 44px; }
.post-more > summary::-webkit-details-marker { display: none; }
.post-more-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bw-posts td small { display: block; color: var(--muted); }

/* Mit forbrug */
.spend-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.spend-card { display: grid; gap: 10px; align-content: start; }
.spend-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.spend-card h3 { margin: 0; font-size: 1.05rem; }
.spend-card header strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.spend-track { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.spend-track span { display: block; height: 100%; border-radius: 99px; background: var(--k-accent-32765c, #32765c); }
.spend-card.is-over .spend-track span { background: #b9563e; }
.spend-left { margin: 0; color: var(--muted); font-size: 0.875rem; }
.spend-left.is-over { color: #a64430; font-weight: 650; }
.spend-subs { list-style: none; margin: 4px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.spend-subs li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9375rem; }
.spend-list { list-style: none; margin: 0; padding: 0; }
.spend-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.spend-row:first-child { border-top: 0; }
.spend-row-main small, .spend-row-amount small { display: block; color: var(--muted); font-size: 0.8125rem; }
.spend-row-amount { text-align: right; font-variant-numeric: tabular-nums; }
.spend-row-actions { display: flex; gap: 6px; }
.spend-page .link-button, .spend-list-card .link-button { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; min-height: 24px; }
#modal-fields textarea[name="subs"] { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; border: 1px solid var(--k-border-cfc1df, #cfc1df); border-radius: 12px; background: var(--k-bg-ffffff, #fff); color: inherit; }
@media (max-width: 640px) {
  .spend-row { grid-template-columns: minmax(0, 1fr) auto; }
  .spend-row-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
.spend-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 14px 18px; }
.spend-controls .budget-tabs { width: fit-content; }
.spend-period { min-width: 96px; text-align: center; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .spend-controls { flex-direction: column; align-items: stretch; } .spend-controls .month-navigation { justify-content: space-between; } }
.spend-row-actions { flex-wrap: wrap; }
.spend-receipt { display: grid; gap: 6px; }
.spend-receipt input[type="file"] { max-width: 100%; font: inherit; }
.spend-receipt-note { margin: 0; font-size: 0.9375rem; }
.spend-receipt .link-button { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; min-height: 24px; }
.spend-receipt-img { display: block; max-width: 100%; max-height: 65vh; margin: 0 auto 12px; border-radius: 12px; border: 1px solid var(--line); object-fit: contain; }
.spend-receipt-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 8px; }
.spend-receipt-actions .button { text-decoration: none; }
.spend-receipt-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.spend-receipt-pick { cursor: pointer; position: relative; }
.spend-receipt-pick:focus-within { outline: 3px solid var(--focus, #6b4ea0); outline-offset: 2px; }
.spend-group { margin: 18px 0 4px; font-size: 0.9375rem; color: var(--muted); font-weight: 650; }
.spend-group:first-of-type { margin-top: 6px; }
.spend-receipt-filter { align-items: flex-end; }
.spend-receipt-search { flex: 1 1 220px; min-width: 0; margin: 0; }
.spend-receipt-search input { width: 100%; box-sizing: border-box; }
@media (max-width: 520px) { .spend-receipt-filter { align-items: stretch; } .spend-receipt-search { flex-basis: auto; } }
.spend-more { display: flex; justify-content: center; padding: 14px 0 4px; }

/* ---------- UI review (1 Nov): small fixes ---------- */
/* Dialogs name their own colours instead of leaning on the browser's defaults, so a host page that
   forces a dark colour scheme (the preview does) cannot turn the box dark under light controls. */
dialog { background: var(--sheet-bg); color: var(--ink); }
/* Progress bars: the empty track follows the theme and stays visible in dark. */
.goal-progress, .progress { background: var(--track); }
/* Goals headline breaks where there is room, never leaving one word alone on the last line. */
.goals-hero h1, .page-heading h1 { text-wrap: balance; }
/* Husstand: role badges stay on one line. */
.member-table .status-pill { white-space: nowrap; }
@media (max-width: 650px) {
  /* Tab chips fill their rows evenly (no lone chip on row two) and are 44 px tall. */
  .budget-tabs button, .meal-tabs button { flex: 1 1 auto !important; min-height: 44px; }
  /* Point scoreboard: the right edge fades so it is clear there are more people to scroll to. */
  .household-scoreboard:not(:where(.dashboard-widget *)) { padding-right: 28px; }
  .household-scoreboard:not(:where(.dashboard-widget *))::after { content: ""; flex: 0 0 28px; position: sticky; right: -28px; margin-left: -28px; align-self: stretch; pointer-events: none; background: linear-gradient(to right, transparent, var(--bg)); }
}

/* ---------- Budget på telefon: kortere top (mere af selve budgettet ses uden at rulle) ---------- */
.budget-bar .tab-short { display: none; }
@media (max-width: 650px) {
  /* Fire korte faner på én række i stedet for to */
  .budget-bar .tab-long { display: none; }
  .budget-bar .tab-short { display: inline; }
  .budget-bar .budget-scope-bar .budget-tabs { flex-wrap: nowrap; }
  .budget-bar .budget-scope-bar .budget-tabs button { flex: 1 1 0 !important; min-width: 0; padding-left: 4px; padding-right: 4px; font-size: 0.75rem; white-space: nowrap; }
  /* Titlen står ved siden af øjet; forklaringen under titlen udelades */
  #main:has(.budget-bar) .page-heading { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
  #main:has(.budget-bar) .page-heading > div:first-child { flex: 1 1 auto; min-width: 0; }
  #main:has(.budget-bar) .page-heading .subtitle { display: none; }
  #main:has(.budget-bar) .page-heading h1 { margin: 0; }
  #main:has(.budget-bar) .heading-actions { margin-top: 0; flex: none; }
  #main:has(.budget-bar) .money-visibility-button { width: 44px; min-width: 44px; padding: 0; justify-content: center; }
  #main:has(.budget-bar) .money-visibility-button span { display: none; }
  /* "+ Tilføj post" følger med i hjørnet, over bundmenuen */
  .budget-fab { position: fixed; right: 16px; bottom: calc(var(--mobile-nav-space, 74px) + 16px); z-index: 25; min-height: 52px; padding: 0 20px; border-radius: 26px; box-shadow: 0 8px 24px rgba(40, 30, 50, .28); }
  #main:has(.budget-fab) { padding-bottom: calc(var(--mobile-nav-room) + 64px); }
  body.fab-compact .budget-fab .fab-text { display: none; }
  body.fab-compact .budget-fab { width: 52px; padding: 0; font-size: 1.5rem; line-height: 1; justify-content: center; }
}

/* Mobil: ydre radius = indre radius + afstand, så indlejrede hjørner følger hinanden */
@media (max-width: 650px) {
  .meal-period-options { border-radius: 14px; } /* knap 11 + 3 */
  .budget-context.budget-bar { border-radius: 20px; } /* knap 9 + 11 */
  .budget-bar .icon-button { border-radius: 9px; }
  .method-choice { padding: 9px; }
  .method-choice-options { border-radius: 11px; } /* knap 8 + 3 */
  .method-choice { border-radius: 20px; } /* 11 + 9 */
  .bo-hero-note .method-choice { padding: 10px; border-radius: 21px; } /* 11 + 10 */
  /* Kort: knapper har radius 11 og står 21 fra kanten (20 luft + 1 kant) */
  .card, .habit-card, .goal-card { border-radius: 32px; }
  .shopping-item { border-radius: 30px; } /* 11 + 19 */
  .reward-card { border-radius: 27px; } /* 11 + 16 */
  .week-recap-card { border-radius: 29px; } /* 11 + 18 */
  .stat-card, .dashboard-metric { border-radius: 27px; } /* ikon 9 + 18 */
  .bo-hero { border-radius: 36px; } /* 11 + 25 */
  .dashboard-upcoming-row { border-radius: 11px; } /* 32 − 21 */
  .card .tabs button { border-radius: 11px; } /* står i kortets hjørne: 11 + 21 = 32 */
  table.stack-on-phone tr, table.member-table.stack-on-phone tr { border-radius: 25px; } /* knap 11 + 14 */
  .budget-workspace .card { border-radius: 32px; }
  .budget-workspace .card.stat-card { border-radius: 27px; }
  .bw-plan-filters button { border-radius: 11px; }
  /* Kort i kort: vane og mål på Overblik bliver en sektion i kortet i stedet for endnu en ramme */
  .dashboard-widget .habit-card.is-compact, .dashboard-widget .goal-card.goal-compact { border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; padding: 14px 0 0; }
}

/* Smalle telefoner (fx 320 px): topbjælken må ikke skubbe siden bredere end skærmen */
@media (max-width: 400px) {
  .topbar { padding-inline: 12px; gap: 8px; }
  .topbar .breadcrumbs { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; }
  .topbar .breadcrumbs > span:first-child { max-width: 72px; }
  .topbar .breadcrumbs strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topbar .top-actions { flex: none; gap: 4px; }
}

/* Smalle telefoner: vanens ugedage skal være til at ramme */
@media (max-width: 360px) {
  .habit-card:not(.is-compact) { padding: 14px; border-radius: 26px; } /* knap 11 + 15 */
  .habit-week { gap: 2px; }
}
