/* ═══════════════════════════════════════════
   Budgeting App — Mobile-first stylesheet
   ═══════════════════════════════════════════ */

/* ─── Tokens ─── */
:root {
    --bg: #f3f4ef;
    --panel: #ffffff;
    --panel-soft: #f8f7f2;
    --text: #1b211d;
    --muted: #576460;
    --line: #d9ddd3;
    --accent: #1f7a55;
    --accent-strong: #13553a;
    --danger: #9f2f2f;
    --danger-soft: #fff0f0;
    --success-soft: #eef8f2;
    --shadow: 0 2px 12px rgba(18, 34, 26, 0.06);
    --radius: 14px;
    --radius-sm: 10px;
    --nav-h: 3.75rem;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ─── Reset ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
}

html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
    padding-bottom: calc(var(--nav-h) + var(--safe-b));
}

.auth-body {
    padding-bottom: 0;
}

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

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    color: var(--text);
    font-size: 1rem;
    min-height: 48px;
}

input[type="checkbox"] {
    width: auto;
    min-height: auto;
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 0.3rem;
    font-size: 0.9rem;
    font-weight: 500;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-size: 1.2rem;
    line-height: 1.35;
}

h2 {
    font-size: 1.05rem;
}

/* ─── Shell / Layout ─── */
.shell {
    width: min(1120px, calc(100% - 1.5rem));
    margin: 0 auto;
}

.page-shell {
    padding: 1rem 0 1.5rem;
}

.auth-body {
    background:
        radial-gradient(circle at top left, rgba(31, 122, 85, 0.15), transparent 20rem),
        linear-gradient(180deg, #eef4ee, #f8f6f0);
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 4rem);
    padding: 1.5rem 0;
}

/* ─── Auth Card ─── */
.auth-card {
    width: min(28rem, 100%);
    padding: 1.5rem;
    display: grid;
    gap: 1.25rem;
    background: var(--panel);
    border: 1px solid rgba(108, 117, 109, 0.12);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ─── Site Header (top bar) ─── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: rgba(243, 244, 239, 0.92);
    border-bottom: 1px solid rgba(108, 117, 109, 0.12);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3rem;
    padding: 0.4rem 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--text);
}

.brand__mark {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand__wordmark {
    font-family: "Playfair Display", "Iowan Old Style", Georgia, serif;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    color: var(--accent-strong);
    text-rendering: optimizeLegibility;
}

.brand__meta {
    display: none;
}

/* Hidden on mobile — shown via desktop breakpoint */
.site-header__actions {
    display: none;
}

.desktop-nav {
    display: none;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.muted {
    color: var(--muted);
    font-size: 0.85rem;
}

/* ─── Bottom Navigation (mobile) ─── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    height: calc(var(--nav-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(108, 117, 109, 0.12);
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    flex: 1;
    min-height: 48px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    position: relative;
    background: none;
    border: 0;
    cursor: pointer;
}

.bottom-nav__item svg {
    width: 22px;
    height: 22px;
}

.bottom-nav__item.is-active {
    color: var(--accent);
}

.bottom-nav__item.is-active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
}

/* ─── More menu (bottom nav popover) ─── */
.more-menu {
    flex: 1;
    display: flex;
    position: relative;
}

.more-menu > summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    flex: 1;
    min-height: 48px;
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    list-style: none;
    cursor: pointer;
}

.more-menu > summary::-webkit-details-marker {
    display: none;
}

.more-menu > summary svg {
    width: 22px;
    height: 22px;
}

.more-menu.is-active > summary {
    color: var(--accent);
}

.more-menu[open]::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
}

.more-menu__sheet {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    right: 0.25rem;
    min-width: 11rem;
    background: var(--panel);
    border: 1px solid rgba(108, 117, 109, 0.12);
    border-radius: var(--radius);
    box-shadow: 0 -4px 24px rgba(18, 34, 26, 0.12);
    padding: 0.4rem;
    display: grid;
    gap: 0.1rem;
}

.more-menu__sheet a {
    display: flex;
    align-items: center;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    min-height: 44px;
}

