/* ==========================================================================
   Family Organizer — web frontend
   Material-3-flavoured design tokens seeded from the same teal the Flutter
   app uses (ColorScheme.fromSeed(Colors.teal)).
   ========================================================================== */

:root {
    --primary: #006a60;
    --on-primary: #ffffff;
    --primary-container: #9ef2e4;
    --on-primary-container: #00201c;
    --secondary-container: #cce8e3;
    --on-secondary-container: #051f1c;
    --tertiary-container: #dbe2f9;
    --on-tertiary-container: #131b2c;

    /* M3 surface roles as ColorScheme.fromSeed(Colors.teal) produces them. The scaffold, app
       bar and plain list tiles are all `surface`, as in the app; cards are container-low. */
    --background: #f4fbf8;
    --surface: #f4fbf8;
    --surface-container-low: #eff5f2;
    --surface-container: #e9efec;
    --surface-container-high: #e3eae7;
    --surface-container-highest: #dde4e1;
    --surface-1: var(--surface-container-low);
    --surface-2: var(--surface-container);
    --surface-3: var(--surface-container-high);
    --inverse-surface: #2b3230;
    --inverse-on-surface: #ecf2ef;
    --on-surface: #161d1c;
    --on-surface-variant: #3f4947;
    --outline: #6f7977;
    --outline-variant: #bec9c6;
    --outline-faint: #dde4e1;

    --error: #ba1a1a;
    --on-error: #ffffff;
    --error-container: #ffdad6;
    --on-error-container: #410002;
    --success: #2e7d32;
    --warning: #9a6700;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .10), 0 1px 3px rgba(0, 0, 0, .06);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .08);
    --shadow-3: 0 8px 28px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .10);

    --radius-s: 8px;
    --radius-m: 12px;
    --radius-l: 16px;
    --radius-xl: 28px;
    --radius-full: 999px;

    --nav-h: 44px;
    --bar-h: 64px;
    --sidebar-w: 248px;
    --content-max: 980px;

    /* Roboto first: it is the system font on Android, where the app runs. */
    --font: Roboto, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
    --primary: #82d5c8;
    --on-primary: #003731;
    --primary-container: #005048;
    --on-primary-container: #9ef2e4;
    --secondary-container: #334b47;
    --on-secondary-container: #cce8e3;
    --tertiary-container: #3b4664;
    --on-tertiary-container: #dbe2f9;

    --background: #0e1513;
    --surface: #0e1513;
    --surface-container-low: #161d1c;
    --surface-container: #1a2120;
    --surface-container-high: #252b2a;
    --surface-container-highest: #2f3635;
    --inverse-surface: #dde4e1;
    --inverse-on-surface: #2b3230;
    --on-surface: #dde4e1;
    --on-surface-variant: #bec9c6;
    --outline: #899390;
    --outline-variant: #3f4947;
    --outline-faint: #2f3635;

    --error: #ffb4ab;
    --on-error: #690005;
    --error-container: #93000a;
    --on-error-container: #ffdad6;
    --success: #7fd487;
    --warning: #f0c05a;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .40);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, .45);
    --shadow-3: 0 10px 34px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overscroll-behavior-y: none;
}

body {
    font-family: var(--font);
    background: var(--background);
    color: var(--on-surface);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

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

a { color: var(--primary); text-decoration: none; }

.app-root { height: 100%; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--outline-faint); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline); }
::-webkit-scrollbar-track { background: transparent; }

/* ── boot splash ─────────────────────────────────────────────────────────── */

.boot-splash {
    height: 100%;
    display: grid;
    place-items: center;
}

.boot-spinner, .spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--outline-faint);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.spinner.sm { width: 18px; height: 18px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── generic atoms ───────────────────────────────────────────────────────── */

.icon { width: 24px; height: 24px; flex: none; display: block; }
.icon.sm { width: 18px; height: 18px; }
.icon.lg { width: 32px; height: 32px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: none;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--on-primary);
    min-height: 40px;
    padding: .55rem 1.5rem;
    font-size: .875rem;
    font-weight: 500;
    letter-spacing: .1px;
    cursor: pointer;
    transition: filter .15s, background .15s, transform .08s;
}

.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }

.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.outline { background: transparent; color: var(--on-surface); box-shadow: inset 0 0 0 1px var(--outline); }
.btn.outline:hover { background: var(--surface-2); }
.btn.danger { background: var(--error); color: var(--on-error); }
.btn.danger.ghost { background: transparent; color: var(--error); }
.btn.block { width: 100%; }
/* M3 TextButton, e.g. "Save" in an app bar. */
.btn.text { background: transparent; color: var(--primary); padding: .55rem .75rem; }
.btn.text:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); filter: none; }
/* FilledButton.tonalIcon in the error container ("Delete list"). */
.btn.tonal-danger { background: var(--error-container); color: var(--on-error-container); }
.btn.sm { padding: .4rem .9rem; font-size: .85rem; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--on-surface-variant);
    cursor: pointer;
    flex: none;
    transition: background .15s, color .15s;
}

