/* LifeDesk. Phone first; from 900px a side menu and multi-column pages. Light and dark follow the device. */
:root {
    color-scheme: light dark;
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f2f4f7;
    --border: #e3e6eb;
    --text: #101828;
    --muted: #667085;
    --brand: #2563eb;
    --brand-ink: #1d4ed8;
    --brand-soft: #eaf1ff;
    --on-brand: #ffffff;
    --hero-a: #0b1324;
    --hero-b: #1b2a4a;
    --green: #067647;
    --orange: #b54708;
    --red: #b42318;
    --warn-bg: #fffaeb;
    --warn-border: #fedf89;
    --warn-text: #7a2e0e;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-up: 0 1px 3px rgba(16, 24, 40, 0.08), 0 8px 20px rgba(16, 24, 40, 0.06);
    --radius: 0.875rem;
    --tab-h: 4rem;
    /* charts: series 1 and 2 pass the colour-blind checks on --surface in both modes */
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --wash: rgba(42, 120, 214, 0.1);
    --good: #0ca30c;
    --warning: #fab219;
    --critical: #d03b3b;
}
/* Dark colours: used when the device is dark (unless Light is chosen in Account), or when Dark is chosen. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        color-scheme: dark;
        --bg: #0b0f17;
        --surface: #131926;
        --surface-2: #1b2333;
        --border: #283246;
        --text: #eef1f6;
        --muted: #98a2b3;
        --brand: #3b82f6;
        --brand-ink: #93c5fd;
        --brand-soft: #172554;
        --on-brand: #ffffff;
        --hero-a: #0f172a;
        --hero-b: #1e3a8a;
        --green: #47cd89;
        --orange: #fdb022;
        --red: #f97066;
        --warn-bg: #3b2a08;
        --warn-border: #7a5a12;
        --warn-text: #fedf89;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        --shadow-up: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 20px rgba(0, 0, 0, 0.35);
        --series-1: #3987e5;
        --series-2: #d95926;
        --wash: rgba(57, 135, 229, 0.12);
    }
}
:root[data-theme='dark'] {
    color-scheme: dark;
    --bg: #0b0f17;
    --surface: #131926;
    --surface-2: #1b2333;
    --border: #283246;
    --text: #eef1f6;
    --muted: #98a2b3;
    --brand: #3b82f6;
    --brand-ink: #93c5fd;
    --brand-soft: #172554;
    --on-brand: #ffffff;
    --hero-a: #0f172a;
    --hero-b: #1e3a8a;
    --green: #47cd89;
    --orange: #fdb022;
    --red: #f97066;
    --warn-bg: #3b2a08;
    --warn-border: #7a5a12;
    --warn-text: #fedf89;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-up: 0 1px 3px rgba(0, 0, 0, 0.5), 0 8px 20px rgba(0, 0, 0, 0.35);
    --series-1: #3987e5;
    --series-2: #d95926;
    --wash: rgba(57, 135, 229, 0.12);
}
:root[data-theme='light'] {
    color-scheme: light;
}
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html {
    -webkit-text-size-adjust: 100%;
}
body {
    margin: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p {
    margin: 0;
}
h1 {
    font-size: 1.4rem;
    letter-spacing: -0.01em;
}
h2 {
    font-size: 1rem;
}
h3 {
    font-size: 0.72rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 0.25rem;
}
small {
    font-size: 0.76rem;
    color: var(--muted);
}
a {
    color: var(--brand-ink);
    text-decoration: none;
}
button,
input,
select {
    font: inherit;
    color: inherit;
}
.ic {
    width: 1.25em;
    height: 1.25em;
    flex: none;
    vertical-align: -0.22em;
}

/* ---------- layout ---------- */
.app {
    min-height: 100vh;
    min-height: 100dvh;
}
.side {
    display: none;
}
.shell {
    max-width: 44rem;
    margin: 0 auto;
    padding-bottom: calc(var(--tab-h) + 2rem + env(safe-area-inset-bottom));
}
.hero {
    background: linear-gradient(135deg, var(--hero-a), var(--hero-b));
    color: #fff;
    padding: 1.1rem 1rem 1.3rem;
    padding-top: calc(1.1rem + env(safe-area-inset-top));
    border-radius: 0 0 1.5rem 1.5rem;
}
.hero small,
.hero .stat small {
    color: rgba(255, 255, 255, 0.82);
}
.eyebrow {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-size: 0.7rem;
    font-weight: 600;
}
.center {
    text-align: center;
}
.hero-sub {
    margin-top: 0.65rem;
    font-size: 0.82rem;
    opacity: 0.92;
}
.back {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.85rem;
}
.stat {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.85rem;
    padding: 0.55rem 0.65rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.stat b {
    font-size: 1.02rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}
.stat b.long {
    font-size: 0.86rem;
    line-height: 1.43rem;
}
.stat b.xlong {
    font-size: 0.72rem;
    line-height: 1.43rem;
}
main {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.pane,
.stack {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-width: 0;
}
.cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.8rem;
}

/* ---------- pieces ---------- */
.card {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem;
    background: var(--surface);
    color: inherit;
    box-shadow: var(--shadow);
}
.card.link:hover,
.tool:hover {
    box-shadow: var(--shadow-up);
}
.card.open {
    border-color: var(--brand);
}
.card > * + * {
    margin-top: 0.6rem;
}
/* tiles in a grid: same height in a row, with their buttons along the bottom edge */
.cards > .card,
.cards > .tool {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.cards > .tool {
    flex-direction: row;
}
.cards > .card > .split:last-child {
    margin-top: auto;
    padding-top: 0.6rem;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    color: inherit;
}
.card-head > span,
.row-name {
    display: flex;
    flex-direction: column;
    text-align: left;
    min-width: 0;
}
.card-head > .with-icon {
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
}
.with-icon > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.row-name {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    flex: 1;
}
button.card-head {
    flex-direction: row;
}
.big {
    font-size: 1.15rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.pill {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-ink);
    background: var(--brand-soft);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
}
.tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
.tile,
.tiles .stat {
    background: var(--surface-2);
    border: 0;
    border-radius: 0.8rem;
    padding: 0.6rem 0.7rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.tile-top {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--brand-ink);
}
.tile b {
    font-variant-numeric: tabular-nums;
}
.tiles .stat small {
    color: var(--muted);
}
.shortcuts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}
.shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.75rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--brand-ink);
    text-align: center;
    box-shadow: var(--shadow);
}
.shortcut .ic {
    width: 1.5rem;
    height: 1.5rem;
}
.shortcut span {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text);
}
.shortcut.main {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}
.shortcut.main span {
    color: var(--on-brand);
}
.notice,
.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-radius: 0.9rem;
    padding: 0.7rem 0.85rem;
    font-size: 0.85rem;
}
.notice {
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    color: var(--warn-text);
    font-weight: 600;
}
.banner {
    background: var(--brand-soft);
    border: 1px solid var(--border);
}
.banner div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.bar {
    height: 0.45rem;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}
.bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--green);
}
.bar i.orange {
    background: var(--orange);
}
.bar i.red {
    background: var(--red);
}
.badge {
    color: var(--brand-ink);
    font-weight: 700;
}
.badge.bad {
    color: var(--red);
}
.badge.done {
    color: var(--green);
}
.empty {
    text-align: center;
    color: var(--muted);
    padding: 1rem 0;
    font-size: 0.85rem;
}

/* ---------- start screen tools ---------- */
.tool {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.tool.soon {
    background: var(--surface-2);
    box-shadow: none;
    color: var(--muted);
}
.tool-icon {
    flex: none;
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, var(--hero-b), var(--brand));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tool-icon .ic {
    width: 1.5rem;
    height: 1.5rem;
}
.tool.soon .tool-icon {
    background: var(--border);
    color: var(--muted);
}
.tool-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.tool-figure {
    color: var(--brand-ink);
    font-weight: 700;
    margin-top: 0.15rem;
}
.tool-go {
    color: var(--muted);
}

/* ---------- lists ---------- */
.list {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.list.inner {
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}
.row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.86rem;
    color: inherit;
}
.list > .row:first-child,
.list.inner > .row:first-child {
    border-top: 0;
}
.list.inner .row {
    padding-left: 0;
    padding-right: 0;
}
.row.total {
    border-top: 1px dashed var(--border);
    padding-right: 2.6rem;
}
.nav-row {
    justify-content: space-between;
    padding-left: 0;
    padding-right: 0;
    font-weight: 600;
    color: var(--text);
}
.row-icon {
    flex: none;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.65rem;
    background: var(--surface-2);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.row-icon.t-income,
.row-icon.t-gotback,
.row-icon.t-borrowed {
    color: var(--green);
}
.row-icon.t-expense {
    color: var(--brand-ink);
}
.row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.row-text b,
.row-text small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.amt {
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.amt.in {
    color: var(--green);
}
.day {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.6rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.day-head {
    width: 100%;
    display: grid;
    grid-template-columns: 1.25rem 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border: 0;
    background: var(--surface-2);
    text-align: left;
    cursor: pointer;
}

/* ---------- forms ---------- */
label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}
label.left {
    align-self: stretch;
    text-align: left;
}
label.check {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-size: 0.86rem;
}
input,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.6rem 0.7rem;
    background: var(--surface);
    font-size: 1rem; /* 16px: iOS does not zoom the page when a field is focused */
    font-weight: 400;
    color: var(--text);
    min-height: 2.75rem;
}
select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1rem;
    text-overflow: ellipsis;
    cursor: pointer;
}
input[type='checkbox'] {
    width: 1.15rem;
    min-height: 0;
    height: 1.15rem;
    accent-color: var(--brand);
}
input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}
.grid2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}
.form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: var(--surface-2);
    border-radius: 0.9rem;
    padding: 0.8rem;
}
.card.form {
    background: var(--surface);
}
.amount {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    border: 2px solid var(--border);
    border-radius: 1.1rem;
    padding: 0.45rem 1rem;
    background: var(--surface);
}
.amount span {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--muted);
}
.amount input {
    border: 0;
    background: transparent;
    font-size: 2.1rem;
    font-weight: 800;
    padding: 0.2rem 0;
    font-variant-numeric: tabular-nums;
}
.amount input:focus-visible {
    outline: none;
}
.amount:focus-within {
    border-color: var(--brand);
}
.amount.small input {
    font-size: 1.4rem;
}
.amount.out:focus-within {
    border-color: var(--brand);
}
.amount.in input,
.amount.in span {
    color: var(--green);
}
/* no browser arrows on number boxes */
input[type='number'] {
    -moz-appearance: textfield;
    appearance: textfield;
}
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.pane-head {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.pane-head h2 {
    font-size: 1.1rem;
}
/* the line under the heading changes with the kind of entry: it always has room for two lines, so nothing below it moves */
.pane-head small {
    line-height: 1.3;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.25rem;
    color: var(--muted);
}
.empty-state .ic {
    width: 2rem;
    height: 2rem;
    color: var(--brand-ink);
}
.empty-state b {
    color: var(--text);
}
.mini {
    flex-direction: row;
    align-items: center;
    gap: 0.3rem;
    flex: none;
}
.mini input {
    width: 6.5rem;
    text-align: right;
    font-weight: 700;
    min-height: 2.3rem;
    padding: 0.3rem 0.55rem;
}
.type-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}
.tile-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 4.1rem;
    white-space: nowrap;
    padding: 0.6rem 0.35rem;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
}
.tile-btn .ic {
    width: 1.35rem;
    height: 1.35rem;
}
.tile-btn span {
    color: var(--text);
}
.tile-btn.on {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-ink);
}
.tile-btn.on span {
    color: var(--brand-ink);
}
.chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}
.chip {
    flex: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 8rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    text-align: left;
}
.chip span {
    display: flex;
    flex-direction: column;
}
.chip b {
    color: var(--text);
}
.chip.on {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}
.chip.on b,
.chip.on small {
    color: var(--on-brand);
}
.seg {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: var(--surface-2);
    border-radius: 0.9rem;
    padding: 0.22rem;
}
.seg button {
    border: 0;
    background: transparent;
    padding: 0.5rem 0.8rem;
    border-radius: 0.7rem;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}
