:root {
    --bb-bg: #FAF7F2;
    --bb-surface: #FFFFFF;
    --bb-surface-tint: #F4EFE6;
    --bb-ink: #1A1A1A;
    --bb-ink-muted: #6B6B6B;
    --bb-border: rgba(26, 26, 26, 0.08);
    --bb-primary: #0D5234;
    --bb-primary-soft: #E8F0EB;
    --bb-secondary: #D97706;
    --bb-secondary-soft: #FDF1E0;
    --bb-shadow-sm: 0 1px 2px rgba(13, 82, 52, 0.04), 0 1px 3px rgba(13, 82, 52, 0.06);
    --bb-shadow-md: 0 2px 4px rgba(13, 82, 52, 0.05), 0 6px 16px rgba(13, 82, 52, 0.08);
    --bb-shadow-lg: 0 4px 8px rgba(13, 82, 52, 0.06), 0 16px 32px rgba(13, 82, 52, 0.10);
}

html, body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    background: var(--bb-bg);
    color: var(--bb-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-image:
        radial-gradient(circle at 0% 0%, rgba(13, 82, 52, 0.025) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(217, 119, 6, 0.02) 0%, transparent 40%);
    background-attachment: fixed;
    min-height: 100dvh;
}

/* Typography rhythm */
h1, h2, h3, .mud-typography-h1, .mud-typography-h2, .mud-typography-h3, .mud-typography-h4 {
    letter-spacing: -0.025em;
    font-weight: 700;
}

.mud-typography-h5, .mud-typography-h6 {
    letter-spacing: -0.015em;
    font-weight: 600;
}

/* Tabular figures for any number display */
.bb-num, .mud-typography-h1, .mud-typography-h2, .mud-typography-h3 {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
}

/* Better focus rings */
*:focus-visible {
    outline: 2px solid var(--bb-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Page header utility */
.bb-page-header {
    margin: 1rem 0 2rem;
}

.bb-page-header .bb-eyebrow {
    color: var(--bb-ink-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.bb-page-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.05;
    margin: 0;
    color: var(--bb-ink);
}

/* Card surface override for MudPaper */
.bb-card.mud-paper {
    background: var(--bb-surface);
    border: 1px solid var(--bb-border);
    box-shadow: var(--bb-shadow-sm);
    border-radius: 16px;
    transition: transform 160ms ease, box-shadow 220ms ease;
}

.bb-card.bb-card-hover:hover {
    transform: translateY(-1px);
    box-shadow: var(--bb-shadow-md);
}

.bb-card.bb-card-hero {
    background: linear-gradient(140deg, #FFFFFF 0%, var(--bb-surface-tint) 100%);
    border-radius: 24px;
    box-shadow: var(--bb-shadow-md);
    border: 1px solid var(--bb-border);
    padding: 2.5rem 2rem;
}

/* Big tally button */
.bb-tally-btn {
    width: 100%;
    max-width: 320px;
    height: 96px;
    border-radius: 24px !important;
    font-size: 1.35rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.10), 0 12px 24px rgba(13, 82, 52, 0.18) !important;
    transition: transform 120ms ease, box-shadow 120ms ease !important;
}

.bb-tally-btn:hover {
    transform: translateY(-1px);
}

.bb-tally-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.10), 0 4px 8px rgba(13, 82, 52, 0.15) !important;
}

/* Big number display */
.bb-bignum {
    font-size: clamp(4rem, 14vw, 6.5rem);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--bb-primary);
    font-variant-numeric: tabular-nums;
    margin: 0;
}

.bb-bignum-sub {
    font-size: 1rem;
    color: var(--bb-ink-muted);
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Status pill */
.bb-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    letter-spacing: -0.005em;
    line-height: 1;
}

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

.bb-empty .bb-empty-icon {
    font-size: 2.5rem;
    opacity: 0.35;
    margin-bottom: 0.75rem;
}

.bb-empty .bb-empty-title {
    font-weight: 600;
    color: var(--bb-ink);
    margin-bottom: 0.25rem;
}

/* Recent list */
.bb-list {
    border-top: 1px solid var(--bb-border);
}

.bb-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0.25rem;
    border-bottom: 1px solid var(--bb-border);
    font-size: 0.95rem;
}

.bb-list-item-meta {
    color: var(--bb-ink-muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

/* Login surface */
.bb-login-surface {
    background: var(--bb-surface);
    border: 1px solid var(--bb-border);
    border-radius: 24px;
    box-shadow: var(--bb-shadow-lg);
    padding: 2.5rem 2rem;
}

.bb-login-mark {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--bb-primary) 0%, #1A6F45 100%);
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 8px 20px rgba(13, 82, 52, 0.25);
    margin: 0 auto 1.25rem;
}

.bb-login-mark .mud-icon-root {
    font-size: 2rem !important;
}

/* Subtle divider hint */
.bb-rule {
    height: 1px;
    background: var(--bb-border);
    width: 100%;
    margin: 1.25rem 0;
}

/* Mud overrides for app feel */
.mud-appbar.mud-appbar-color-primary {
    background: linear-gradient(95deg, #0D5234 0%, #1A6F45 100%) !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 4px 16px rgba(13, 82, 52, 0.10) !important;
}

.mud-drawer {
    background: var(--bb-surface) !important;
    border-right: 1px solid var(--bb-border) !important;
}

.mud-nav-link.active-hover, .mud-nav-link.mud-nav-link-active {
    background: var(--bb-primary-soft) !important;
    color: var(--bb-primary) !important;
    border-radius: 8px;
    margin: 2px 8px;
}

.mud-button-filled.mud-button-filled-primary {
    box-shadow: 0 1px 2px rgba(13, 82, 52, 0.12), 0 4px 8px rgba(13, 82, 52, 0.16) !important;
}

/* Form validation residual styles */
.valid.modified:not([type=checkbox]) { outline: 1px solid #2E7D32; }
.invalid { outline: 1px solid #C62828; }
.validation-message { color: #C62828; }