.icon-btn:hover { background: var(--surface-2); color: var(--on-surface); }
.icon-btn.active { color: var(--primary); }
.icon-btn.danger:hover { background: var(--error-container); color: var(--on-error-container); }
.icon-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.xs { width: 32px; height: 32px; }
.icon-btn.xs .icon { width: 18px; height: 18px; }

.field { display: block; margin-bottom: 1rem; }
.field > .label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--on-surface-variant);
    margin-bottom: .35rem;
}

.input, .textarea, .select {
    width: 100%;
    background: var(--surface-1);
    border: 1px solid var(--outline-faint);
    border-radius: var(--radius-m);
    padding: .7rem .85rem;
    font-size: .95rem;
    outline: none;
    transition: border-color .15s, background .15s;
}

.input:focus, .textarea:focus, .select:focus {
    border-color: var(--primary);
    background: var(--surface);
}

.textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--on-surface-variant); opacity: .6; }
.input.invalid, .textarea.invalid { border-color: var(--error); }

.field-error { color: var(--error); font-size: .8rem; margin-top: .3rem; }

.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track {
    position: absolute; inset: 0;
    background: var(--surface-3);
    box-shadow: inset 0 0 0 2px var(--outline);
    border-radius: var(--radius-full);
    transition: background .18s, box-shadow .18s;
    cursor: pointer;
}
.switch .track::after {
    content: "";
    position: absolute;
    left: 5px; top: 5px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--outline);
    transition: transform .18s, background .18s, width .18s, height .18s, left .18s, top .18s;
}
.switch input:checked + .track { background: var(--primary); box-shadow: none; }
.switch input:checked + .track::after {
    transform: translateX(18px);
    background: var(--on-primary);
    width: 20px; height: 20px; left: 3px; top: 3px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .7rem;
    border-radius: var(--radius-full);
    background: var(--surface-2);
    color: var(--on-surface-variant);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}

.chip.accent { background: var(--primary-container); color: var(--on-primary-container); }
.chip.tertiary { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.chip.danger { background: var(--error-container); color: var(--on-error-container); }

/* M3 Card as Flutter draws it: radius 12, surfaceContainerLow, elevation 1, no outline. */
.card, .m3-card {
    background: var(--surface-container-low);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-1);
}

/* Section headers in the app are titleSmall, sentence case. */
.section-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--on-surface-variant);
    margin: 1.25rem .25rem .5rem;
}

.muted { color: var(--on-surface-variant); }
.small { font-size: .82rem; }
.row { display: flex; align-items: center; gap: .6rem; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }
.hidden { display: none !important; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    padding: 3.5rem 1.5rem;
    text-align: center;
    color: var(--on-surface-variant);
}

.empty-state .icon { width: 64px; height: 64px; stroke-width: 1.5; margin-bottom: .5rem; }
.empty-state .title { font-size: 1rem; font-weight: 500; color: var(--on-surface); }
.empty-state .hint { font-size: .88rem; max-width: 300px; }

.error-state {
    margin: 1rem 0;
    padding: .85rem 1rem;
    border-radius: var(--radius-m);
    background: var(--error-container);
    color: var(--on-error-container);
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
}

.loading-block { display: grid; place-items: center; padding: 3rem 0; }

/* The app's error screen: centred icon, message, filled Retry. */
.center-state {
    display: flex; flex-direction: column; align-items: center; gap: .75rem;
    padding: 3rem 1.5rem; text-align: center;
}
.center-state > .icon { width: 48px; height: 48px; color: var(--error); }
.center-state .title { font-size: 1rem; font-weight: 500; }

.inline-error {
    display: flex; align-items: center; gap: .5rem;
    padding: .6rem .75rem; margin-bottom: .75rem;
    border-radius: var(--radius-s);
    background: var(--error-container); color: var(--on-error-container); font-size: .8rem;
}
.inline-error[hidden] { display: none; }

/* Fields as the app lays them out: labelMedium above, 24px between sections. */
.edit-form { display: flex; flex-direction: column; gap: 1.5rem; padding: .25rem 0 2rem; }
.m3-field { display: flex; flex-direction: column; gap: .5rem; }
.m3-field > .label { font-size: .75rem; font-weight: 500; letter-spacing: .5px; color: var(--on-surface-variant); }
.text-link { display: inline-flex; align-items: center; gap: .4rem; font-size: .875rem; font-weight: 500; align-self: flex-start; margin-top: -1rem; }
.select-with-dot { position: relative; display: block; }
.select-with-dot .dot { position: absolute; left: .85rem; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; pointer-events: none; }
.select-with-dot .select { padding-left: 2.2rem; }

/* ── avatar ──────────────────────────────────────────────────────────────── */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex: none;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .9rem;
    color: var(--on-primary-container);
    background: var(--primary-container);
    overflow: hidden;
    user-select: none;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xs { width: 28px; height: 28px; font-size: .72rem; }
