/* Import CSS variables */
@import url("variables.8c512b612716.css");

/* ============================================
   Base Styles
   ============================================ */

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 14px;
}

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

a:hover {
    color: var(--primary-hover);
}

/* ============================================
   Global Typography Overrides
   Force consistent fonts across all pages
   ============================================ */

h1, .h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; margin-bottom: 0.5rem; }
h2, .h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; margin-bottom: 0.5rem; }
h3, .h3 { font-size: 17px; font-weight: 700; line-height: 1.3; margin-bottom: 0.5rem; }
h4, .h4 { font-size: 15px; font-weight: 700; line-height: 1.3; margin-bottom: 0.5rem; }
h5, .h5 { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 0.5rem; }
h6, .h6 { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 0.5rem; }

.card-header {
    font-size: 14px;
    font-weight: 600;
    padding: 12px 16px;
    background: transparent;
    border-bottom: 1px solid var(--border-list);
}

.card-title { font-size: 15px; font-weight: 700; margin-bottom: 0.25rem; }

/* Consistent text sizes */
.text-muted { color: var(--text-muted) !important; }
p { font-size: 14px; line-height: 1.5; }
small, .small { font-size: 12px; }
.fw-medium { font-weight: 600; }

/* Breadcrumb override */
.breadcrumb { font-size: 12px; margin-bottom: 0.5rem; }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-secondary); }

/* List group items */
.list-group-item {
    padding: 12px 16px;
    border-color: var(--border-list);
    font-size: 14px;
}

/* Badge overrides */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-squircle);
}

/* Table overrides */
.table { font-size: 13px; }
.table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* ============================================
   Card Component
   ============================================ */

.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    transition: border-color var(--transition);
    overflow: hidden;
}

.card:hover {
    border-color: #D1D5DB;
}

.card-body {
    padding: 16px;
}

.card-footer {
    background: transparent;
    border-top: none;
    padding: 12px 16px;
    padding-top: 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* Clickable card */
.card-clickable {
    cursor: pointer;
}

.card-clickable:hover {
    border-color: #D1D5DB;
}

.card-clickable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Group card icon */
.group-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ============================================
   Button Styles
   ============================================ */

.btn {
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-sm {
    font-size: 12px;
    padding: 6px 12px;
    gap: 4px;
}

.btn-lg {
    font-size: 15px;
    padding: 12px 24px;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--text-inverse);
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: var(--text-inverse);
}

.btn-success:hover {
    background-color: var(--success-dark);
    border-color: var(--success-dark);
}

.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background-color: var(--danger-dark);
    border-color: var(--danger-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border: 1.5px solid var(--border-color);
    background: var(--bg-primary);
}

.btn-outline-primary:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
    color: var(--primary);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
    background: var(--bg-primary);
}

.btn-outline-secondary:hover {
    border-color: var(--border-color-dark);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Old btn-lg kept for compatibility */
.btn-lg {
    font-size: 15px;
    padding: 12px 24px;
}

/* ============================================
   Status Badges
   ============================================ */

.badge-status {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-open,
.badge-status-open {
    background-color: var(--info-light);
    color: var(--info-dark);
}

.badge-approved,
.badge-status-approved {
    background-color: var(--success-light);
    color: var(--success-dark);
}

.badge-rejected,
.badge-status-rejected {
    background-color: var(--danger-light);
    color: var(--danger-dark);
}

.badge-more_info,
.badge-status-more_info {
    background-color: var(--warning-light);
    color: var(--warning-dark);
}

.badge-draft,
.badge-status-draft {
    background-color: var(--gray-100);
    color: var(--gray-600);
}

/* ============================================
   Form Styles
   ============================================ */

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.875rem;
}

/* ============================================
   Navigation
   ============================================ */

.navbar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary) !important;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
    background-color: var(--primary-light);
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
}