.seg button.on {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}
.seg.fit {
    display: inline-grid;
    align-self: flex-start;
}
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}
.toolbar .seg {
    flex: 1;
    min-width: 12rem;
}
.toolbar .seg.fit {
    flex: none;
    min-width: 14rem;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    background: var(--surface);
    padding: 0.55rem 0.95rem;
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--text);
    cursor: pointer;
    min-height: 2.6rem; /* comfortable touch target */
    transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active,
.shortcut:active,
.tile-btn:active,
.chip:active,
.tool:active {
    transform: scale(0.98);
}
.btn {
    white-space: nowrap;
}
.wide-only {
    display: none;
}
.btn.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}
.btn:hover {
    background: var(--surface-2);
}
.btn.primary:hover {
    background: var(--brand-ink);
}
.btn.danger {
    color: var(--red);
}
.btn.ghost {
    border-color: transparent;
    background: transparent;
}
.btn.on,
.btn:disabled {
    opacity: 0.55;
    cursor: default;
}
.btn.wide {
    width: 100%;
    min-height: 3.1rem;
    font-size: 0.96rem;
    border-radius: 1rem;
}
.btn.file {
    flex-direction: row;
}
.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 0;
    background: none;
    padding: 0;
    color: var(--brand-ink);
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
}
.icon-btn {
    flex: none;
    width: 2.4rem;
    height: 2.4rem;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    background: var(--surface-2);
}
.icon-btn.light {
    color: #fff;
}
.icon-btn.light:hover {
    background: rgba(255, 255, 255, 0.15);
}
.icon-btn.light .ic {
    width: 1.5rem;
    height: 1.5rem;
}
.split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.split.wrap {
    flex-wrap: wrap;
    justify-content: flex-start;
}
.over {
    color: var(--red);
    font-weight: 700;
}
.soon {
    color: var(--orange);
    font-weight: 700;
}
.card .sub {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.9rem;
}
.grid3 .span2 {
    grid-column: 1 / -1;
}
/* budget: an ordered list with aligned columns */
.btable {
    overflow: visible;
}
.b-head {
    display: none;
}
.budget-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'name amount' 'progress progress' 'entries entries';
    gap: 0.5rem 0.75rem;
    align-items: center;
    padding: 0.8rem 0.9rem;
    border-top: 1px solid var(--border);
}
.btable > .budget-row:first-of-type {
    border-top: 0;
}
.budget-row.open {
    background: var(--brand-soft);
}
.b-name {
    grid-area: name;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.b-progress {
    grid-area: progress;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}
.budget-row .mini {
    grid-area: amount;
}
.b-entries {
    grid-area: entries;
}
/* unsaved changes: a bar of its own at the bottom, never on top of the content */
.savebar {
    position: sticky;
    bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 -1rem -1rem;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.08);
    font-size: 0.85rem;
    font-weight: 600;
}
.savebar[hidden] {
    display: none;
}