.avatar.lg { width: 76px; height: 76px; font-size: 1.6rem; }
.avatar.xl { width: 104px; height: 104px; font-size: 2.2rem; }

/* ── app shell ───────────────────────────────────────────────────────────── */

.shell {
    height: 100%;
    display: flex;
    background: var(--background);
}

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: var(--surface-container-low);
    display: flex;
    flex-direction: column;
    padding: 1rem .75rem;
    gap: .2rem;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .6rem 1.1rem;
    font-weight: 700;
    font-size: 1.05rem;
}

.sidebar .brand .icon { color: var(--primary); }

.nav-link {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem .8rem;
    border-radius: var(--radius-full);
    color: var(--on-surface-variant);
    font-weight: 600;
    font-size: .93rem;
    cursor: pointer;
    position: relative;
    transition: background .15s, color .15s;
}

.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--secondary-container); color: var(--on-secondary-container); }
.sidebar.sub .nav-link.active { background: color-mix(in srgb, var(--secondary-container) 60%, transparent); }

.nav-badge {
    position: absolute;
    top: 6px;
    left: 26px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--radius-full);
    background: var(--error);
    color: var(--on-error);
    font-size: .65rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    line-height: 1;
}

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

/* The app's M3 AppBar: surface colour, no rule, titleLarge, tinted once content scrolls under. */
.topbar {
    height: var(--bar-h);
    flex: none;
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: 0 .25rem 0 .25rem;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 20;
    transition: background .2s;
}
.topbar.scrolled { background: var(--surface-container); }

.topbar .title {
    font-size: 1.375rem;
    font-weight: 400;
    line-height: 1.75rem;
    padding: 0 .75rem;
    min-width: 0;
}
.topbar .icon-btn + .title { padding-left: .25rem; }
.topbar-actions { display: flex; align-items: center; gap: .1rem; }
.topbar-avatar { display: grid; place-items: center; width: 48px; height: 48px; margin-right: .25rem; }
.topbar-avatar .avatar { width: 32px; height: 32px; font-size: .8rem; }

/* Shown while API answers come from the service worker's saved copies (see ui/api.js). */
.offline-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .9rem;
    font-size: .84rem;
    background: var(--tertiary-container);
    color: var(--on-tertiary-container);
    border-bottom: 1px solid var(--outline-faint);
}
.offline-bar[hidden] { display: none; }

.view {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.view-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 1rem 1rem 6rem;
}

.view.flush .view-inner { max-width: none; padding: 0; height: 100%; }

.bottom-nav { display: none; }