.empty-state-icon-blue { background: var(--primary-light); color: var(--primary); }
.empty-state-icon-red { background: var(--danger-light); color: var(--danger); }
.empty-state-icon-green { background: var(--success-light); color: var(--success); }
.empty-state-icon-amber { background: #FEF3C7; color: #D97706; }

.empty-state-title {
    font-size: 17px;
    font-weight: var(--font-heading);
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 240px;
    margin: 0 auto 20px;
}

/* ============================================
   HTMX Loading States
   ============================================ */

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   Expense Card
   ============================================ */

.expense-card {
    border-left: 4px solid var(--gray-300);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    position: relative;
}

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

.expense-card.status-open {
    border-left-color: var(--info);
    background: linear-gradient(to right, rgba(6, 182, 212, 0.08) 0%, transparent 25%);
}

.expense-card.status-open:hover {
    background: linear-gradient(to right, rgba(6, 182, 212, 0.12) 0%, transparent 30%);
}

.expense-card.status-approved {
    border-left-color: var(--success);
    background: linear-gradient(to right, rgba(16, 185, 129, 0.08) 0%, transparent 25%);
}

.expense-card.status-approved:hover {
    background: linear-gradient(to right, rgba(16, 185, 129, 0.12) 0%, transparent 30%);
}

.expense-card.status-rejected {
    border-left-color: var(--danger);
    background: linear-gradient(to right, rgba(239, 68, 68, 0.08) 0%, transparent 25%);
}

.expense-card.status-rejected:hover {
    background: linear-gradient(to right, rgba(239, 68, 68, 0.12) 0%, transparent 30%);
}

.expense-card.status-more_info {
    border-left-color: var(--warning);
    background: linear-gradient(to right, rgba(245, 158, 11, 0.08) 0%, transparent 25%);
}

.expense-card.status-more_info:hover {
    background: linear-gradient(to right, rgba(245, 158, 11, 0.12) 0%, transparent 30%);
}

.expense-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.expense-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.expense-vendor {
    font-weight: 600;
    color: var(--text-primary);
}

.expense-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============================================
   Comments
   ============================================ */

.comment {
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.comment-system {
    border-left-color: var(--info);
    background-color: var(--info-light);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-text {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ============================================
   Avatar
   ============================================ */

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
}

/* ============================================
   PWA Install Banner
   ============================================ */

.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    padding-bottom: calc(1rem + var(--safe-area-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: var(--z-fixed);
    transform: translateY(100%);
    transition: transform var(--transition-slow);
}

.pwa-install-banner.show {
    transform: translateY(0);
}

/* Hide install banner when running as installed PWA */
@media (display-mode: standalone) {
    .pwa-install-banner {
        display: none !important;
    }
}

.pwa-install-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.pwa-install-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
}

.pwa-install-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pwa-install-actions .btn {
    white-space: nowrap;
}

/* Mobile adjustments for PWA banner */
@media (max-width: 480px) {
    .pwa-install-banner {
        padding: 0.875rem;
    }

    .pwa-install-banner-content {
        gap: 0.75rem;
    }

    .pwa-install-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .pwa-install-text {
        flex: 1;
        min-width: 0;
    }

    .pwa-install-title {
        font-size: 0.875rem;
    }

    .pwa-install-desc {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pwa-install-actions {
        flex-direction: column;
        gap: 0.375rem;
    }

    .pwa-install-actions .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* Very small screens - stack layout */
@media (max-width: 360px) {
    .pwa-install-banner-content {
        flex-wrap: wrap;
    }

    .pwa-install-icon {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }

    .pwa-install-text {
        flex: 1 1 calc(100% - 48px);
    }

    .pwa-install-actions {
        width: 100%;
        flex-direction: row;
        margin-top: 0.5rem;
    }

    .pwa-install-actions .btn {
        flex: 1;
    }
}

/* ============================================
   Notification Badge
   ============================================ */

.notification-badge {
    position: relative;
}

.notification-badge .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    background-color: var(--danger);
    color: var(--text-inverse);
    border-radius: var(--radius-full);
}

/* ============================================
   Tabs
   ============================================ */

.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    background: transparent;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: var(--gray-300);
    background: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* ============================================
   Utilities
   ============================================ */

.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

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

.text-warning {
    color: var(--warning) !important;
}

.bg-light {
    background-color: var(--bg-secondary) !important;
}

.border-0 {
    border: none !important;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.min-width-0 {
    min-width: 0;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card {
        border-radius: var(--radius);
    }

    .btn {
        padding: 0.625rem 1rem;
    }

    .expense-amount {
        font-size: 1.125rem;
    }
}

/* Safe area for PWA */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .pwa-install-banner {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* ============================================
   Mobile PWA Styles
   ============================================ */

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-primary);
    border-top: 1px solid var(--border-list);
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    padding-top: 8px;
    padding-left: 8px;
    padding-right: 8px;
    z-index: var(--z-bottom-nav);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    padding: 0;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 400;
    transition: color var(--transition);
    -webkit-tap-highlight-color: transparent;
    background: none;
    border: none;
    cursor: pointer;
}

.bottom-nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
}

.bottom-nav-item span {
    margin-top: 2px;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
    color: var(--primary);
}

.bottom-nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

/* Gradient FAB */
.bottom-nav-fab {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    margin-top: -18px;
    -webkit-tap-highlight-color: transparent;
    /* It's a <button>: drop the browser's default box. */
    background: none;
    border: 0;
    padding: 0;
}

.bottom-nav-fab:focus { outline: none; }
.bottom-nav-fab:focus-visible .fab-circle {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.bottom-nav-fab .fab-circle {
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-fab);
}

.bottom-nav-fab .fab-circle i {
    font-size: 22px;
    color: white;
}

.bottom-nav-fab span {
    font-size: 10px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 3px;
}

.bottom-nav-fab:active .fab-circle {
    transform: scale(0.95);
}

/* Legacy add button (kept for compatibility) */
.bottom-nav-add {
    color: var(--primary);
}

.bottom-nav-add i {
    font-size: 1.75rem;
}

/* Notification dot */
.notification-dot {
    width: 7px;
    height: 7px;
    background: var(--danger);
    border-radius: 50%;
    position: absolute;
    top: -2px;
    right: 6px;
}

.bottom-nav-item {
    position: relative;
}

/* Body padding for bottom nav */
body.has-bottom-nav {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

/* The bottom nav is mobile-only (d-lg-none), so is the space reserved for it. */
@media (min-width: 992px) {
    body.has-bottom-nav { padding-bottom: 0; }
}

/* PWA install banner adjustment when bottom nav present */
body.has-bottom-nav .pwa-install-banner {
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: calc(12px + var(--safe-area-top));
    left: 50%;
    transform: translateX(-50%);
    max-width: 360px;
    width: calc(100% - 32px);
    z-index: var(--z-toast);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    pointer-events: auto;
    animation: toast-slide-in 250ms ease-out;
}

.toast.toast-hiding {
    animation: toast-slide-out 200ms ease-in forwards;
}

/* Legacy toast icon class (kept for JS compatibility) */
.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* New squircle toast icon */
.toast-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.toast-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.toast-close {
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    padding: 4px;
    background: none;
    border: none;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Toast variants */
.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-success .toast-icon-wrap { background: var(--success-light); color: var(--success); }

.toast-error { border-left: 3px solid var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-error .toast-icon-wrap { background: var(--danger-light); color: var(--danger); }

.toast-info { border-left: 3px solid var(--primary); }
.toast-info .toast-icon { color: var(--primary); }
.toast-info .toast-icon-wrap { background: var(--primary-light); color: var(--primary); }

.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-warning .toast-icon-wrap { background: #FEF3C7; color: #D97706; }

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-slide-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-100%); }
}

/* ============================================
   Offline Banner
   ============================================ */

.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--warning);
    color: var(--gray-900);
    padding: 0.5rem 1rem;
    padding-top: calc(0.5rem + var(--safe-area-top));
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: var(--z-offline-banner);
    transform: translateY(-100%);
    transition: transform var(--transition-slow);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.offline-banner.show {
    display: flex;
    transform: translateY(0);
}

.offline-banner i {
    font-size: 1rem;
}

/* ============================================
   Action Sheet
   ============================================ */

.action-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 1rem;
    padding-bottom: calc(1rem + var(--safe-area-bottom));
    z-index: var(--z-modal);
    transform: translateY(100%);
    transition: transform var(--transition-slow);
}

.action-sheet.show {
    transform: translateY(0);
}

.action-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    margin: 0 auto 1rem;
}

.action-sheet-title {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.action-sheet-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background var(--transition);
}

.action-sheet-item:hover,
.action-sheet-item:focus {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.action-sheet-item i {
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-squircle);
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
}

.action-sheet-item.destructive i {
    background: var(--danger-light);
    color: var(--danger);
}

.action-sheet-item-text {
    flex: 1;
}

.action-sheet-item-title {
    font-weight: 500;
    margin-bottom: 0.125rem;
}

.action-sheet-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.action-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.action-sheet-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Mobile Touch Targets
   ============================================ */

@media (max-width: 768px) {
    /* Buttons */
    .btn {
        min-height: var(--touch-target-min);
        padding: 0.625rem 1rem;
    }

    .btn-sm {
        min-height: 36px;
    }

    /* Form inputs - 16px font prevents iOS zoom */
    .form-control,
    .form-select {
        min-height: var(--touch-target-input);
        font-size: 16px;
    }

    /* List items */
    .list-group-item {
        min-height: var(--touch-target-list);
        padding: 0.875rem 1rem;
    }

    /* Nav tabs */
    .nav-tabs .nav-link {
        padding: 0.75rem 1rem !important;
    }

    /* Dropdown items */
    .dropdown-item {
        padding: 0.75rem 1rem;
    }
}

/* ============================================
   Full-Width Mobile Cards
   ============================================ */

@media (max-width: 576px) {
    .card-mobile-full {
        margin-left: -1rem;
        margin-right: -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    /* Container adjustments */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ============================================
   Scrollable Status Tabs
   ============================================ */

.nav-tabs-scrollable {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-tabs-scrollable::-webkit-scrollbar {
    display: none;
}

.nav-tabs-scrollable .nav-item {
    flex-shrink: 0;
}

.nav-tabs-scrollable .nav-link {
    white-space: nowrap;
}

/* ============================================
   Status Filter Tabs (Segmented Control Style)
   ============================================ */

/* Status filter tabs — raised active tab */
.status-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: var(--gray-100);
    border-radius: var(--radius-card);
}

.status-tabs .nav-item { flex: 1; }

.status-tabs .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
    width: 100%;
    position: relative;
}

.status-tabs .nav-link:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.5);
}

