/* Palette: whitewashed walls and azulejo cobalt. One bold colour, for ticks, buttons, icons and
   whatever is selected; the section icons sit on soft cobalt squares, like tiles on a wall. */
:root {
    color-scheme: light;
    --bg: #F6F7F9;
    --surface: #FFFFFF;
    --surface-press: #EEF1F5;
    --bar-bg: rgba(255, 255, 255, 0.86);
    --ink: #18202B;
    --muted: #5E6875;
    --line: #E2E5EA;
    --accent: #1D4E9E;
    --accent-ink: #FFFFFF;
    --accent-soft: #E3EBF8;
    --danger: #A3322A;
    --danger-ink: #FFFFFF;
    --danger-soft: #F7E5E3;

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius-control: 14px;
    --radius-card: 20px;
    --radius-pill: 999px;
    --pad: 16px;
    --tabbar-height: 58px;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #0E1520;
        --surface: #162030;
        --surface-press: #1D2A3D;
        --bar-bg: rgba(22, 32, 48, 0.86);
        --ink: #E8ECF2;
        --muted: #97A2B2;
        --line: #263244;
        --accent: #8FB1F2;
        --accent-ink: #0E1520;
        --accent-soft: #1E2D47;
        --danger: #F08A80;
        --danger-ink: #0E1520;
        --danger-soft: #3A2327;
    }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

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

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.icon {
    flex: none;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chevron {
    width: 18px;
    height: 18px;
    color: var(--muted);
}

/* ---------- Shell ---------- */

.shell {
    max-width: 560px;
    margin: 0 auto;
    padding:
        calc(env(safe-area-inset-top) + 20px)
        calc(env(safe-area-inset-right) + var(--pad))
        calc(env(safe-area-inset-bottom) + var(--tabbar-height) + 32px)
        calc(env(safe-area-inset-left) + var(--pad));
}

/* ---------- Tab bar ---------- */

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    border-top: 1px solid var(--line);
    background: var(--surface);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .tabbar {
        background: var(--bar-bg);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
    }
}

.tabbar-inner {
    display: flex;
    max-width: 560px;
    height: var(--tabbar-height);
    margin: 0 auto;
}

.tab {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.tab-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 30px;
    border-radius: var(--radius-pill);
}

.tab-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab.is-active { color: var(--accent); }
.tab.is-active .tab-icon { background: var(--accent-soft); }
.tab:active .tab-icon { background: var(--surface-press); }

/* ---------- Shared pieces ---------- */

/* A section's icon on its soft cobalt tile. */
.section-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
}

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

.section-icon-lg {
    width: 60px;
    height: 60px;
    border-radius: 18px;
}

.section-icon-lg .icon { width: 32px; height: 32px; stroke-width: 1.6; }

.pill {
    flex: none;
    display: inline-block;
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 15px;
    font-weight: 700;
}

.avatar-partner {
    background: var(--accent-soft);
    color: var(--accent);
}

.avatar-empty {
    border: 1.5px dashed var(--muted);
    background: none;
    color: var(--muted);
}

/* Small, next to a task. Also used bare, as an empty space that keeps a column in line. */
.avatar-sm {
    flex: none;
    width: 28px;
    height: 28px;
    font-size: 13px;
}

.text-button {
    background: none;
    border: 0;
    padding: 10px 0;
    color: var(--accent);
    font-size: 15px;
    font-weight: 600;
}

a.text-button { text-decoration: none; }

.splash {
    min-height: 100dvh;
}

/* ---------- Home ---------- */

.home-header { margin: 0 0 20px; }

.home-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
}