.fab {
    position: fixed;
    right: max(1.1rem, env(safe-area-inset-right));
    bottom: calc(1.4rem + env(safe-area-inset-bottom));
    height: 56px;
    min-width: 56px;
    padding: 0 1.1rem;
    border: none;
    border-radius: 16px;
    background: var(--primary-container);
    color: var(--on-primary-container);
    box-shadow: var(--shadow-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 30;
    transition: transform .1s;
}

.fab:active { transform: scale(.96); }

@media (max-width: 860px) {
    .sidebar { display: none; }

    /* The app's _NavBar: surfaceContainer, no rule, the pill wraps icon and label, and it is
       faded on a screen pushed on top of a section (home_screen.dart, `filled`). */
    .bottom-nav {
        display: flex;
        height: calc(var(--nav-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        flex: none;
        background: var(--surface-container);
        z-index: 25;
    }

    .bottom-nav .nav-item {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--on-surface-variant);
        cursor: pointer;
        min-width: 0;
    }

    /* Icons only, like the app's bar: the label is the link's title/aria-label. */
    .bottom-nav .nav-item .pill {
        display: flex;
        align-items: center;
        max-width: 100%;
        padding: 4px 16px;
        border-radius: 20px;
        transition: background .2s ease-in-out;
        position: relative;
    }

    .bottom-nav .nav-item.active { color: var(--on-secondary-container); }
    .bottom-nav .nav-item.active .pill { background: var(--secondary-container); }
    .bottom-nav.sub .nav-item.active .pill { background: color-mix(in srgb, var(--secondary-container) 60%, transparent); }
    .bottom-nav.sub .nav-item:not(.active) { color: color-mix(in srgb, var(--on-surface-variant) 50%, transparent); }
    .bottom-nav .nav-badge { top: 0; left: auto; right: 4px; }

    .fab { bottom: calc(var(--nav-h) + .9rem + env(safe-area-inset-bottom)); }
    .view-inner { padding: .85rem .85rem 5rem; }
}

/* ── M3 list tiles (Flutter ListTile on the scaffold) ────────────────────── */

.tile-list { display: flex; flex-direction: column; margin: 0 -1rem; }
.tile {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 56px;
    padding: 8px 16px;
    color: var(--on-surface);
    cursor: pointer;
    position: relative;
    transition: background .12s;
}
.tile:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.tile > .icon:first-child { color: var(--on-surface-variant); }
.tile .title { font-size: 1rem; line-height: 1.5rem; }
.tile .sub { font-size: .875rem; color: var(--on-surface-variant); }
.tile.hidden-item > .icon:first-child, .tile.hidden-item .title { opacity: .4; }
.divider { height: 1px; background: var(--outline-variant); margin: .5rem -1rem; }
.nav-hint { margin: 0 0 .5rem; font-size: .875rem; color: var(--on-surface-variant); }

/* Flutter's M3 Checkbox: 18px box, 2px onSurfaceVariant border, primary when on. */
.m3-check {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 50%;
    cursor: pointer;
    flex: none;
    color: transparent;
    position: relative;
}
.m3-check::before {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    border: 2px solid var(--on-surface-variant);
    border-radius: 2px;
    box-sizing: border-box;
}
.m3-check .icon { width: 14px; height: 14px; position: relative; stroke-width: 3; }
.m3-check.on { color: var(--on-primary); }
.m3-check.on::before { background: var(--primary); border-color: var(--primary); }
.m3-check.locked { opacity: .38; cursor: default; }
.m3-check:hover { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }

.drag-handle { display: grid; place-items: center; width: 32px; height: 40px; color: var(--on-surface-variant); cursor: grab; touch-action: none; }
.nav-tile { transition: transform .15s; background: var(--surface); }
.nav-tile.dragging { transition: none; z-index: 2; box-shadow: var(--shadow-2); background: var(--surface-container-low); }

/* ── list rows ───────────────────────────────────────────────────────────── */

/* A Card of ListTiles, as the app groups settings, members and chats: radius 12, dividers
   indented past the leading icon. */
.list {
    display: flex;
    flex-direction: column;
    background: var(--surface-container-low);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.list > * + * { position: relative; }
.list > * + *::before {
    content: ""; position: absolute; top: 0; left: 56px; right: 0; height: 1px;
    background: var(--outline-variant); pointer-events: none;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: transparent;
    min-height: 56px;
}

a.list-row { color: inherit; text-decoration: none; }
.list-row.tappable { cursor: pointer; transition: background .12s; }
.list-row.tappable:hover { background: color-mix(in srgb, var(--on-surface) 5%, transparent); }
.list-row .title { font-size: 1rem; line-height: 1.5rem; }
.list-row .sub { font-size: .875rem; color: var(--on-surface-variant); }

.cards { display: grid; gap: .8rem; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ── login ───────────────────────────────────────────────────────────────── */

.login-page {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.2rem 1rem 5rem;
    background:
        radial-gradient(1100px 620px at 12% -10%, color-mix(in srgb, var(--primary) 26%, transparent), transparent 62%),
        radial-gradient(900px 520px at 108% 6%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 60%),
        var(--background);
}

.login-shell {
    width: 100%;
    max-width: 960px;
    margin: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.6rem;
    align-items: stretch;
}

.login-card, .promo-card {
    background: var(--surface);
    border: 1px solid var(--outline-faint);
    border-radius: 26px;
    box-shadow: var(--shadow-3);
    padding: 2rem 1.9rem;
}

.login-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.4rem; }
.login-brand .logo {
    width: 52px; height: 52px;
    border-radius: 16px;
    display: grid; place-items: center;
    background: var(--primary-container);
    color: var(--on-primary-container);
}
.login-brand h1 { margin: 0; font-size: 1.35rem; letter-spacing: -.01em; }
.login-brand p { margin: .15rem 0 0; font-size: .85rem; color: var(--on-surface-variant); }

.promo-card {
    background: linear-gradient(155deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 72%, #000) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

:root[data-theme="dark"] .promo-card { color: var(--on-primary); }

.promo-card h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; }
.promo-card p { margin: 0; opacity: .88; font-size: .93rem; line-height: 1.55; }

.promo-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .75rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, .18);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    background: #fff;
    color: #0d3b36;
    border: none;
    border-radius: 16px;
    padding: .95rem 1.3rem;
    font-size: 1.02rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
    transition: transform .12s, box-shadow .12s;
}

.download-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
.download-btn:active { transform: translateY(0); }
.download-btn .sub { display: block; font-size: .72rem; font-weight: 600; opacity: .62; margin-top: .2rem; line-height: 1.3; }
.download-btn .lines { text-align: left; line-height: 1.25; }

.promo-note { font-size: .78rem; opacity: .75; }

.login-tabs { display: flex; gap: .4rem; margin-bottom: 1.2rem; }
.login-tabs button {
    flex: 1;
    border: none;
    background: var(--surface-2);
    color: var(--on-surface-variant);
    border-radius: var(--radius-full);
    padding: .55rem;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
}
.login-tabs button.active { background: var(--primary); color: var(--on-primary); }

.cog-btn {
    position: fixed;
    right: max(1.2rem, env(safe-area-inset-right));
    bottom: calc(1.2rem + env(safe-area-inset-bottom));
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--outline-faint);
    color: var(--on-surface-variant);
    box-shadow: var(--shadow-2);
    z-index: 40;
    transition: color .2s, transform .3s, background .2s;
}

.cog-btn:hover { color: var(--primary); transform: rotate(45deg); }

.login-foot {
    margin-top: 1.4rem;
    text-align: center;
    font-size: .76rem;
    color: var(--on-surface-variant);
}

@media (max-width: 820px) {
    .login-shell { grid-template-columns: 1fr; gap: 1.1rem; }
    .login-card, .promo-card { padding: 1.5rem 1.25rem; border-radius: 22px; }
    .promo-card { order: -1; }
}

/* ── dialogs / sheets ────────────────────────────────────────────────────── */

.scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
    animation: fade .16s ease-out;
}

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.dialog {
    width: 100%;
    max-width: 460px;
    max-height: min(86vh, 760px);
    display: flex;
    flex-direction: column;
    background: var(--surface-container-high);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-3);
    animation: rise .18s ease-out;
    overflow: hidden;
}