/* ---------- phone bottom bar ---------- */
.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.5rem 0 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--muted);
}
.tabbar a span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 1.5rem;
}
.tabbar .ic {
    width: 1.4rem;
    height: 1.4rem;
}
.tabbar a.on {
    color: var(--brand-ink);
}
.tabbar a.add span {
    background: var(--brand);
    color: var(--on-brand);
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 50%;
    margin-top: -1.45rem;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

/* ---------- toast, login ---------- */
/* Messages after an action, in the style of Salesforce toasts: a coloured banner at the top centre with an icon,
   the text and a close button. Green = done, red = a problem. */
.toast {
    position: fixed;
    left: 50%;
    top: calc(0.75rem + env(safe-area-inset-top));
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: max-content;
    min-width: min(92vw, 20rem);
    max-width: min(92vw, 34rem);
    background: #2e844a;
    color: #fff;
    padding: 0.75rem 0.75rem 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.toast.pop {
    animation: toast-in 0.22s ease-out;
}
@keyframes toast-in {
    from {
        opacity: 0;
        transform: translate(-50%, -0.9rem);
    }
}
.toast.warn {
    background: #ba0517;
}
.toast-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
}
.toast-icon svg {
    width: 1.6rem;
    height: 1.6rem;
}
.toast-text {
    flex: 1;
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
}
.toast-close {
    flex: none;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.35rem;
    background: transparent;
    color: #fff;
    cursor: pointer;
}
.toast-close:hover,
.toast-close:focus-visible {
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}
.toast-close svg {
    width: 1.1rem;
    height: 1.1rem;
}
@media (prefers-reduced-motion: reduce) {
    .toast.pop {
        animation: none;
    }
}
.loading,
.login {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1.5rem;
    text-align: center;
}
.login {
    max-width: 24rem;
    margin: 0 auto;
}
.login p {
    color: var(--muted);
}
.logo {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 1.3rem;
    background: linear-gradient(135deg, var(--hero-b), var(--brand));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.25);
}
.logo .ic {
    width: 2.4rem;
    height: 2.4rem;
}
.logo.small {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.65rem;
    box-shadow: none;
}
.logo.small .ic {
    width: 1.2rem;
    height: 1.2rem;
}
.or {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.5rem;
}
@media (max-width: 22rem) {
    .type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------- wide screens: side menu, wider pages, columns ---------- */
@media (min-width: 900px) {
    body {
        font-size: 15.5px;
    }
    .app {
        display: grid;
        grid-template-columns: 16rem minmax(0, 1fr);
    }
    .side {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        position: sticky;
        top: 0;
        height: 100vh;
        padding: 1.25rem 0.9rem;
        background: var(--surface);
        border-right: 1px solid var(--border);
    }
    .brand {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        font-size: 1.15rem;
        font-weight: 800;
        color: var(--text);
        padding: 0 0.5rem 0.75rem;
    }
    .side nav {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        flex: 1;
        overflow-y: auto;
    }
    .side nav small {
        padding: 0.9rem 0.6rem 0.3rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        font-size: 0.68rem;
        font-weight: 700;
    }
    .side nav a {
        display: flex;
        align-items: center;
        gap: 0.7rem;
        padding: 0.6rem 0.7rem;
        border-radius: 0.75rem;
        color: var(--muted);
        font-weight: 600;
        font-size: 0.92rem;
    }
    .side nav a:hover {
        background: var(--surface-2);
        color: var(--text);
    }
    .side nav a.on {
        background: var(--brand-soft);
        color: var(--brand-ink);
    }
    .side-user {
        display: flex;
        flex-direction: column;
        padding: 0.75rem 0.6rem 0;
        border-top: 1px solid var(--border);
        min-width: 0;
    }
    .side-user b,
    .side-user small {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .tabbar {
        display: none;
    }
    .shell {
        max-width: 72rem;
        width: 100%;
        margin: 0 auto;
        padding: 1.5rem 2rem 3rem;
    }
    /* compact header: title on the left, the three figures on the right */
    .hero {
        border-radius: 1.25rem;
        padding: 1.1rem 1.5rem;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 2rem;
        align-items: center;
    }
    .hero > * {
        grid-column: 1;
    }
    .hero > .stats {
        grid-column: 2;
        grid-row: 1 / span 3;
        margin-top: 0;
        min-width: 30rem;
    }
    .hero-sub {
        margin-top: 0.25rem;
    }
    .hero .back {
        display: none;
    }
    .hero h1 {
        font-size: 1.5rem;
    }
    .hero .center + .month-nav,
    .month-nav {
        justify-content: flex-start;
    }
    .hero .center {
        text-align: left;
    }
    .stat b,
    .stat b.long,
    .stat b.xlong {
        font-size: 1.15rem;
        line-height: inherit;
    }
    main {
        padding: 1.25rem 0 0;
        gap: 1rem;
    }
    main.dash {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }
    main.dash > .card,
    main.dash > .stack > .card {
        height: 100%;
    }
    main.dash > .stack {
        display: grid;
        grid-auto-rows: 1fr;
    }
    main.two {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
        gap: 1.5rem;
    }
    main.two .pane:first-child {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 1.25rem;
        padding: 1.5rem;
        gap: 1rem;
        box-shadow: var(--shadow);
    }
    main.two .pane:only-child {
        grid-column: 1 / -1;
        max-width: 40rem;
    }
    main.two .btn.wide {
        max-width: none;
    }
    main.two .pane + .pane h3 {
        margin-top: 0.4rem;
    }
    .empty-state {
        padding: 3rem 1.5rem;
    }
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 1rem;
    }
    .wide-only {
        display: inline-flex;
    }
    .b-head {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) 9.5rem;
        gap: 1.25rem;
        padding: 0.6rem 1.1rem;
        background: var(--surface-2);
        border-radius: var(--radius) var(--radius) 0 0;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.07em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .b-head span:last-child {
        text-align: right;
    }
    .budget-row {
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) 9.5rem;
        grid-template-areas: 'name progress amount' 'entries entries entries';
        gap: 0.6rem 1.25rem;
        padding: 0.75rem 1.1rem;
        min-height: 4.2rem;
    }
    .btable > .budget-row:first-of-type {
        border-top: 1px solid var(--border);
    }
    .budget-row .mini {
        justify-content: flex-end;
    }
    .budget-row .mini input {
        width: 8rem;
    }
    .savebar {
        bottom: 1rem;
        margin: 0;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.75rem 1rem 0.75rem 1.25rem;
    }
    .span {
        grid-column: 1 / -1;
    }
    .shortcuts {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
    .type-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.6rem;
    }
    .tile-btn {
        min-height: 4.4rem;
        font-size: 0.8rem;
    }
    .chips {
        flex-wrap: wrap;
        overflow: visible;
    }
    .btn.wide {
        max-width: 24rem;
    }
    .login .btn.wide {
        max-width: none;
    }
}
@media (min-width: 1280px) {
    .cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* ---------- sign-in form ---------- */
.login-form {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: var(--shadow);
}
.login-form small {
    text-align: center;
}
.login-form .right {
    align-self: flex-end;
}
.pw {
    position: relative;
    display: block;
}
.pw input {
    padding-right: 3.8rem;
}
.pw .link-btn {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
}
.or {
    align-self: stretch;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.1rem 0;
}
.or::before,
.or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

input.code {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.login-form .left-text {
    text-align: left;
}

.notice.stacked {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    font-weight: 400;
    text-align: left;
    line-height: 1.4;
}
.notice.stacked .link-btn {
    font-size: inherit;
    text-decoration: underline;
}
.login.limit-hit .btn[data-action='google'] {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

/* ---------- aligned lists: accounts and people ---------- */
.grid3 {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
}
.acct-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'name bal' 'detail detail' 'actions actions' 'panel panel';
    gap: 0.6rem 0.75rem;
    align-items: center;
    padding: 0.85rem 0.9rem;
    border-top: 1px solid var(--border);
}
.acct-row:first-child,
.person:first-child {
    border-top: 0;
}
.a-name {
    grid-area: name;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.a-name > span:last-child,
.p-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: left;
}
.a-name b,
.p-name b {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.a-detail {
    grid-area: detail;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}
.a-detail:empty {
    display: none;
}
.a-bal {
    grid-area: bal;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.a-actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.a-panel {
    grid-area: panel;
}
.acct-row.open,
.person.open {
    background: var(--surface-2);
}
.person {
    border-top: 1px solid var(--border);
}
.p-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: 'avatar name amount chev' 'avatar status amount chev';
    align-items: center;
    column-gap: 0.75rem;
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 0;
    background: none;
    cursor: pointer;
    color: inherit;
    text-align: left;
}
.p-head .avatar {
    grid-area: avatar;
}
.p-head .p-name {
    grid-area: name;
}
.p-head .badge {
    grid-area: status;
    font-size: 0.74rem;
}
.p-head .p-name small {
    display: none;
}
.p-head .big {
    grid-area: amount;
}
.p-head > .ic {
    grid-area: chev;
    color: var(--muted);
}
.avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.p-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 0.25rem 0.9rem 1rem;
}
.p-panel .list {
    box-shadow: none;
}
@media (min-width: 900px) {
    .grid3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .acct-row {
        grid-template-columns: minmax(0, 4fr) minmax(0, 4fr) minmax(8rem, 2fr) 17rem;
        grid-template-areas: 'name detail bal actions' 'panel panel panel panel';
        gap: 0.75rem 1.5rem;
        padding: 0.85rem 1.1rem;
        min-height: 4.4rem;
    }
    .a-detail:empty {
        display: block;
    }
    .a-actions {
        justify-content: flex-end;
        flex-wrap: nowrap;
    }
    .a-panel {
        max-width: 32rem;
    }
    .p-head {
        grid-template-columns: auto minmax(0, 4fr) minmax(0, 3fr) minmax(8rem, 2fr) auto;
        grid-template-areas: 'avatar name status amount chev';
        column-gap: 1.25rem;
        padding: 0.85rem 1.1rem;
    }
    .p-head .p-name small {
        display: block;
    }
    .p-head .big {
        text-align: right;
    }
    .p-panel {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        gap: 1.5rem;
        padding: 0.5rem 1.1rem 1.25rem;
    }
}

/* ---------- dashboards and reports ---------- */
.kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    box-shadow: var(--shadow);
}
.kpi b {
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.delta.good {
    color: var(--green);
}
.delta.bad {
    color: var(--red);
}
.cards.two > .card {
    min-width: 0;
}
.chart-card .card-head h2 {
    font-size: 0.95rem;
}
.card.flush {
    padding: 0;
    overflow: hidden;
}
.card.flush > * + * {
    margin-top: 0;
}
.card-head.pad {
    padding: 0.9rem 1rem;
}
.list.inner.flush {
    border-top: 0;
}
/* horizontal bars */
.hbars,
.meters {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.hbar {
    display: grid;
    grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.35rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}
.hbar:hover,
.hbar:focus-visible,
.meter:hover,
.meter:focus-visible {
    background: var(--surface-2);
}
.hb-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hb-track {
    display: block;
    height: 0.75rem;
}
.hb-track i {
    display: block;
    height: 100%;
    min-width: 2px;
    background: var(--series-1);
    border-radius: 0 4px 4px 0; /* rounded data-end, square at the baseline */
}
.hb-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
/* meters: a limit and how much is used; the state is also written in words */
.meter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 0.75rem;
    padding: 0.45rem 0.35rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}
.m-label {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.m-state,
.m-value {
    font-size: 0.76rem;
    color: var(--muted);
    white-space: nowrap;
}
.m-track {
    grid-column: 1 / -1;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}
.m-track i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--good);
}
.meter.m-near .m-track i {
    background: var(--warning);
}
.meter.m-over .m-track i {
    background: var(--critical);
}
.m-value {
    grid-column: 1 / -1;
}
/* svg charts */
svg.chart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}
.chart .grid {
    stroke: var(--border);
    stroke-width: 1;
}
.chart .axis {
    stroke: var(--muted);
    stroke-opacity: 0.5;
    stroke-width: 1;
}
.chart .tick {
    fill: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.chart .bar.s1,
.sw.s1,
.key.s1 {
    fill: var(--series-1);
    background: var(--series-1);
}
.chart .bar.s2,
.sw.s2,
.key.s2 {
    fill: var(--series-2);
    background: var(--series-2);
}
.chart .line {
    fill: none;
    stroke: var(--series-1);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.chart .area {
    fill: var(--wash);
}
.chart .dot {
    fill: var(--series-1);
    stroke: var(--surface);
    stroke-width: 2;
}
.chart .dot.hover,
.chart .cross {
    opacity: 0;
}
.chart .cross {
    stroke: var(--muted);
    stroke-width: 1;
}
.chart .step:hover .cross,
.chart .step:hover .dot.hover,
.chart .step:focus-within .cross,
.chart .step:focus-within .dot.hover {
    opacity: 1;
}
.chart .hit {
    fill: transparent;
    outline: none;
}
.chart .hit:hover,
.chart .hit:focus-visible {
    fill: var(--text);
    fill-opacity: 0.05;
}
.chart .end-label {
    fill: var(--text);
    font-size: 12px;
    font-weight: 600;
}
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--muted);
}
.legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.sw {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 2px;
}
.twin {
    font-size: 0.8rem;
    color: var(--muted);
}
.twin summary {
    cursor: pointer;
    font-weight: 600;
    width: fit-content;
}
.twin[open] summary {
    margin-bottom: 0.5rem;
}
.tip {
    position: fixed;
    z-index: 20;
    pointer-events: none;
    background: var(--text);
    color: var(--surface);
    border-radius: 0.6rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
    box-shadow: var(--shadow-up);
    max-width: 16rem;
}
.tip[hidden] {
    display: none;
}
.tip small {
    display: block;
    color: inherit;
    opacity: 0.75;
}
.tip div {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.tip span {
    opacity: 0.75;
}
.key {
    width: 0.8rem;
    height: 2px;
    display: inline-block;
}
/* tables */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
th,
td {
    text-align: left;
    padding: 0.55rem 1rem;
    border-top: 1px solid var(--border);
    white-space: nowrap;
}
th {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-top: 0;
    position: sticky;
    top: 0;
}
.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
tfoot td {
    font-weight: 700;
    background: var(--surface-2);
}
.twin table {
    font-size: 0.8rem;
}
.twin th,
.twin td {
    padding: 0.35rem 0.6rem;
}
@media (min-width: 900px) {
    .kpis {
        grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
        gap: 1rem;
    }
    .cards.two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .hbar {
        grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) auto;
    }
}