.more-menu__sheet a:active,
.more-menu__sheet a.is-active {
    background: var(--panel-soft);
    color: var(--accent-strong);
}

.more-menu__sheet .sheet-divider {
    height: 1px;
    background: var(--line);
    margin: 0.25rem 0.5rem;
}

/* ─── Hero Panel ─── */
.hero-panel {
    display: grid;
    gap: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background:
        linear-gradient(135deg, rgba(31, 122, 85, 0.96), rgba(20, 78, 54, 0.98)),
        var(--panel);
    color: #f8fff9;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-panel .lead,
.hero-panel .eyebrow,
.hero-panel a {
    color: rgba(248, 255, 249, 0.78);
}

.hero-amount {
    font-size: clamp(2rem, 9vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero-amount.is-negative {
    color: #ffd4d4;
}

.hero-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hero-actions .button {
    font-size: 0.88rem;
    padding: 0.55rem 1rem;
    min-height: 40px;
}

/* ─── Panels & Cards ─── */
.panel,
.metric-card {
    background: var(--panel);
    border: 1px solid rgba(108, 117, 109, 0.1);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.15rem;
    min-width: 0;
    overflow: hidden;
}

.panel {
    margin-bottom: 1rem;
}

.panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

/* ─── Page Header ─── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.verification-banner {
    background: #fff8df;
    border-bottom: 1px solid #eadca1;
}

.verification-banner__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.9rem;
    padding: 0.75rem 0;
}

.verification-banner__copy {
    display: grid;
    gap: 0.2rem;
    font-size: 0.9rem;
    min-width: 0;
}

.verification-banner__copy p {
    color: #6b6130;
}

.verification-banner__form {
    flex: 0 0 auto;
}

/* ─── Tab Bar (CSS-only tabs) ─── */
.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.75rem;
}

.tab-bar__tab {
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    min-height: 40px;
    display: flex;
    align-items: center;
}

/* Active tab styling via sibling radio :checked */
#tab-upcoming:checked ~ .tab-bar [for="tab-upcoming"],
#tab-recent:checked ~ .tab-bar [for="tab-recent"],
#tab-recurring:checked ~ .tab-bar [for="tab-recurring"],
#mode-onetime:checked ~ .tab-bar [for="mode-onetime"],
#mode-recurring:checked ~ .tab-bar [for="mode-recurring"],
#category-kind-expense:checked ~ .tab-bar [for="category-kind-expense"],
#category-kind-income:checked ~ .tab-bar [for="category-kind-income"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Show/hide tab panes */
#tab-upcoming:checked ~ .tab-pane--recent { display: none; }
#tab-recent:checked ~ .tab-pane--upcoming { display: none; }
#tab-recent:checked ~ .tab-pane--recurring { display: none; }
#tab-recurring:checked ~ .tab-pane--recent { display: none; }

/* Show/hide form mode fields */
.mode-onetime-fields,
.mode-recurring-fields {
    display: contents;
}

#mode-onetime:checked ~ .mode-recurring-fields { display: none; }
#mode-recurring:checked ~ .mode-onetime-fields { display: none; }
#category-kind-income:checked ~ .category-expense-only { display: none; }

/* ─── Delete Button ─── */
.delete-form {
    display: inline;
}

.delete-btn {
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    min-height: auto;
    width: auto;
}

.delete-btn:active {
    color: var(--danger);
    border-color: var(--danger);
}

/* ─── Jump Nav ─── */
.jump-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.jump-nav a {
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}

.jump-nav a:active {
    background: var(--panel-soft);
    color: var(--accent);
}

.segmented-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.segmented-nav__link {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.segmented-nav__link.is-active {
    color: var(--accent-strong);
    border-color: var(--accent);
    background: rgba(31, 122, 85, 0.08);
}

.back-link {
    display: inline-flex;
    margin-bottom: 0.45rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.filter-bar {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.filter-bar__actions {
    display: flex;
    gap: 0.5rem;
    align-items: end;
    flex-wrap: wrap;
}

/* ─── Section Headings ─── */
.section-heading {
    margin-bottom: 0.75rem;
}

/* ─── Grid System (mobile-first: single column) ─── */
.grid {
    display: grid;
    gap: 1rem;
}

.grid--metrics {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 1rem;
}

.grid--2,
.grid--3 {
    margin-bottom: 1rem;
}

/* Data-first two-column layout */
.page-two-col {
    display: grid;
    gap: 1rem;
}

.page-two-col > .data-panel {
    order: -1;
}

/* "Add" CTA in page header — hidden on tablet+ where form is visible */
.add-cta {
    white-space: nowrap;
    font-size: 0.88rem;
    padding: 0.5rem 1rem;
    min-height: 40px;
}

/* ─── Metric Cards ─── */
.metric-card {
    display: grid;
    gap: 0.25rem;
}

.metric-card strong,
.metric-inline strong {
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.metric-label,
.eyebrow {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.68rem;
    font-weight: 600;
}

.metric-stack,
.stack,
.list,
.timeline,
.category-list {
    display: grid;
    gap: 0.75rem;
}

.category-group-label {
    margin: 0.25rem 0 -0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.category-group-label:first-child {
    margin-top: 0;
}

.metric-inline {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

/* ─── Lists ─── */
.list-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
    min-height: 48px;
    min-width: 0;
}

.list-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

/* Interactive list items (tap to reveal actions, long-press to select) */
/* Interactive list items (tap to reveal actions, long-press to select) */
.list-item {
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.list-item:last-child {
    border-bottom: 0;
}

.list-item .list-row {
    border-bottom: 0;
    padding-bottom: 0;
    padding-top: 0.75rem;
    min-height: 48px;
}

.list-item .record-card__check {
    display: none;
}

.is-selection-mode .list-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.5rem;
}

.is-selection-mode .list-item .record-card__check {
    display: inline-block;
    flex: 0 0 auto;
}

.is-selection-mode .list-item .list-row {
    flex: 1;
    min-width: 0;
}

.is-selection-mode .list-item .list-item__actions {
    width: 100%;
}

.list-item__actions {
    display: none;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.25rem 0 0.75rem;
}

.list-item.is-open .list-item__actions {
    display: flex;
}

.list-item.is-selected {
    background: rgba(31, 122, 85, 0.05);
}

.list-row__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.list-row__body {
    flex: 1;
    min-width: 0;
}

.list-row__value {
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
}

.list-row--form {
    padding: 0.5rem 0 0.75rem;
}

/* ─── Timeline ─── */
.timeline__row {
    display: grid;
    grid-template-columns: 3.5rem 1.5rem 1fr auto;
    gap: 0 0.5rem;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
    min-height: 48px;
}

.timeline__icon {
    display: flex;
    align-items: center;
}

.timeline__row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.timeline__date {
    display: grid;
    gap: 0.1rem;
    color: var(--muted);
    font-size: 0.82rem;
}

/* ─── History accordion ─── */
.history-list {
    display: grid;
    gap: 0;
}

.history-group {
    border-bottom: 1px solid var(--line);
}

.history-group:last-child {
    border-bottom: 0;
}

.history-group > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    min-height: 48px;
}

.history-group > summary::-webkit-details-marker {
    display: none;
}

.history-group > summary::after {
    content: "";
    flex: 0 0 auto;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.history-group[open] > summary::after {
    transform: rotate(-135deg);
}

.history-group__body {
    padding: 0 0 0.75rem 1.75rem;
}

.history-subgroup__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.record-card {
    border-bottom: 1px solid var(--line);
}

.record-card:last-child {
    border-bottom: 0;
}

.record-card.is-selected {
    background: rgba(31, 122, 85, 0.05);
}

.record-card.is-open .record-actions {
    display: flex;
}

.record-card__summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0.5rem 0;
}

.record-card__check {
    display: none;
}

.is-selection-mode .record-card__check {
    display: inline-block;
}

.is-selection-mode .record-card__summary {
    padding-left: 0;
}

.record-actions {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0 0.5rem;
    font-size: 0.85rem;
}

.record-card--static .record-actions {
    display: none !important;
}

.record-card--forecast {
    opacity: 0.92;
}

.record-card__title-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.item-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    background: rgba(31, 122, 85, 0.08);
    color: var(--accent-strong);
    font-size: 0.7rem;
    font-weight: 700;
}

.item-badge--muted {
    background: var(--panel-soft);
    color: var(--muted);
}

.selection-root {
    position: relative;
}

.selection-bar {
    position: sticky;
    bottom: calc(var(--nav-h) + var(--safe-b) + 0.75rem);
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(31, 122, 85, 0.18);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 24px rgba(18, 34, 26, 0.12);
}

.selection-bar.is-visible {
    display: flex;
}

.selection-bar__actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.date-group-list {
    display: grid;
    gap: 1rem;
}

.date-group {
    display: grid;
    gap: 0.6rem;
}

.date-group__title {
    font-size: 0.9rem;
    color: var(--muted);
}

/* ─── Goal Cards ─── */
.goal-card {
    display: grid;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--panel-soft);
    border-radius: var(--radius-sm);
}

.goal-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.progress {
    height: 0.45rem;
    background: rgba(31, 122, 85, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #4db185);
    border-radius: 999px;
}

/* ─── Budget Cards (mobile) ─── */
.budget-card {
    display: grid;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
}

.budget-card:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.budget-card__head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.budget-card__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    font-size: 0.88rem;
}

.budget-card__stats > div {
    display: grid;
    gap: 0.15rem;
}

/* ─── Report Cards (mobile) ─── */
.report-card {
    display: grid;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
}

.report-card:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.report-card__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.report-card__bar {
    height: 0.35rem;
    background: rgba(31, 122, 85, 0.08);
    border-radius: 999px;
    position: relative;
    overflow: hidden;
}

.report-card__bar .bar-fill {
    position: absolute;
    inset: 0;
    width: 0;
    background: rgba(31, 122, 85, 0.25);
    border-radius: 999px;
}

.report-card__stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    font-size: 0.88rem;
}

.report-card__stats > div {
    display: grid;
    gap: 0.15rem;
}

/* Hide table on mobile, show cards */
.budget-table,
.report-table {
    display: none;
}

/* ─── Tables ─── */
.table-wrap {
    overflow-x: auto;
    margin: 0 -1.15rem;
    padding: 0 1.15rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.65rem 0.4rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.88rem;
}

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.78rem;
}

/* Visual spend bar in report cells */
.bar-cell {
    position: relative;
    padding-left: 0;
}

.bar-cell .bar-fill {
    position: absolute;
    left: 0;
    top: 0.15rem;
    bottom: 0.15rem;
    background: rgba(31, 122, 85, 0.08);
    border-radius: 4px;
    pointer-events: none;
}

/* ─── Forms ─── */
.form-grid {
    display: grid;
    gap: 0.75rem;
}

.form-grid__full {
    grid-column: 1 / -1;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ─── Buttons ─── */
.button,
.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.7rem 1.15rem;
    border: 0;
    font-size: 0.95rem;
    font-weight: 500;
    min-height: 48px;
    cursor: pointer;
    text-decoration: none;
}

.button {
    background: var(--accent);
    color: #fff;
}

.button:active {
    background: var(--accent-strong);
}

.button--secondary {
    background: transparent;
    color: var(--accent-strong);
    border: 1px solid var(--line);
}

.ghost-link {
    color: var(--muted);
    border: 1px solid var(--line);
}

/* ─── Pills ─── */
.pill {
    display: inline-flex;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--panel-soft);
    color: var(--muted);
    margin-left: 0.25rem;
}

.pill-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.35rem 0;
}