.dialog.wide { max-width: 640px; }

.dialog-head {
    padding: 1.5rem 1.5rem .5rem;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 2rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.dialog-body { padding: .8rem 1.4rem; overflow-y: auto; flex: 1; }
.dialog-body > p { margin: .2rem 0 .6rem; color: var(--on-surface-variant); line-height: 1.55; }

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: .8rem 1.1rem 1.1rem;
    flex-wrap: wrap;
}

.toast-host {
    position: fixed;
    left: 50%;
    bottom: calc(1.4rem + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: .5rem;
    z-index: 200;
    pointer-events: none;
    width: min(92vw, 460px);
}

/* Flutter's SnackBar: inverseSurface, radius 4. */
.toast {
    background: var(--inverse-surface);
    color: var(--inverse-on-surface);
    padding: .875rem 1rem;
    border-radius: 4px;
    box-shadow: var(--shadow-3);
    font-size: .88rem;
    animation: rise .18s ease-out;
    display: flex;
    align-items: center;
    gap: .55rem;
}

.toast.error { background: var(--error); color: var(--on-error); }

@media (max-width: 860px) {
    .toast-host { bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); }
}

/* ── shopping ────────────────────────────────────────────────────────────── */
/* Dense, like the app: one column of 12px-radius cards, 8px apart. */

.m3-cards { display: flex; flex-direction: column; gap: 8px; margin: 0 -.25rem; }
.m3-cards.tight { gap: 4px; }

.shop-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background .12s;
}
.shop-card:hover { background: color-mix(in srgb, var(--on-surface) 4%, var(--surface-container-low)); }
.shop-card .text { flex: 2; min-width: 0; }
.shop-card .name { font-weight: 600; font-size: 1rem; line-height: 1.5rem; }
.shop-card .meta { font-size: .875rem; color: var(--on-surface-variant); }
.shop-card .chips { flex: 3; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* CircleAvatar with the list colour at ~12 % behind the icon in the full colour. */
.list-avatar {
    width: 40px; height: 40px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--c) 12%, transparent);
    color: var(--c);
}
.list-avatar.xl { width: 72px; height: 72px; border: 2px solid var(--c); }
.list-preview { display: flex; justify-content: center; }

/* The app's _CategoryChip. */
.cat-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 6px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--c) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 31%, transparent);
    color: var(--c);
    font-size: 11px; font-weight: 600; line-height: 16px;
    white-space: nowrap; flex: none;
}
.cat-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }

/* CategoryDivider: colour bar, name in the category colour, count, chevron. */
.cat-divider {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 4px 4px;
    cursor: pointer; user-select: none;
    -webkit-touch-callout: none;
}
.cat-divider .bar { width: 3px; height: 16px; border-radius: 2px; background: var(--c); flex: none; }
.cat-divider .name { font-size: 12px; font-weight: 700; letter-spacing: .5px; color: var(--c); }
.cat-divider .count { font-size: 11px; font-weight: 500; color: var(--on-surface-variant); }
.cat-divider .icon { color: var(--on-surface-variant); transition: transform .2s; }
.cat-divider.collapsed .icon { transform: rotate(-90deg); }

.checked-divider {
    display: flex; align-items: center; gap: 8px;
    padding: 4px; font-size: 11px; font-weight: 500; color: var(--on-surface-variant);
}
.checked-divider span { flex: 1; height: 1px; background: var(--outline-variant); }

.shop-items { display: flex; flex-direction: column; gap: 8px; margin: 0 -.25rem; }
.shop-items .cat-divider + .swipe-row, .shop-items .swipe-row + .swipe-row { margin-top: -2px; }