.status-tabs .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Icon */
.status-tabs .status-icon {
    font-size: 16px;
    display: block;
    margin-bottom: 1px;
}

/* Colored icons */
.status-tabs .nav-link[data-status="all"] .status-icon { color: var(--primary); }
.status-tabs .nav-link[data-status="open"] .status-icon { color: var(--info); }
.status-tabs .nav-link[data-status="approved"] .status-icon { color: var(--success); }
.status-tabs .nav-link[data-status="rejected"] .status-icon { color: var(--danger); }
.status-tabs .nav-link[data-status="more_info"] .status-icon { color: var(--warning); }

/* Count */
.status-tabs .status-count {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
}

.status-tabs .nav-link.active .status-count {
    background: var(--primary);
    color: white;
}

.status-tabs .nav-link[data-status="open"].active .status-count { background: var(--info); }
.status-tabs .nav-link[data-status="approved"].active .status-count { background: var(--success); }
.status-tabs .nav-link[data-status="rejected"].active .status-count { background: var(--danger); }
.status-tabs .nav-link[data-status="more_info"].active .status-count { background: var(--warning); color: var(--text-primary); }

/* Label */
.status-tabs .status-label {
    font-size: 10px;
    letter-spacing: 0.3px;
}

/* Mobile: icon only */
@media (max-width: 767px) {
    .status-tabs .status-label { display: none; }
    .status-tabs .nav-link { padding: 10px 4px; }
    .status-tabs .status-icon { font-size: 18px; }
}