.field-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.status-row {
    display: grid;
    gap: 0.4rem;
}

.status-row__value {
    display: grid;
    gap: 0.15rem;
}

.category-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
}

.category-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.icon-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.icon-option {
    position: relative;
}

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

.icon-option__tile {
    display: grid;
    place-items: center;
    min-height: 3.5rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--muted);
}

.icon-option input:checked + .icon-option__tile {
    border-color: var(--accent);
    color: var(--accent-strong);
    background: rgba(31, 122, 85, 0.06);
}

.icon-option__tile .category-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.category-row {
    display: grid;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
}

.category-row:last-child {
    border-bottom: 0;
}

.category-row__main {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.category-row__actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.category-row__form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.category-row__form select {
    max-width: 12rem;
}

/* ─── Amounts ─── */
.amount-negative {
    color: var(--danger);
    font-weight: 700;
    white-space: nowrap;
}

.amount-positive {
    color: var(--accent-strong);
    font-weight: 700;
    white-space: nowrap;
}

/* Subtitle text in list rows */
.list-row .muted {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Directional arrows for colorblind accessibility */
.amount-positive::before {
    content: '\2191\00a0';
    font-size: 0.85em;
}

.amount-negative::before {
    content: '\2193\00a0';
    font-size: 0.85em;
}

/* ─── Flash Messages ─── */
.flash {
    margin-bottom: 1rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.flash--success {
    background: var(--success-soft);
    color: var(--accent-strong);
}

.flash--error {
    background: var(--danger-soft);
    color: var(--danger);
}

/* ─── Empty States ─── */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}

.empty-state__icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.empty-state p {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.empty-state .button {
    margin-top: 1rem;
}

/* ─── Inline Form (settings balance row) ─── */
.inline-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-form input {
    max-width: 8rem;
}

/* ─── Utilities ─── */
.text-right {
    text-align: right;
}

.lead {
    line-height: 1.5;
    font-size: 0.92rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ═══════════════════════════════════════════
   Responsive: Tablet (≥ 600px)
   ═══════════════════════════════════════════ */
@media (min-width: 600px) {
    .shell {
        width: min(1120px, calc(100% - 2.5rem));
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid--2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid--3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-two-col {
        grid-template-columns: repeat(2, 1fr);
    }

    .icon-picker {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .filter-bar {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-items: end;
    }

    .filter-bar__actions {
        grid-column: span 4;
    }

    .page-two-col > .data-panel {
        order: unset;
    }

    .add-cta {
        display: none;
    }

    /* Swap mobile cards for tables at tablet+ */
    .budget-cards,
    .report-cards {
        display: none;
    }

    .budget-table,
    .report-table {
        display: block;
    }
}

/* ═══════════════════════════════════════════
   Responsive: Desktop (≥ 769px)
   ═══════════════════════════════════════════ */
@media (min-width: 769px) {
    body {
        padding-bottom: 0;
    }

    h1 {
        font-size: 1.5rem;
    }

    .site-header__inner {
        padding: 0.6rem 0;
    }

    .brand__wordmark {
        font-size: 1.35rem;
    }

    .brand__meta {
        display: block;
        color: var(--muted);
        font-size: 0.85rem;
    }

    .site-header__actions {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .desktop-nav {
        display: flex;
        gap: 0.35rem;
        overflow-x: auto;
        padding: 0 0 0.75rem;
    }

    .desktop-nav__link {
        white-space: nowrap;
        padding: 0.55rem 0.85rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.7);
        border: 1px solid transparent;
        color: var(--muted);
        font-size: 0.88rem;
    }

    .desktop-nav__link.is-active {
        background: #fff;
        color: var(--text);
        border-color: var(--line);
    }

    /* Hide mobile bottom nav */
    .bottom-nav {
        display: none;
    }

    .page-shell {
        padding: 1.5rem 0 3rem;
    }

    .panel,
    .metric-card {
        padding: 1.5rem;
    }

    .hero-panel {
        padding: 1.5rem;
    }

    .grid--metrics {
        grid-template-columns: repeat(4, 1fr);
    }

    .grid--3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .hero-amount {
        font-size: clamp(2.5rem, 5vw, 4rem);
    }

    .metric-card strong,
    .metric-inline strong {
        font-size: 1.5rem;
    }

    .icon-picker {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .selection-bar {
        bottom: 1rem;
    }

    .table-wrap {
        margin: 0 -1.5rem;
        padding: 0 1.5rem;
    }

    .timeline__row {
        grid-template-columns: 5rem 1.25rem 1fr auto;
    }
}

/* ═══════════════════════════════════════════
   Responsive: Wide desktop (≥ 1024px)
   ═══════════════════════════════════════════ */
@media (min-width: 1024px) {
    .site-header__inner {
        padding: 0.75rem 0;
    }
}