/* ---------- filter row: tabs and pickers on one left-aligned line, all the same height ---------- */
.filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}
.filterbar .seg {
    flex: 1 1 100%; /* phone: the tabs take the first line, the pickers share the next */
}
.filterbar .seg {
    height: 2.6rem;
    align-items: stretch;
}
.filterbar .seg button {
    padding-top: 0;
    padding-bottom: 0;
}
.pick.grow {
    flex-basis: 100%;
}
/* a picker: its name sits inside the box, before the value */
.pick {
    flex: 1 1 9.5rem;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    height: 2.6rem;
    padding: 0 0 0 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    min-width: 0;
}
.pick select,
.pick input {
    flex: 1;
    min-width: 0;
    width: auto;
    min-height: 0;
    height: 100%;
    border: 0;
    background-color: transparent;
    padding-left: 0.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.pick input {
    padding-right: 0.6rem;
}
.pick select:focus-visible,
.pick input:focus-visible {
    outline: none;
}
.pick:focus-within {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}
.filterbar + .kpis,
.toolbar + .card {
    margin-top: 0;
}
@media (min-width: 900px) {
    .filterbar .seg {
        flex: 0 0 auto;
    }
    .pick {
        flex: 0 0 auto;
    }
    .pick.grow {
        flex: 1 1 14rem;
        max-width: 26rem;
    }
    .pick select {
        min-width: 7rem;
        max-width: 13rem;
    }
}

label > span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
label > span .pill {
    font-size: 0.66rem;
    padding: 0.05rem 0.45rem;
}
.pill[hidden] {
    display: none;
}

.worth .big {
    font-size: 1.5rem;
}
.worth-parts {
    align-items: flex-end;
    text-align: right;
}

.recovery {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: center;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: 0.75rem;
    padding: 0.9rem 0.5rem;
    user-select: all;
    overflow-wrap: anywhere;
}
.login-form .check {
    text-align: left;
}

.tile-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
/* narrow desktop window: the entry form gets the full width, recent entries go below it */
@media (min-width: 900px) and (max-width: 1179px) {
    main.two {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- offline screen ----------
   Full screen while there is no internet: a deep gradient with slow colour glows, a frosted-glass card, a "no signal"
   mark inside pulsing rings. The same in light and dark mode (it is its own surface, like the sign-in title). */
.offline {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: calc(1.25rem + env(safe-area-inset-top)) 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    overflow: hidden auto;
    color: #fff;
    background: radial-gradient(120% 90% at 50% 0%, #1e2f5c 0%, #0b1324 55%, #070b16 100%);
}
.offline-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    pointer-events: none;
    animation: offline-drift 16s ease-in-out infinite alternate;
}
.offline-glow.a {
    width: 22rem;
    height: 22rem;
    left: -7rem;
    top: -6rem;
    background: #2563eb;
}
.offline-glow.b {
    width: 18rem;
    height: 18rem;
    right: -6rem;
    bottom: -5rem;
    background: #7c3aed;
    animation-duration: 21s;
    animation-delay: -6s;
}
.offline-glow.c {
    width: 14rem;
    height: 14rem;
    right: 12%;
    top: 14%;
    background: #06b6d4;
    opacity: 0.28;
    animation-duration: 26s;
    animation-delay: -11s;
}
@keyframes offline-drift {
    to {
        transform: translate3d(2.5rem, 1.8rem, 0) scale(1.12);
    }
}
.offline-card {
    position: relative;
    width: min(100%, 26rem);
    padding: 2.25rem 1.75rem 1.5rem;
    text-align: center;
    border-radius: 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    backdrop-filter: blur(22px) saturate(140%);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    animation: offline-rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes offline-rise {
    from {
        opacity: 0;
        transform: translateY(1rem) scale(0.98);
    }
}
.offline-art {
    position: relative;
    width: 8.5rem;
    height: 8.5rem;
    margin: 0 auto 1.25rem;
    display: grid;
    place-items: center;
}
.offline-art .ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(147, 197, 253, 0.55);
    animation: offline-ping 2.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}
.offline-art .r2 {
    animation-delay: 0.93s;
}
.offline-art .r3 {
    animation-delay: 1.86s;
}
@keyframes offline-ping {
    from {
        transform: scale(0.52);
        opacity: 0.9;
    }
    to {
        transform: scale(1.12);
        opacity: 0;
    }
}
.offline-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 4.75rem;
    height: 4.75rem;
    border-radius: 1.5rem;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.offline-icon svg {
    width: 2.6rem;
    height: 2.6rem;
}
.offline-icon .slash {
    stroke: #fecaca;
    stroke-dasharray: 50;
    animation: offline-slash 0.6s 0.25s ease-out backwards;
}
@keyframes offline-slash {
    from {
        stroke-dashoffset: 50;
    }
}
.offline-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fecaca;
    background: rgba(248, 113, 113, 0.14);
    border: 1px solid rgba(248, 113, 113, 0.35);
}
.offline-chip i,
.net-chip i {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #f87171;
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.7);
    animation: offline-dot 1.8s ease-out infinite;
}
@keyframes offline-dot {
    to {
        box-shadow: 0 0 0 0.5rem rgba(248, 113, 113, 0);
    }
}
.offline h1 {
    margin: 0.9rem 0 0.5rem;
    font-size: clamp(1.7rem, 6vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
}
.offline p {
    margin: 0 auto;
    max-width: 21rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: rgba(226, 232, 240, 0.86);
}
.offline-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1.5rem 0 1.25rem;
}
.offline-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 3rem;
    padding: 0 1.25rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.offline-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}