.home-date {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.home-header h1 {
    margin: 2px 0 0;
    font-size: 32px;
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* The two of you, side by side. */
.avatars { display: flex; flex: none; }
.avatars .avatar { box-shadow: 0 0 0 3px var(--bg); }
.avatars .avatar + .avatar { margin-left: -8px; }

/* minmax(0, …): a long line in a card ends in "…" instead of widening every card past the screen. */
.home-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

.card {
    display: block;
    padding: 14px 16px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}

.card:active { background: var(--surface-press); }

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

.card-heading {
    flex: 1;
    min-width: 0;
    display: grid;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-meta {
    color: var(--muted);
    font-size: 15px;
}

.card-items {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.card-items li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    border-top: 1px solid var(--line);
}

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

.card-items .item-by { margin-left: 0; }

.card-more, .card-note {
    display: block;
    margin-top: 10px;
    font-size: 15px;
}

.card-due {
    flex: none;
    color: var(--muted);
    font-size: 14px;
}

.card-amount {
    flex: none;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.card-items li.card-subhead {
    min-height: 36px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.card-more { color: var(--accent); font-weight: 600; }
.card-note { color: var(--muted); }

.home-section { margin-top: 32px; }

.section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-lead {
    margin: 2px 0 12px;
    color: var(--muted);
    font-size: 15px;
}

.soon-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.soon-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 60px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    color: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.soon-tile:active { background: var(--surface-press); }
.soon-tile .section-icon { width: 36px; height: 36px; border-radius: 11px; }
.soon-tile .section-icon .icon { width: 20px; height: 20px; }
.soon-tile-name { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Menu ---------- */

.menu-group { margin-top: 28px; }
.page-header + .menu-group { margin-top: 8px; }

.group-title {
    margin: 0 0 8px 4px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    overflow: hidden;
}

.menu-list + .menu-list { margin-top: 12px; }

/* Separators start where the text does, as in native grouped lists. */
.menu-list > li + li { position: relative; }

.menu-list > li + li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 68px;
    right: 0;
    border-top: 1px solid var(--line);
}

.menu-row {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 10px 14px;
    color: inherit;
    text-decoration: none;
}

a.menu-row:active, .menu-button:active { background: var(--surface-press); }

.menu-row .avatar { width: 40px; height: 40px; font-size: 16px; }

.menu-text {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 1px;
}

.menu-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.menu-desc {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.menu-button {
    width: 100%;
    min-height: 54px;
    border: 0;
    background: none;
    text-align: left;
    font-weight: 600;
}

.menu-button.danger { color: var(--danger); }
.menu-button:disabled { opacity: 0.5; }

.menu-group .notice { margin-top: 12px; }

/* ---------- Sections still to come ---------- */

.soon-hero { margin: 4px 0 20px; }

.soon-hero h1 {
    margin: 16px 0 0;
    font-size: 34px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.soon-hero .page-sub { font-size: 17px; }

.soon-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.soon-card h2 {
    margin: 12px 0 10px;
    font-size: 18px;
    font-weight: 700;
}

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

.soon-list li {
    display: flex;
    gap: 12px;
}

/* Each point gets a small cobalt tile. */
.soon-list li::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    margin-top: 8px;
    border-radius: 2px;
    background: var(--accent);
}

.soon-note {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 15px;
}

/* ---------- Shopping list ---------- */

.page-header { margin: 4px 0 16px; }

.page-header h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-sub {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.add-bar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    gap: 8px;
    margin: 0 calc(var(--pad) * -1);
    padding: 10px var(--pad);
    background: var(--bg);
}

.add-bar input {
    min-width: 0;
    height: 50px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    /* 16px or more stops iOS Safari from zooming in when the field gets focus. */
    font-size: 17px;
}

.add-bar input::placeholder { color: var(--muted); }
.add-bar input:focus { border-color: var(--accent); outline: none; }
.add-name { flex: 1; }
.add-qty { width: 76px; flex: none; text-align: center; }

.add-button {
    flex: none;
    width: 50px;
    height: 50px;
    border: 0;
    border-radius: var(--radius-control);
    background: var(--accent);
    color: var(--accent-ink);
    display: grid;
    place-items: center;
}

.add-button:disabled { opacity: 0.35; }

.add-button svg, .item-remove svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.notice {
    margin: 4px 0 12px;
    padding: 10px 14px;
    border-radius: var(--radius-control);
    background: var(--accent-soft);
    font-size: 15px;
}

.empty {
    margin: 32px 0;
    color: var(--muted);
    text-align: center;
}

.items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.item-toggle {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 58px;
    padding: 8px 0;
    border: 0;
    background: none;
    text-align: left;
}

.tick {
    flex: none;
    position: relative;
    width: 26px;
    height: 26px;
    border: 2px solid var(--accent);
    border-radius: 50%;
}

.item-name {
    position: relative;
    min-width: 0;
    overflow-wrap: anywhere;
}

.item-qty {
    flex: none;
    margin-left: auto;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.item-by {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-left: 10px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.item-remove {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    border: 0;
    background: none;
    color: var(--muted);
}

/* ---------- Basket ---------- */

.basket { margin-top: 32px; }

.basket-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.basket-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.is-checked .item-toggle { color: var(--muted); }

.is-checked .tick, .is-paid .tick, .is-picked .tick {
    background: var(--accent);
}

/* The check mark, drawn with two borders. */
.is-checked .tick::after, .is-paid .tick::after, .is-picked .tick::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 7px;
    height: 12px;
    border: solid var(--accent-ink);
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

/* The one bit of motion: a line drawn through the item as it lands in the basket. */
.is-checked .item-name::after {
    content: "";
    position: absolute;
    left: 0;
    top: 52%;
    height: 1.5px;
    width: 100%;
    background: currentColor;
    transform-origin: left center;
    animation: strike 260ms ease-out;
}

.is-checked .item-qty { background: transparent; border: 1px solid var(--line); }

@keyframes strike {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ---------- Tasks ---------- */

/* All tasks, or only yours. */
.segmented {
    display: flex;
    gap: 4px;
    margin: 2px 0 6px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
}

.segmented button {
    flex: 1;
    min-height: 38px;
    border: 0;
    border-radius: var(--radius-pill);
    background: none;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.segmented button[aria-pressed="true"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.task-group { margin-top: 18px; }

.task-group-title {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.task-group-title.is-overdue { color: var(--danger); }

/* The circle sits where the shopping list's does, inside a full-size target. */
.task-check {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-left: -9px;
    padding: 0;
    border: 0;
    background: none;
}

.task-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 8px 0 8px 5px;
    color: inherit;
    text-decoration: none;
}

.task-main:active .task-text { opacity: 0.6; }

.task-text {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 1px;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
    color: var(--muted);
    font-size: 14px;
}

.task-due.is-today, .card-due.is-today { color: var(--accent); font-weight: 600; }
.task-due.is-overdue, .card-due.is-overdue { color: var(--danger); font-weight: 600; }

.task-repeat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.task-repeat .icon { width: 15px; height: 15px; stroke-width: 2; }

.is-checked .task-main { color: var(--muted); }

/* ---------- Task editor ---------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 44px;
    margin: -8px 0 0 -8px;
    padding: 0 12px 0 2px;
    border: 0;
    background: none;
    color: var(--accent);
    font-size: 17px;
    font-weight: 600;
}

.back-link .icon { stroke-width: 2.2; }

.editor-title {
    margin: 4px 0 20px;
    font-size: 30px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.task-form {
    display: grid;
    gap: 22px;
}

.field {
    display: grid;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.field-label {
    padding: 0;
    font-size: 15px;
    font-weight: 600;
}

.field-input {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    /* 16px or more stops iOS Safari from zooming in when the field gets focus. */
    font-size: 17px;
    line-height: 1.3;
}

.field-input:focus { border-color: var(--accent); outline: none; }
.field-input::placeholder { color: var(--muted); }

textarea.field-input { min-height: 96px; resize: vertical; }

select.field-input {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237D8794' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9.5 6 6 6-6'/%3E%3C/svg%3E");
    background-position: right 14px center;
    background-repeat: no-repeat;
    background-size: 18px;
}

input[type="date"].field-input {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    text-align: left;
}

/* iOS centres the date and collapses the field while it's empty. */
input[type="date"].field-input::-webkit-date-and-time-value {
    min-height: 1.3em;
    text-align: left;
}

.choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice {
    position: relative;
    display: flex;
}

/* The radio itself is invisible, but it still takes the tap and the keyboard focus. */
.choice input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.choice span, .chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    font-size: 15px;
    font-weight: 600;
}

.choice input:checked + span, .chip[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.choice input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.every-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.every-row > span { flex: none; }
.every-count { flex: none; width: 80px; text-align: center; }
.every-unit { flex: 1; }

.switch-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    cursor: pointer;
}

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

.switch-label { font-weight: 600; }

.switch-hint {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.3;
}

.switch {
    -webkit-appearance: none;
    appearance: none;
    flex: none;
    position: relative;
    width: 51px;
    height: 31px;
    margin: 0;
    border-radius: var(--radius-pill);
    background: var(--line);
    cursor: pointer;
    transition: background-color 160ms;
}

.switch::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 160ms;
}

.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(20px); }

.field-note {
    margin: -8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.task-form .primary-button { margin-top: 0; }

.danger-zone {
    margin-top: 28px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.text-button.danger { color: var(--danger); }

.confirm-text { margin: 6px 0 12px; }

.confirm-row {
    display: flex;
    gap: 10px;
}

.danger-button, .secondary-button {
    flex: 1;
    height: 50px;
    border-radius: var(--radius-control);
    font-weight: 600;
}

.danger-button {
    border: 0;
    background: var(--danger);
    color: var(--danger-ink);
}

.danger-button:disabled { opacity: 0.5; }

.secondary-button {
    border: 1px solid var(--line);
    background: var(--surface);
}

/* ---------- Expenses ---------- */

/* A title with its + button beside it. */
.page-header.has-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

a.add-button { text-decoration: none; }

.page-lead {
    margin: -8px 0 16px;
    color: var(--muted);
    font-size: 15px;
}

.balance-card {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.balance-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
}

.balance-text { font-weight: 600; }

.balance-amount {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.balance-note {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.settle-button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    margin-top: 12px;
    color: var(--accent);
    text-decoration: none;
}

.settle-button:active { background: var(--surface-press); }

.month-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 22px 0 0;
}

.month-step {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--accent);
}

.month-step:active { background: var(--surface-press); }

.month-label {
    flex: 1;
    min-width: 0;
    display: grid;
    justify-items: center;
    text-align: center;
}

.month-label h2 {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    font-weight: 600;
}

.month-total {
    font-size: 34px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.month-caption {
    color: var(--muted);
    font-size: 13px;
}

.money-section { margin-top: 28px; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.section-head h2, .section-heading {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-note {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
}

/* A list row that's a link: an icon or circle, a title over a line of detail, an amount. */
.row-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 8px 0;
    color: inherit;
    text-decoration: none;
}

.row-link:active .row-text { opacity: 0.6; }

.row-text {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 1px;
}

.row-title { overflow-wrap: anywhere; }

.row-meta {
    color: var(--muted);
    font-size: 14px;
}

.row-meta.is-overdue { color: var(--danger); font-weight: 600; }

.row-icon { width: 36px; height: 36px; border-radius: 11px; }
.row-icon .icon { width: 20px; height: 20px; }

.money {
    flex: none;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.is-settlement .row-title, .is-settlement .money { color: var(--muted); }

/* "Varies", where a bill that changes every month would show its amount. */
.money.is-varies, .card-amount.is-varies { color: var(--muted); font-weight: 400; }

.category-totals {
    display: grid;
    gap: 14px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.category-totals li {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-line {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 6px 8px;
}

.category-bar {
    grid-column: 1 / -1;
    height: 6px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
}

.category-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.editor-lead {
    margin: -12px 0 20px;
    color: var(--muted);
    font-size: 15px;
}

/* The amount, big, with the euro sign on the side the language puts it. */
.amount-field {
    position: relative;
    display: flex;
    align-items: center;
}

.amount-input {
    min-height: 64px;
    padding-right: 46px;
    font-size: 30px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.amount-symbol {
    position: absolute;
    right: 16px;
    color: var(--muted);
    font-size: 24px;
    font-weight: 600;
    pointer-events: none;
}

.symbol-first .amount-input { padding-right: 14px; padding-left: 42px; }
.symbol-first .amount-symbol { right: auto; left: 16px; }

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

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

.category-choice span {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 68px;
    padding: 8px 4px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
}

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

.share-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-top: 4px;
    font-size: 15px;
}

.share-select {
    flex: none;
    width: auto;
    min-width: 104px;
    min-height: 44px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.share-other { color: var(--muted); }

/* ---------- Calendar ---------- */

.month-label h2.month-name {
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.month-today { padding: 2px 0; font-size: 14px; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    row-gap: 2px;
    margin-top: 12px;
}

.cal-weekday {
    padding: 4px 0 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.cal-day {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    height: 50px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.cal-num {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.cal-day.is-weekend .cal-num { color: var(--muted); }
.cal-day.is-holiday .cal-num { color: var(--danger); font-weight: 700; }

/* A bridge day gets a dashed ring: worth a look when planning time off. */
.cal-day.is-bridge .cal-num {
    outline: 1.5px dashed var(--muted);
    outline-offset: -3px;
}

.cal-day.is-today .cal-num {
    box-shadow: inset 0 0 0 2px var(--accent);
    font-weight: 700;
}

.cal-day:active .cal-num { background: var(--surface-press); }

.cal-day[aria-pressed="true"] .cal-num {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: none;
    outline: none;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

.cal-dot.is-empty { visibility: hidden; }

.agenda-date {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

/* Holidays and bridges are there to be read, not opened. */
.row-link.is-static:active .row-text { opacity: 1; }

.agenda-item.is-holiday .row-icon { background: var(--danger-soft); color: var(--danger); }
.agenda-item.is-bridge .row-icon { background: var(--surface-press); color: var(--muted); }
.agenda-item .avatar-sm { margin-left: 2px; }

.holidays-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 20px;
    padding: 12px 0;
}

.holidays-link .chevron { color: inherit; }

.holiday-list { margin-top: 8px; }
.holiday-list .is-past { opacity: 0.5; }

.time-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

input[type="time"].field-input {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    text-align: left;
}

input[type="time"].field-input::-webkit-date-and-time-value {
    min-height: 1.3em;
    text-align: left;
}

/* ---------- Meals ---------- */

/* A link beside a page's title, like Recipes beside the menu. */
.header-link {
    flex: none;
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--accent);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

/* A link the width of the page that reads as a button. */
.wide-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.header-link:active, .wide-link:active { background: var(--surface-press); }
.wide-link .icon { width: 20px; height: 20px; }

.meals-hint { margin-top: 18px; }

.meal-day { margin-top: 20px; }

/* Days gone by stay for reference, but quieter. */
.meal-day.is-past { opacity: 0.55; }

.meal-date {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 600;
}

.meal-date.is-today { color: var(--accent); }
.meal-date .pill { border-color: var(--accent); color: var(--accent); }

.meal-row { min-height: 56px; }

.meal-slot {
    flex: none;
    width: 70px;
    color: var(--muted);
    font-size: 15px;
}

.row-title.is-empty { color: var(--muted); }

/* A meal's dishes and a recipe's ingredients, in their editors. */
.dish-list .item, .ingredient-list .item {
    gap: 10px;
    min-height: 54px;
}

/* The add box inside an editor, rather than pinned above a list. Without min-width, its two boxes and
   button would make it wider than the form instead of narrowing to fit. */
.add-bar.is-inline {
    position: static;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: none;
}

/* The name takes the room, so the quantity and the × line up on the right. */
.ingredient-list .item-name { flex: 1; }

.dish-suggestions .chip { min-height: 36px; padding: 0 14px; }

.recipe-search { margin-bottom: 8px; }
.recipe-link { justify-self: start; padding: 4px 0; }

/* What the week's meals need: ticked things go on the shopping list. */
.ingredient-picks .item-toggle { text-align: left; }

.item.is-listed {
    gap: 10px;
    min-height: 58px;
    color: var(--muted);
}

.shopping-add { margin-top: 18px; }

.notice-link {
    margin-left: 4px;
    color: var(--accent);
    font-weight: 600;
}

/* ---------- Trips ---------- */

/* How long until a trip: beside it in the list, and after its dates on its page. */
.trip-countdown {
    flex: none;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* Under way. */
.trip-countdown.is-now { background: var(--accent); color: var(--accent-ink); }

/* Ideas and trips gone by: quieter tiles. */
.trip-row.is-quiet .row-icon { background: var(--surface-press); color: var(--muted); }

.trip-lead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.trip-budget { display: grid; gap: 8px; }

.budget-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.budget-bar {
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-press);
    overflow: hidden;
}

.budget-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.budget-bar.is-over span { background: var(--danger); }

.budget-left { margin: 0; color: var(--muted); font-size: 15px; }
.budget-left.is-over { color: var(--danger); font-weight: 600; }

.money-section .wide-link { margin-top: 10px; }

/* Notes keep the lines they were written in. */
.trip-notes {
    margin: 8px 0 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.packing-for { margin: 2px 0 10px; }
.packing-usual .confirm-row { margin-top: 12px; }

/* ---------- Prices ---------- */

/* "Cheapest", "−12%", "No saving" beside a price. */
.price-pill {
    flex: none;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-press);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.price-pill.is-good { background: var(--accent-soft); color: var(--accent); }
.price-pill.is-bad { background: var(--danger-soft); color: var(--danger); }

/* A price that isn't a link: a shop's price now, one in the history, a shop's total. */
.price-row {
    gap: 10px;
    min-height: 58px;
}

.price-row .row-text { padding: 8px 0; }

/* What a new price means, under it as it's typed. */
.price-verdict {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: var(--radius-control);
    background: var(--surface-press);
    font-size: 15px;
}

.price-verdict p { margin: 0; }
.price-verdict.is-good { background: var(--accent-soft); color: var(--accent); }
.price-verdict.is-bad { background: var(--danger-soft); color: var(--danger); }

.price-search { margin-top: 16px; }
.price-products { margin-top: 10px; }

/* Under the shopping list's add box: where the list is cheapest. */
.prices-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 8px;
    color: var(--accent);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.prices-hint .icon { width: 18px; height: 18px; }
.prices-hint .chevron { color: inherit; }

/* ---------- Savings ---------- */

/* A line of detail under a bar: how a goal is going, or what a month added. */
.category-line .row-meta { grid-column: 1 / -1; }

/* Goals in the list: the same bars as the spending by category, as links. */
.goal-row .row-link { padding: 12px 0; }

.goal-summary { display: grid; gap: 8px; }
.goal-summary .budget-left.is-good { color: var(--accent); font-weight: 600; }

.goal-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.goal-actions a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    border-radius: var(--radius-control);
    font-weight: 600;
    text-decoration: none;
}

.goal-actions .icon { width: 20px; height: 20px; }

.goal-put { background: var(--accent); color: var(--accent-ink); }
.goal-put:active { opacity: 0.85; }

.goal-take {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--accent);
}

.goal-take:active { background: var(--surface-press); }

/* Money taken out: quieter than money put in, but not a warning. */
.row-icon.is-out { background: var(--surface-press); color: var(--muted); }
.money.is-out { color: var(--muted); }

/* How a trip's savings goal is going, or the link to start one, under its budget. */
.trip-savings { margin-top: 10px; }

/* ---------- Together ---------- */

/* Places, to watch, gifts. */
.together-tabs { margin-bottom: 14px; }
.together-tabs button { padding: 0 6px; }

.together-filter { margin-top: 4px; }
.together-filter .chip { min-height: 36px; padding: 0 14px; }

/* A button, which unlike a link doesn't stretch to the page's width by itself. */
.pick-button { width: 100%; margin-top: 14px; }

/* The one picked at random. */
.pick-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-card);
    background: var(--accent-soft);
    color: inherit;
    text-decoration: none;
}

.pick-card:active { opacity: 0.85; }
.pick-card .row-icon { background: var(--surface); }

.pick-label {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

.pick-title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

/* Tried, watched or given: quieter tiles. */
.row-icon.is-quiet { background: var(--surface-press); color: var(--muted); }

/* A gift kept secret from the other one. */
.row-lock { flex: none; display: grid; color: var(--muted); }
.row-lock .icon { width: 18px; height: 18px; }

.gift-birthday {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.gift-birthday .icon { width: 18px; height: 18px; }
.gift-birthday.is-soon { color: var(--accent); font-weight: 600; }

/* ---------- Paperwork ---------- */

.paper-filter .chip { min-height: 36px; padding: 0 14px; }

/* How near a date is: in red once it's come, in colour while it's coming up. */
.paper-countdown {
    flex: none;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-press);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.paper-countdown.is-soon { background: var(--accent-soft); color: var(--accent); }
.paper-countdown.is-late { background: var(--danger-soft); color: var(--danger); }

/* Where a paper stands, and dealing with it, above its details. */
.paper-status { display: grid; gap: 10px; margin-bottom: 20px; }
.paper-status .field-hint { margin: 0; }

.paper-status-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 600;
}

.paper-done {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: var(--radius-control);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

.paper-done:disabled { opacity: 0.5; }
.paper-done .icon { width: 20px; height: 20px; }

/* ---------- Notes ---------- */

.new-list { margin-top: 0; margin-bottom: 6px; }

/* The start of a note, two lines at most. */
.note-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* A note keeps the lines it was written in. */
.note-body {
    margin: 4px 0 12px;
    white-space: pre-line;
    overflow-wrap: anywhere;
    font-size: 17px;
    line-height: 1.5;
}

.note-add { margin: 4px 0 8px; }

/* A round button beside a row: call someone, show or copy a code. */
.round-action {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--accent);
    text-decoration: none;
}

.round-action:active { background: var(--surface-press); }
.round-action[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.round-action .icon { width: 20px; height: 20px; }

.contact-row, .detail-row { gap: 8px; }
.contact-row .row-link .avatar { width: 40px; height: 40px; }

.contact-actions { margin: 0 0 20px; }

/* Codes keep their length to themselves while hidden. */
.detail-value { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.detail-value.is-hidden { letter-spacing: 0.15em; }

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

.meter-add { margin-bottom: 8px; }
.meter-form { display: grid; gap: 10px; }
.meter-form .primary-button { margin-top: 0; }

/* The reading, big, with the meter's unit beside it. */
.reading-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reading-field .field-input {
    flex: 1;
    min-width: 0;
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* The last reading, as a hint, mustn't look like one already typed. */
.reading-field .field-input::placeholder { font-weight: 400; }

.reading-unit {
    flex: none;
    color: var(--muted);
    font-size: 18px;
    font-weight: 600;
}

.meter-average { margin-top: 14px; }

.reading-row {
    gap: 8px;
    min-height: 62px;
}

.reading-used { color: var(--muted); font-weight: 600; }

/* ---------- Reminders ---------- */

.device-card { display: grid; gap: 12px; }

.device-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.device-status { margin: 0; }
.device-card .primary-button { margin-top: 0; }
.device-message { margin: 0; }

.reminder-options { margin-top: 24px; }

/* ---------- Sign in ---------- */

.auth {
    max-width: 400px;
    margin: 0 auto;
    padding:
        calc(env(safe-area-inset-top) + 15vh)
        calc(env(safe-area-inset-right) + 24px)
        calc(env(safe-area-inset-bottom) + 32px)
        calc(env(safe-area-inset-left) + 24px);
}

.auth-title {
    margin: 0;
    font-size: 44px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--accent);
}

.auth-lead {
    margin: 10px 0 28px;
    color: var(--muted);
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form label {
    display: grid;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
}

.auth-form input {
    height: 50px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--surface);
    font-size: 17px;
    font-weight: 400;
}

.auth-form input:focus { border-color: var(--accent); outline: none; }

.form-error {
    margin: 0;
    color: var(--danger);
    font-size: 15px;
}

.primary-button {
    height: 52px;
    margin-top: 6px;
    border: 0;
    border-radius: var(--radius-control);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

.primary-button:disabled { opacity: 0.5; }

.auth-switch { margin-top: 12px; }

/* ---------- App-level banners ---------- */

/* Banners float above the tab bar when there is one. */
body:has(.tabbar) { --banner-offset: var(--tabbar-height); }

.update-banner, .error-ui {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 16px + var(--banner-offset, 0px));
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 14px;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 10px 10px 10px 18px;
    border-radius: var(--radius-pill);
    background: var(--ink);
    color: var(--bg);
    font-size: 15px;
}

.update-banner[hidden] { display: none; }

.update-banner button {
    padding: 8px 16px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

.error-ui { display: none; padding-right: 18px; }
.error-ui .reload { color: inherit; font-weight: 600; }

/* "Done", with Undo, after ticking a task. */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 12px + var(--banner-offset, 0px));
    z-index: 9;
    display: flex;
    align-items: center;
    gap: 12px;
    width: calc(100vw - 32px);
    max-width: 528px;
    padding: 10px 10px 10px 18px;
    border-radius: 18px;
    background: var(--ink);
    color: var(--bg);
    font-size: 15px;
    transform: translateX(-50%);
    animation: toast-in 180ms ease-out;
}

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

.toast-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.toast-detail { opacity: 0.8; font-size: 14px; }

.toast button {
    flex: none;
    padding: 8px 16px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .is-checked .item-name::after, .toast { animation: none; }
    .switch, .switch::before { transition: none; }
}