/* One item = one compact card: checkbox, name (+ chip) / quantity, − n +. Tapping it ticks it. */
.item-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    min-height: 44px;
    background: var(--surface-container-low);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-1);
    cursor: pointer;
    -webkit-touch-callout: none;
    user-select: none;
}
.item-row .text { flex: 1; min-width: 0; padding: 4px 0; }
.item-row .name-line { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.item-row .name { font-size: .875rem; line-height: 1.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.item-row .qty { font-size: .75rem; color: var(--on-surface-variant); line-height: 1rem; }
.item-row.checked .name, .item-row.checked .qty { text-decoration: line-through; color: var(--on-surface-variant); }
.item-row .m3-check { width: 36px; height: 36px; }

.amount-stepper { display: flex; align-items: center; flex: none; }
.amount-stepper .icon-btn { color: var(--primary); }
.item-row.checked .amount-stepper .icon-btn { color: var(--on-surface-variant); }
.amount-stepper .val { min-width: 28px; text-align: center; font-weight: 600; font-size: .875rem; }
.item-row.checked .amount-stepper .val { color: var(--on-surface-variant); }

/* The list screen's own bottom bar (no FAB): "delete checked" and "add item". */
.action-bar {
    flex: none;
    display: flex;
    height: 44px;
    background: var(--surface-container);
}
.bar-btn {
    flex: 1; border: none; background: transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.bar-btn:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.bar-btn.primary { color: var(--primary); }
.bar-btn.danger { color: var(--error); }

/* Add item: a search field over the whole library. */
.search-field {
    display: flex; align-items: center; gap: .5rem;
    padding: 0 .25rem 0 .75rem; margin: 0 0 .25rem;
    border: 1px solid var(--outline); border-radius: 4px; min-height: 52px;
    color: var(--on-surface-variant);
}
.search-field:focus-within { border: 2px solid var(--primary); padding-left: calc(.75rem - 1px); }
.search-field input { border: none; outline: none; background: transparent; font-size: 1rem; color: var(--on-surface); padding: .5rem 0; }
.tile.create, .tile.create .icon { color: var(--primary); }

/* Library rows and the category editor: cards with a leading icon. */
.lib-row { display: flex; align-items: center; gap: 16px; padding: 0 16px; min-height: 48px; cursor: pointer; }
.lib-row > .icon { color: var(--primary); }
.cat-row { display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 16px; min-height: 56px; background: var(--surface-container-low); transition: transform .15s; }
.cat-row.dragging { transition: none; z-index: 2; box-shadow: var(--shadow-3); }
.cat-row .prio { width: 28px; font-size: .75rem; font-weight: 600; color: var(--on-surface-variant); }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cat-dot.lg { width: 24px; height: 24px; }
.cat-row .icon-btn.danger { color: var(--error); }

/* Swipe left on an item (views/shopping.js): the row slides over a background that says what
   letting go will do - tick for an open item, remove for a crossed-out one. */
.swipe-row { position: relative; touch-action: pan-y; }
.swipe-row .swipe-fg { position: relative; transition: transform .18s ease-out; }
.swipe-row.swiping .swipe-fg { transition: none; }
.swipe-row.swiping { user-select: none; }
.swipe-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1.2rem;
    visibility: hidden;
}
.swipe-row.swiping .swipe-bg,
.swipe-row.leaving .swipe-bg { visibility: visible; }
.swipe-bg { border-radius: var(--radius-m); }
.swipe-bg.tick { background: var(--primary); color: var(--on-primary); }
.swipe-bg.remove { background: var(--error); color: var(--on-error); }
.swipe-bg svg { transition: transform .12s; }
.swipe-row.armed .swipe-bg svg { transform: scale(1.3); }

.suggestions {
    margin-top: .4rem;
    max-height: 230px;
    overflow-y: auto;
    border: 1px solid var(--outline-faint);
    border-radius: var(--radius-m);
    background: var(--surface);
}

.suggestions .sug {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .8rem;
    cursor: pointer;
    font-size: .92rem;
}

.suggestions .sug + .sug { border-top: 1px solid var(--outline-faint); }
.suggestions .sug:hover, .suggestions .sug.hl { background: var(--surface-2); }

.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }

.swatch {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: inset 0 0 0 2px transparent;
}

.swatch.sel { box-shadow: inset 0 0 0 2.5px var(--on-surface); }
.swatch.none { background: transparent; color: var(--on-surface-variant); box-shadow: inset 0 0 0 1px var(--outline); }
.swatch.none.sel { box-shadow: inset 0 0 0 2.5px var(--on-surface); }
.swatches.small .swatch { width: 32px; height: 32px; }

.icon-picks { display: flex; flex-wrap: wrap; gap: .45rem; }

.icon-pick {
    width: 48px; height: 48px;
    border-radius: 8px;
    border: 2px solid transparent;
    background: var(--surface-container-highest);
    color: var(--on-surface-variant);
    display: grid; place-items: center;
    cursor: pointer;
}

.icon-pick.sel { background: var(--primary-container); color: var(--on-primary-container); border-color: var(--primary); }

/* ── calendar ────────────────────────────────────────────────────────────── */

.cal-toolbar {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .8rem;
    flex-wrap: wrap;
}

.cal-month-label { font-weight: 700; font-size: 1.05rem; min-width: 9.5rem; }

.segmented {
    display: inline-flex;
    background: var(--surface-2);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 2px;
}

.segmented button {
    border: none;
    background: transparent;
    color: var(--on-surface-variant);
    padding: .35rem .8rem;
    border-radius: var(--radius-full);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.segmented button.active { background: var(--surface); color: var(--on-surface); box-shadow: var(--shadow-1); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--outline-faint);
    border-radius: var(--radius-l);
    padding: .6rem;
}

.cal-dow {
    text-align: center;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
    padding: .25rem 0 .4rem;
}

.cal-cell {
    min-height: 72px;
    border-radius: 12px;
    padding: .3rem;
    background: var(--surface-1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    transition: background .12s;
}

.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { opacity: .42; }
.cal-cell.sel { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-cell .dnum { font-size: .78rem; font-weight: 700; align-self: flex-end; padding: 1px 4px; }
.cal-cell.today .dnum { background: var(--primary); color: var(--on-primary); border-radius: var(--radius-full); min-width: 20px; text-align: center; }

.cal-pill {
    font-size: .66rem;
    line-height: 1.25;
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--primary-container);
    color: var(--on-primary-container);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-more { font-size: .62rem; color: var(--on-surface-variant); padding-left: 4px; }

.event-row {
    display: flex;
    gap: .85rem;
    padding: .8rem 1rem;
    background: var(--surface);
    cursor: pointer;
}

.event-row:hover { background: var(--surface-1); }
.event-row .stripe { width: 4px; border-radius: 2px; background: var(--primary); flex: none; }
.event-row .when { font-size: .78rem; color: var(--on-surface-variant); margin-top: .12rem; }

.day-head {
    font-size: .8rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    margin: 1.2rem .3rem .4rem;
    text-transform: capitalize;
}

@media (max-width: 620px) {
    .cal-cell { min-height: 58px; }
    .cal-cell .dnum { font-size: .72rem; }
}

/* ── chat ────────────────────────────────────────────────────────────────── */

.chat-layout { display: flex; height: 100%; min-height: 0; }

.chat-side {
    width: 300px;
    flex: none;
    border-right: 1px solid var(--outline-faint);
    overflow-y: auto;
    background: var(--surface);
}

.chat-peer {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--outline-faint);
}

.chat-peer:hover { background: var(--surface-1); }
.chat-peer.active { background: var(--secondary-container); color: var(--on-secondary-container); }
.chat-peer .name { font-weight: 600; font-size: .93rem; }
.chat-peer .preview { font-size: .78rem; color: var(--on-surface-variant); }
.chat-peer.active .preview { color: inherit; opacity: .8; }

.unread-dot {
    min-width: 20px; height: 20px;
    padding: 0 5px;
    border-radius: var(--radius-full);
    background: var(--error);
    color: var(--on-error);
    font-size: .68rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }

.chat-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    background: var(--background);
}

/* Keeps a short conversation pinned to the bottom without breaking scrolling. */
.chat-scroll > *:first-child { margin-top: auto; }

.chat-daysep {
    align-self: center;
    margin: .7rem 0 .4rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--on-surface-variant);
    background: var(--surface-2);
    padding: .2rem .7rem;
    border-radius: var(--radius-full);
}