.offline-btn:active {
    transform: scale(0.98);
}
.offline-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
.offline-btn.primary {
    border-color: transparent;
    color: #0b1324;
    background: linear-gradient(180deg, #ffffff, #dbeafe);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}
.offline-btn.primary:hover {
    background: #ffffff;
}
.offline-btn:disabled {
    opacity: 0.8;
    cursor: progress;
}
.offline-btn .spin {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid rgba(11, 19, 36, 0.25);
    border-top-color: #1d4ed8;
    animation: offline-spin 0.7s linear infinite;
}
@keyframes offline-spin {
    to {
        transform: rotate(360deg);
    }
}
.offline-tips {
    margin: 0;
    padding: 0.9rem 1rem;
    list-style: none;
    display: grid;
    gap: 0.5rem;
    text-align: left;
    font-size: 0.82rem;
    color: rgba(226, 232, 240, 0.82);
    border-radius: 1rem;
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.offline-tips li {
    position: relative;
    padding-left: 1.3rem;
}
.offline-tips li::before {
    content: '';
    position: absolute;
    left: 0.2rem;
    top: 0.45em;
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: #60a5fa;
}
.offline-foot {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 1.1rem;
    font-size: 0.78rem;
    color: rgba(203, 213, 225, 0.8);
}
.offline-foot .dots {
    display: inline-flex;
    gap: 0.25rem;
}
.offline-foot .dots i {
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 50%;
    background: #93c5fd;
    animation: offline-blink 1.2s ease-in-out infinite;
}
.offline-foot .dots i:nth-child(2) {
    animation-delay: 0.2s;
}
.offline-foot .dots i:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes offline-blink {
    0%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-0.15rem);
    }
}
/* working offline (after "Continue offline"): a small chip that opens the screen again */
.net-chip {
    position: fixed;
    z-index: 15;
    right: 0.75rem;
    bottom: calc(var(--tab-h) + 0.75rem + env(safe-area-inset-bottom));
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(248, 113, 113, 0.45);
    background: #1b2333;
    color: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}
@media (min-width: 900px) {
    .offline-actions {
        flex-direction: row;
    }
    .offline-actions .offline-btn {
        flex: 1;
    }
    .net-chip {
        bottom: 1rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .offline-glow,
    .offline-card,
    .offline-art .ring,
    .offline-icon .slash,
    .offline-chip i,
    .net-chip i,
    .offline-foot .dots i {
        animation: none;
    }
    .offline-art .ring {
        opacity: 0.35;
        transform: scale(0.8);
    }
    .offline-art .r2 {
        transform: scale(0.98);
    }
    .offline-art .r3 {
        display: none;
    }
}