/* Card header with tabs */
.card-header:has(.status-tabs) {
    padding: 8px;
    background: transparent;
    border-bottom: none;
}

/* ============================================
   Dashboard Components
   ============================================ */

/* Review Alert */
.review-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    color: white;
}

.review-alert-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.review-alert-icon {
    font-size: 1.25rem;
    opacity: 0.9;
}

.review-alert-text {
    font-size: 0.875rem;
}

.review-alert .btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
}

.review-alert .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

@media (min-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(to bottom right, var(--bg-primary), var(--gray-50));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: default;
}

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

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius);
    font-size: 1.125rem;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

.stat-card-primary .stat-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card-warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-card-info .stat-icon {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info);
}

.stat-card-success .stat-icon {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.stat-content {
    min-width: 0;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 575.98px) {
    .stat-card {
        padding: 0.75rem;
        gap: 0.625rem;
    }

    .stat-icon {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1.125rem;
    }
}

/* Expense List (Mobile) */
.expense-list {
    display: flex;
    flex-direction: column;
}

.expense-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s ease;
}

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

.expense-list-item:active {
    background: var(--bg-secondary);
}

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

.expense-list-vendor {
    font-weight: 500;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expense-list-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.expense-list-end {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}

.expense-list-amount {
    font-weight: 600;
    font-size: 0.9375rem;
}

.badge-sm {
    font-size: 0.625rem;
    padding: 0.2rem 0.4rem;
}

/* ============================================
   Sticky Section Headers
   ============================================ */

.sticky-header {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    padding: 0.75rem 0;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    z-index: var(--z-sticky);
    border-bottom: 1px solid var(--border-color);
}

/* ============================================
   Skeleton Loading States
   ============================================ */

.skeleton-line {
    height: 1rem;
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

.skeleton-line-sm {
    height: 0.75rem;
}

.skeleton-line-lg {
    height: 1.5rem;
}

.skeleton-line-short {
    width: 60%;
}

.skeleton-line-shorter {
    width: 40%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-card {
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

/* ============================================
   Button Loading States
   ============================================ */

.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-primary.btn-loading::after {
    border-color: var(--text-inverse);
    border-right-color: transparent;
}

/* ============================================
   Mobile Header Adjustments
   ============================================ */

@media (max-width: 991.98px) {
    /* Hide text nav items on mobile - use bottom nav instead */
    .navbar .navbar-nav.me-auto {
        display: none !important;
    }

    /* Keep navbar compact */
    .navbar {
        padding: 0.5rem 0;
    }

    .navbar-brand {
        font-size: 1.125rem;
    }

    /* Hide hamburger on mobile when using bottom nav */
    .navbar-toggler {
        display: none !important;
    }

    /* Always show user actions */
    .navbar .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }

    .navbar .navbar-nav:last-child {
        flex-direction: row;
        margin-left: auto;
    }
}

/* ============================================
   Responsive Adjustments (existing enhanced)
   ============================================ */

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card {
        border-radius: var(--radius);
    }

    .expense-amount {
        font-size: 1.125rem;
    }

    /* Improve tap feedback */
    .btn:active,
    .nav-link:active,
    .list-group-item:active {
        opacity: 0.8;
    }
}

/* ============================================
   Push Notification Prompt Banner
   ============================================ */

.push-prompt-banner {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
    left: 1rem;
    right: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1050;
    transform: translateY(150%);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.push-prompt-banner.show {
    transform: translateY(0);
    opacity: 1;
}

.push-prompt-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.push-prompt-icon {
    font-size: 1.5rem;
    color: var(--primary);
    flex-shrink: 0;
}

.push-prompt-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.push-prompt-text strong {
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.push-prompt-text span {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.push-prompt-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.push-prompt-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

@media (min-width: 576px) {
    .push-prompt-banner {
        left: auto;
        right: 1rem;
        bottom: 1.5rem;
        max-width: 360px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .push-prompt-actions {
        flex-shrink: 0;
    }
}

/* ============================================
   Reskin Utility Classes
   ============================================ */

/* Form input updates */
.form-control, .form-select {
    min-height: 40px;
    font-size: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: border-color var(--transition), box-shadow var(--transition);
    padding: 8px 12px;
}

/* Note: iOS zooms on inputs <16px font. Since target is Android, keeping 14px everywhere. */

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.form-control-sm { min-height: 32px; font-size: 12px; padding: 4px 8px; }

.form-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
}

.form-check-label {
    font-size: 14px;
}

/* Touch feedback */
.tappable:active {
    background: var(--gray-50) !important;
}

/* Staggered fade-in (first 6 items only) */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-item { opacity: 0; animation: fadeIn 150ms ease forwards; }
.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 50ms; }
.stagger-item:nth-child(3) { animation-delay: 100ms; }
.stagger-item:nth-child(4) { animation-delay: 150ms; }
.stagger-item:nth-child(5) { animation-delay: 200ms; }
.stagger-item:nth-child(6) { animation-delay: 250ms; }
.stagger-item:nth-child(n+7) { opacity: 1; animation: none; }

/* Skeleton shimmer */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* Squircle icon container */
.icon-squircle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-squircle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.icon-squircle-sm {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

.icon-squircle-lg {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    font-size: 32px;
}

.icon-squircle-blue { background: var(--primary-light); color: var(--primary); }
.icon-squircle-green { background: var(--success-light); color: var(--success); }
.icon-squircle-amber { background: #FEF3C7; color: #D97706; }
.icon-squircle-cyan { background: var(--info-light); color: var(--info); }
.icon-squircle-red { background: var(--danger-light); color: var(--danger); }
.icon-squircle-indigo { background: #E0E7FF; color: #4F46E5; }
.icon-squircle-dark-translucent { background: var(--surface-dark-icon-bg); color: var(--brand-azure-light); }

/* Status dot */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-pending, .status-dot-open { background: var(--warning); }
.status-dot-approved { background: var(--success); }
.status-dot-rejected { background: var(--danger); }
.status-dot-more_info { background: var(--info); }
.status-dot-draft { background: var(--gray-400); }

/* Dark stats card */
.stats-card {
    background: var(--surface-dark);
    border-radius: var(--radius-hero);
    padding: 20px;
    color: var(--surface-dark-text);
}

.stats-card-label {
    font-size: 11px;
    color: var(--surface-dark-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-card-value {
    font-size: 28px;
    font-weight: var(--font-display);
    letter-spacing: -0.5px;
    margin-top: 4px;
}

.stats-card-metric { text-align: left; }

.stats-card-metric-value {
    font-size: 18px;
    font-weight: 700;
}

.stats-card-metric-label {
    font-size: 10px;
    color: var(--surface-dark-muted);
    margin-top: 2px;
}

/* Quick action grid */
.quick-action {
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color var(--transition);
}

.quick-action:hover {
    border-color: #D1D5DB;
    color: var(--text-primary);
}

.quick-action-label {
    font-size: 12px;
    font-weight: 600;
}

/* App switcher pills */
.app-pill {
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: background-color var(--transition), color var(--transition);
    cursor: pointer;
    border: none;
}

.app-pill-active {
    background: var(--brand-navy);
    color: white;
    font-weight: 600;
}

.app-pill-inactive {
    background: var(--gray-100);
    color: var(--text-muted);
}

.app-pill-inactive:hover {
    background: var(--gray-200);
    color: var(--text-secondary);
}

/* Pending badge pill */
.badge-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #FEF3C7;
    border-radius: var(--radius-squircle);
    font-size: 10px;
    font-weight: 600;
    color: #92400E;
}

/* ==========================================================================
   Accessibility & polish — Phase 1
   ========================================================================== */

/* Sticky table headers for list/index tables.
   Works when table is inside a scroll container or page-level scroll. */
.table-sticky thead th {
    position: sticky;
    top: 0;
    background: var(--bs-body-bg, #ffffff);
    z-index: 2;
    box-shadow: 0 1px 0 0 var(--border-list, #e5e7eb);
}

/* Global focus-visible ring for keyboard users on interactive elements
   that don't already have a bespoke focus style. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--primary, #0d6efd);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reason-for-disabled helper: screen-reader-only text used with
   aria-describedby on disabled buttons. */
.visually-hidden-reason {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Skeleton loaders (Phase 2)
   ========================================================================== */
@keyframes skeleton-shimmer {
    0%   { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton-card,
.skeleton-row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-list, #e5e7eb);
}
.skeleton-card:last-child,
.skeleton-row:last-child { border-bottom: none; }

.skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        var(--gray-100, #f3f4f6) 25%,
        var(--gray-200, #e5e7eb) 50%,
        var(--gray-100, #f3f4f6) 75%
    );
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    margin-bottom: 8px;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line-title { height: 14px; width: 55%; }
.skeleton-line-body  { height: 12px; width: 100%; }
.skeleton-line-meta  { height: 10px; width: 35%; }

/* HTMX indicator convention: show when request in flight. */
.skeleton-indicator { display: none; }
.htmx-request .skeleton-indicator,
.htmx-request.skeleton-indicator { display: block; }

/* Command palette */
.command-palette-section {
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #6b7280);
    background: var(--gray-50, #F8FAFC);
}
.command-palette-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary, #111827);
    border-left: 2px solid transparent;
}
.command-palette-item:hover,
.command-palette-item.active {
    background: var(--gray-100, #f3f4f6);
    border-left-color: var(--primary, #0d6efd);
}

/* ==========================================================================
   Design token utilities (type, line-height, spacing).
   Namespaced .u-* to avoid Bootstrap collisions.
   ========================================================================== */

.u-text-2xs { font-size: var(--text-2xs); }
.u-text-xs  { font-size: var(--text-xs); }
.u-text-sm  { font-size: var(--text-sm); }
.u-text-base { font-size: var(--text-base); }
.u-text-md  { font-size: var(--text-md); }
.u-text-lg  { font-size: var(--text-lg); }
.u-text-xl  { font-size: var(--text-xl); }
.u-text-2xl { font-size: var(--text-2xl); }
.u-text-3xl { font-size: var(--text-3xl); }

.u-leading-tight   { line-height: var(--line-tight); }
.u-leading-normal  { line-height: var(--line-normal); }
.u-leading-relaxed { line-height: var(--line-relaxed); }

.u-space-0  { padding: var(--space-0); }
.u-space-1  { padding: var(--space-1); }
.u-space-2  { padding: var(--space-2); }
.u-space-3  { padding: var(--space-3); }
.u-space-4  { padding: var(--space-4); }
.u-space-5  { padding: var(--space-5); }
.u-space-6  { padding: var(--space-6); }
.u-space-8  { padding: var(--space-8); }
.u-space-10 { padding: var(--space-10); }
.u-space-12 { padding: var(--space-12); }

.u-gap-1 { gap: var(--space-1); }
.u-gap-2 { gap: var(--space-2); }
.u-gap-3 { gap: var(--space-3); }
.u-gap-4 { gap: var(--space-4); }
.u-gap-5 { gap: var(--space-5); }
.u-gap-6 { gap: var(--space-6); }

/* Unread notification row highlight (replaces inline #F0F7FF). */
.notification-unread {
    background: var(--primary-light);
}

/* Canonical keyboard-focus ring.
   :where() keeps specificity at 0 so component overrides still win. */
:where(a, button, [role="button"], input, select, textarea):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: inherit;
}

/* Suppress outlines on non-keyboard focus where browsers still draw them. */
:focus:not(:focus-visible) {
    outline: none;
}

/* iOS safe-area: add top padding on standalone PWA so the navbar clears the notch. */
.navbar.sticky-top {
    padding-top: max(var(--space-1), var(--safe-area-top));
}

/* Button loading state — used by HTMX and native submit hooks.
   Keeps button width stable to prevent layout jank. */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    color: var(--text-inverse);
    animation: btn-spin 700ms linear infinite;
}
.btn-outline-secondary.is-loading::after,
.btn-ghost.is-loading::after {
    color: var(--text-primary);
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* Command-palette trigger pill (desktop navbar). */
.cmd-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-list);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.cmd-pill:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.cmd-pill kbd {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--text-2xs);
    padding: 1px 6px;
    color: var(--text-secondary);
}

/* ==========================================================================
   Status badges — leading icon so color isn't the only status cue.
   ========================================================================== */
.badge-status-open::before,
.badge-status-approved::before,
.badge-status-rejected::before,
.badge-status-more_info::before,
.badge-status-draft::before {
    font-family: 'bootstrap-icons';
    font-weight: 400;
    display: inline-block;
    margin-right: var(--space-1);
    font-size: 0.9em;
    line-height: 1;
    vertical-align: -0.05em;
}
.badge-status-open::before       { content: "\f293"; }  /* bi-clock */
.badge-status-approved::before   { content: "\f26a"; }  /* bi-check-circle-fill */
.badge-status-rejected::before   { content: "\f622"; }  /* bi-x-circle-fill */
.badge-status-more_info::before  { content: "\f504"; }  /* bi-question-circle-fill */
.badge-status-draft::before      { content: "\f4c9"; }  /* bi-pencil-fill */

/* Sync / offline indicator pill (desktop navbar). */
.sync-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-list);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: var(--text-xs);
    line-height: 1;
}
.sync-pill .sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}
.sync-pill.is-offline          { color: var(--warning-dark); border-color: var(--warning-light); }

/* Draft save indicator — auto-injected by draft-save.js next to form submit. */
.draft-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--text-muted);
    padding: 2px 0;
    transition: opacity 200ms ease-in-out;
}
.draft-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}
.draft-pill.is-dirty::before   { background: var(--warning); }
.draft-pill.is-hidden          { opacity: 0; pointer-events: none; }

/* Upload progress rows and aggregate bar (expense-upload.js). */
.upload-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
}
.upload-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    color: var(--text-muted);
    flex-shrink: 0;
}
.upload-meta { min-width: 0; flex-grow: 1; }
.upload-name {
    font-size: var(--text-sm);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-size {
    font-size: var(--text-xs);
    color: var(--text-muted);
}
.upload-progress {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: var(--space-2);
}
.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 120ms linear;
}
.sync-pill.is-offline .sync-dot { background: var(--warning); }

/* Keep navbar dropdowns overlaying (absolute) instead of flowing inline.
   Bootstrap sets .navbar-nav .dropdown-menu to position:static below the
   expand breakpoint, which pushes the navbar taller on mobile. */
.navbar-nav .dropdown-menu {
    position: absolute;
}

/* Character counter auto-injected by field-validation.js next to data-count-chars textareas. */
.char-counter {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
    text-align: right;
}
.char-counter.is-warning { color: var(--warning-dark); }
.char-counter.is-danger  { color: var(--danger-dark); }

.notification-swiping {
    transition: transform 0.05s linear, opacity 0.05s linear;
    background: var(--danger-light, #fde7e7);
    position: relative;
    z-index: 1;
}
.notification-swiping::after {
    content: '\f5de'; /* bi-trash — Bootstrap Icons 1.11.3 */
    font-family: 'bootstrap-icons';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--danger, #dc3545);
    font-size: 20px;
    pointer-events: none;
}

/* Sprint 5 — sticky action bar on long detail pages (mobile). */
#sticky-action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-elevated, #ffffff);
    border-top: 1px solid var(--border-list, #e5e7eb);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(120%);
    transition: transform 0.2s ease-out;
    z-index: 1020;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#sticky-action-bar.active {
    transform: translateY(0);
}
body.sticky-action-active {
    padding-bottom: 120px;
}
@media (min-width: 769px) {
    #sticky-action-bar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    #sticky-action-bar { transition: none; }
}

/* Sprint 6 — install banner (separate from .offline-banner; sits above bottom-nav). */
.install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 1040;
    padding: 12px 14px;
    background: var(--bg-elevated, #ffffff);
    border: 1px solid var(--border-list, #e5e7eb);
    border-radius: var(--radius-card, 12px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    transform: translateY(120%);
    transition: transform 0.25s ease-out;
}
.install-banner.show { transform: translateY(0); }
.install-banner-content { display: flex; gap: 10px; align-items: center; min-width: 0; flex: 1; }
.install-banner-icon { font-size: 24px; color: var(--primary, #2563EB); flex-shrink: 0; }
.install-banner-text { min-width: 0; font-size: 13px; line-height: 1.3; }
.install-banner-text strong { display: block; font-weight: 600; }
.install-banner-text span { color: var(--text-muted); font-size: 12px; }
.install-banner-actions { display: flex; gap: 6px; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) {
    .install-banner { transition: none; }
}
@media (min-width: 769px) {
    .install-banner { left: auto; right: 20px; bottom: 20px; max-width: 420px; }
}

/* Sprint 6 — pull-to-refresh indicator. */
.ptr-indicator {
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    color: var(--primary);
    font-size: 20px;
    pointer-events: none;
    transform-origin: center;
    transition: opacity 0.2s ease, transform 0.1s linear;
}
.ptr-indicator.ptr-ready { color: var(--success, #16a34a); }
.ptr-indicator.ptr-loading i { animation: ptr-spin 0.8s linear infinite; }
@keyframes ptr-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
[data-ptr-url] { position: relative; transition: transform 0.2s ease-out; }

/* Sprint 6 — keyboard navigation focus indicator. */
[data-list-nav-item].focused {
    outline: 2px solid var(--primary, #2563EB);
    outline-offset: -2px;
    background: var(--primary-light, rgba(37, 99, 235, 0.08));
}

/* Keep the footer at the bottom of short pages. */
body { display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }

/* Site footer with "Powered by ZeroBit.tech". The ZeroBit mark swaps with the
   resolved theme; brand rules: don't recolour or stretch it, keep it beside the text. */
.site-footer {
    margin-top: 32px;
    border-top: 1px solid var(--border-list);
    background: var(--bg-primary);
    font-size: 12px;
    color: var(--text-secondary);
}
.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 6px 16px;
    padding-top: 14px;
    padding-bottom: 14px;
}
.site-footer-legal { display: inline-flex; align-items: center; gap: 12px; }
.site-footer-legal a { color: var(--text-secondary); text-decoration: none; }
.site-footer-legal a:hover,
.site-footer-legal a:focus-visible { color: var(--primary); text-decoration: underline; }
.site-footer-powered {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
}
.site-footer-powered strong { font-weight: 600; color: var(--text-primary); }
.site-footer-powered:hover strong,
.site-footer-powered:focus-visible strong { color: var(--primary); }
.zerobit-mark { height: 18px; width: auto; }

/* Logos that ship a light and a dark variant: show the one for the resolved theme. */
.theme-mark-dark { display: none; }
[data-resolved-theme="dark"] .theme-mark-light { display: none; }
[data-resolved-theme="dark"] .theme-mark-dark { display: inline; }

/* Navbar brand: Approved mark beside the name. */
.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    text-decoration: none;
}
.app-brand-mark { height: 30px; width: auto; }
.app-brand-name {
    font-family: 'Plus Jakarta Sans', var(--bs-body-font-family, system-ui), sans-serif;
    font-size: var(--text-lg);
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}
/* The "o" picks up the logo's azure (light azure in dark mode). */
.app-brand-accent { color: var(--primary); }
/* Tier suffix inside the wordmark, like the Prime mark on Amazon: hairline + tier word. */
.app-brand-tier {
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--primary);
    padding-left: 8px;
    border-left: 1px solid var(--border-list);
    line-height: 1;
    align-self: center;
}
.app-brand-tier.is-free { color: var(--text-muted); font-weight: 600; }

@media (max-width: 991.98px) {
    .site-footer-inner { flex-direction: column; justify-content: center; }
}

/* Long-form pages: privacy policy, account deletion. */
.legal-page { max-width: 720px; margin: 0 auto; line-height: var(--line-relaxed); }
.legal-page h2 { font-size: var(--text-lg); font-weight: 700; margin: 28px 0 8px; }
.legal-page ul, .legal-page ol { padding-left: 20px; }
.legal-page li { margin-bottom: 4px; }
.legal-meta { color: var(--text-muted); font-size: var(--text-sm); }

/* Sprint 7 — theme picker (profile). */
.theme-picker { border: none; padding: 0; margin: 0; }
.theme-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-list);
    border-radius: var(--radius-pill);
    cursor: pointer;
    user-select: none;
    background: var(--bg-primary);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.theme-option input { margin: 0; accent-color: var(--primary); }
.theme-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ==========================================================================
   Sprint 7 — Dark-mode contrast sweep
   Targeted overrides for elements with hardcoded hex/rgba values that
   don't respond to the dark palette variable cascade.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Scrollbar
   -------------------------------------------------------------------------- */
[data-theme="dark"],
[data-resolved-theme="dark"] {
    scrollbar-color: var(--border-color-dark) var(--bg-secondary);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb,
[data-resolved-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border-color-dark);
}
[data-theme="dark"] ::-webkit-scrollbar-track,
[data-resolved-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

/* --------------------------------------------------------------------------
   Form controls — background, text, border, placeholder, focus ring
   -------------------------------------------------------------------------- */
[data-theme="dark"] .form-control,
[data-resolved-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-resolved-theme="dark"] .form-select {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .form-control::placeholder,
[data-resolved-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}
[data-theme="dark"] .form-control:focus,
[data-resolved-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-resolved-theme="dark"] .form-select:focus {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(88, 166, 255, 0.25);
}

/* --------------------------------------------------------------------------
   Card, modal, dropdown
   -------------------------------------------------------------------------- */
[data-theme="dark"] .card,
[data-resolved-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-resolved-theme="dark"] .modal-content {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .modal-header,
[data-resolved-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer,
[data-resolved-theme="dark"] .modal-footer {
    border-color: var(--border-color);
}
[data-theme="dark"] .dropdown-menu,
[data-resolved-theme="dark"] .dropdown-menu {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .dropdown-item,
[data-resolved-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}
[data-theme="dark"] .dropdown-item:hover,
[data-resolved-theme="dark"] .dropdown-item:hover {
    background-color: var(--bg-muted);
}

/* --------------------------------------------------------------------------
   Buttons — ghost and outline variants
   -------------------------------------------------------------------------- */
[data-theme="dark"] .btn-ghost,
[data-resolved-theme="dark"] .btn-ghost {
    color: var(--text-primary);
}
[data-theme="dark"] .btn-ghost:hover,
[data-resolved-theme="dark"] .btn-ghost:hover {
    background-color: var(--bg-muted);
}
[data-theme="dark"] .btn-outline-primary,
[data-resolved-theme="dark"] .btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
[data-theme="dark"] .btn-outline-secondary,
[data-resolved-theme="dark"] .btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

/* --------------------------------------------------------------------------
   Hardcoded amber/yellow — toast-warning icon wrap, icon-squircle-amber,
   badge-pending, empty-state-icon-amber.
   The light-theme amber (#FEF3C7 bg / #D97706 or #92400E text) has poor
   contrast on dark backgrounds; use transparent tint + lighter amber text.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .toast-warning .toast-icon-wrap,
[data-resolved-theme="dark"] .toast-warning .toast-icon-wrap {
    background: rgba(210, 153, 34, 0.2);
    color: var(--warning);
}
[data-theme="dark"] .icon-squircle-amber,
[data-resolved-theme="dark"] .icon-squircle-amber {
    background: rgba(210, 153, 34, 0.2);
    color: var(--warning);
}
[data-theme="dark"] .empty-state-icon-amber,
[data-resolved-theme="dark"] .empty-state-icon-amber {
    background: rgba(210, 153, 34, 0.2);
    color: var(--warning);
}
[data-theme="dark"] .badge-pending,
[data-resolved-theme="dark"] .badge-pending {
    background: rgba(210, 153, 34, 0.2);
    color: var(--warning);
}

/* --------------------------------------------------------------------------
   Hardcoded indigo — icon-squircle-indigo (#E0E7FF bg / #4F46E5 text).
   Dark: use alpha tint + lighter indigo.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .icon-squircle-indigo,
[data-resolved-theme="dark"] .icon-squircle-indigo {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

/* --------------------------------------------------------------------------
   App-pill-active — navy bg / white text.
   On dark: invert to a light surface with dark text.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .app-pill-active,
[data-resolved-theme="dark"] .app-pill-active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--primary);
}

/* --------------------------------------------------------------------------
   Card hover / clickable-card hover — hardcoded #D1D5DB border.
   On dark: use the dark border variable so the hover ring remains visible.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .card:hover,
[data-resolved-theme="dark"] .card:hover,
[data-theme="dark"] .card-clickable:hover,
[data-resolved-theme="dark"] .card-clickable:hover {
    border-color: var(--border-color);
}

/* --------------------------------------------------------------------------
   Status-tabs nav hover — rgba(255,255,255,0.5) is invisible on dark.
   Status-count inactive badge — rgba(255,255,255,0.7) is invisible on dark.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .status-tabs .nav-link:hover,
[data-resolved-theme="dark"] .status-tabs .nav-link:hover {
    background: var(--bg-muted);
}
[data-theme="dark"] .status-tabs .status-count,
[data-resolved-theme="dark"] .status-tabs .status-count {
    background: var(--bg-muted);
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Sticky table header — hardcoded var(--bs-body-bg, #ffffff) fallback.
   Override so the sticky header uses the dark body background.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .table-sticky thead th,
[data-resolved-theme="dark"] .table-sticky thead th {
    background: var(--bg-primary);
}

/* --------------------------------------------------------------------------
   Stat-card icon tints — rgba hardcoded values; bump alpha for dark vis.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .stat-card-primary .stat-icon,
[data-resolved-theme="dark"] .stat-card-primary .stat-icon {
    background: rgba(88, 166, 255, 0.15);
}
[data-theme="dark"] .stat-card-warning .stat-icon,
[data-resolved-theme="dark"] .stat-card-warning .stat-icon {
    background: rgba(210, 153, 34, 0.15);
}
[data-theme="dark"] .stat-card-info .stat-icon,
[data-resolved-theme="dark"] .stat-card-info .stat-icon {
    background: rgba(56, 189, 248, 0.15);
}
[data-theme="dark"] .stat-card-success .stat-icon,
[data-resolved-theme="dark"] .stat-card-success .stat-icon {
    background: rgba(63, 185, 80, 0.15);
}

/* --------------------------------------------------------------------------
   FAB gradient — dark-mode variant of the primary gradient.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .bottom-nav-fab .fab-circle,
[data-resolved-theme="dark"] .bottom-nav-fab .fab-circle {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