.bubble {
    max-width: min(78%, 560px);
    padding: .55rem .8rem;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--outline-faint);
    align-self: flex-start;
    position: relative;
    box-shadow: var(--shadow-1);
}

.bubble.mine {
    align-self: flex-end;
    background: var(--primary-container);
    color: var(--on-primary-container);
    border-color: transparent;
}

.bubble .sender { font-size: .74rem; font-weight: 700; color: var(--primary); margin-bottom: .15rem; }
.bubble .text { font-size: .94rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .meta {
    display: flex;
    align-items: center;
    gap: .3rem;
    justify-content: flex-end;
    font-size: .66rem;
    opacity: .68;
    margin-top: .2rem;
}

.bubble .meta .icon { width: 14px; height: 14px; }
.bubble.pending { opacity: .72; }
.bubble.failed { border-color: var(--error); }

.bubble-actions {
    position: absolute;
    top: 2px;
    right: 100%;
    margin-right: 2px;
    opacity: 0;
    transition: opacity .12s;
}

.bubble:hover .bubble-actions { opacity: 1; }

.composer {
    flex: none;
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    padding: .7rem .8rem calc(.7rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--outline-faint);
    background: var(--surface);
}

.composer textarea {
    flex: 1;
    resize: none;
    max-height: 140px;
    min-height: 44px;
    border-radius: 22px;
    padding: .65rem 1rem;
    background: var(--surface-1);
    border: 1px solid var(--outline-faint);
    outline: none;
    line-height: 1.4;
}

.composer textarea:focus { border-color: var(--primary); }

.send-btn {
    width: 44px; height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: none;
}

.send-btn:disabled { opacity: .4; }

.ws-banner {
    font-size: .76rem;
    text-align: center;
    padding: .3rem;
    background: var(--warning);
    color: #1b1400;
}

@media (max-width: 860px) {
    .chat-side { display: none; }
    .chat-layout.list-mode .chat-side { display: block; width: 100%; border-right: none; }
    .chat-layout.list-mode .chat-main { display: none; }
}

/* ── meals ───────────────────────────────────────────────────────────────── */

.meal-day {
    display: flex;
    gap: .9rem;
    padding: .9rem 1rem;
    background: var(--surface);
}

.meal-day.today { background: color-mix(in srgb, var(--primary-container) 40%, var(--surface)); }

.meal-date {
    width: 46px;
    flex: none;
    text-align: center;
}

.meal-date .dow { font-size: .68rem; font-weight: 700; text-transform: uppercase; color: var(--on-surface-variant); }
.meal-date .num { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }

.meal-dish { font-weight: 650; font-size: 1rem; }
.meal-none { color: var(--on-surface-variant); font-style: italic; font-size: .92rem; }
.vote-line { font-size: .78rem; color: var(--on-surface-variant); margin-top: .25rem; }

.dish-card {
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--outline-faint);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-1);
    cursor: pointer;
}

.dish-card .name { font-weight: 650; font-size: 1.02rem; }
.dish-card .desc {
    font-size: .85rem;
    color: var(--on-surface-variant);
    margin-top: .25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-list { margin: .4rem 0 0; padding-left: 1.2rem; line-height: 1.7; }
.recipe-steps { counter-reset: step; list-style: none; padding: 0; margin: .4rem 0 0; }
.recipe-steps li {
    counter-increment: step;
    display: flex;
    gap: .7rem;
    padding: .45rem 0;
    line-height: 1.5;
}
.recipe-steps li::before {
    content: counter(step);
    flex: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--primary-container);
    color: var(--on-primary-container);
    display: grid; place-items: center;
    font-size: .78rem;
    font-weight: 700;
}

.line-edit { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; }

/* ── notes ───────────────────────────────────────────────────────────────── */

.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .8rem; }

.note-card {
    padding: .95rem 1rem;
    border-radius: var(--radius-m);
    border: 1px solid var(--outline-faint);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-height: 110px;
    box-shadow: var(--shadow-1);
    transition: transform .1s, box-shadow .15s;
}

.note-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.note-card .ntitle { font-weight: 650; font-size: .98rem; }
.note-card .nbody {
    font-size: .85rem;
    color: var(--on-surface-variant);
    white-space: pre-wrap;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    flex: 1;
}
.note-card .nfoot { display: flex; align-items: center; gap: .4rem; font-size: .72rem; color: var(--on-surface-variant); }

/* ── budget ──────────────────────────────────────────────────────────────── */

.budget-hero {
    padding: 1.6rem 1.4rem;
    border-radius: 26px;
    background: linear-gradient(150deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 70%, #000) 100%);
    color: #fff;
    box-shadow: var(--shadow-2);
}

:root[data-theme="dark"] .budget-hero { color: var(--on-primary); }

.budget-hero .lbl { font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; opacity: .85; font-weight: 700; }
.budget-hero .amount { font-size: 2.6rem; font-weight: 750; line-height: 1.1; margin-top: .2rem; }
.budget-hero .weekly { font-size: .85rem; opacity: .85; margin-top: .3rem; }
.budget-hero .bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .25); margin-top: 1rem; overflow: hidden; }
.budget-hero .bar > div { height: 100%; background: #fff; border-radius: 4px; transition: width .3s; }

.quick-amounts { display: flex; flex-wrap: wrap; gap: .5rem; }

.quick-amounts button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid var(--outline-faint);
    background: var(--surface);
    border-radius: var(--radius-full);
    padding: .5rem 1.05rem;
    font-weight: 650;
    cursor: pointer;
}

.quick-amounts button:hover { background: var(--surface-2); }

.entry-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; background: var(--surface); }
.entry-row .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.entry-row .amt.neg { color: var(--error); }
.entry-row .amt.pos { color: var(--success); }

/* ── settings / profile ──────────────────────────────────────────────────── */

.profile-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    padding: 1.6rem 1rem 1.2rem;
}

.profile-head .pname { font-size: 1.3rem; font-weight: 700; }
.profile-head .puser { font-size: .86rem; color: var(--on-surface-variant); }

.avatar-edit { position: relative; cursor: pointer; }

.avatar-edit .cam {
    position: absolute;
    right: -2px; bottom: -2px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    display: grid; place-items: center;
    border: 3px solid var(--background);
}

.drag-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; background: var(--surface); }
.drag-row.dragging { opacity: .45; }
.drag-row .handle { cursor: grab; color: var(--on-surface-variant); touch-action: none; }
