:root {
    --bg-base: #0f172a;
    --bg-surface: #1e293b;
    --bg-elevated: #334155;
    --border: #475569;
    --border-subtle: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent: #34d399;
    --accent-hover: #10b981;
    --accent-muted: #059669;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/fonts/webfonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    font-family: 'Vazirmatn', system-ui, sans-serif;
}

.safe-top {
    padding-top: env(safe-area-inset-top);
}

.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

body {
    -webkit-tap-highlight-color: transparent;
    background-color: var(--bg-base);
    color: var(--text-primary);
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    flex-shrink: 0;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.625rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

.header-btn:hover {
    color: var(--accent);
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.15);
}

.header-btn:active {
    background: rgba(52, 211, 153, 0.15);
    transform: scale(0.94);
}

.header-btn-danger:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.2);
}

.header-btn-danger:active {
    background: rgba(248, 113, 113, 0.18);
}

.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    pointer-events: none;
}

.header-icon svg {
    width: 20px;
    height: 20px;
}

.nav-tab.active {
    color: var(--accent);
}

.nav-bar-inner {
    min-width: 0;
}

.nav-bar-scroll {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
}

.nav-bar-scroll::-webkit-scrollbar {
    display: none;
}

.nav-bar-scroll .nav-tab {
    flex: 1 0 4.25rem;
    min-width: 4.25rem;
    padding-left: 0.1rem;
    padding-right: 0.1rem;
}

.nav-label {
    font-size: 9px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-bar-inner .nav-tab {
    min-width: 0;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
}

.nav-bar-inner .nav-tab span:last-child {
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.inline-icon {
    display: inline-block;
    vertical-align: -0.2em;
    margin-inline-start: 0.15em;
}

.amount-input {
    direction: ltr;
    text-align: left;
}

.status-overdue { border-right: 4px solid #f87171; }
.status-soon { border-right: 4px solid #fbbf24; }
.status-ok { border-right: 4px solid #34d399; }
.status-paid { border-right: 4px solid #64748b; opacity: 0.75; }

.progress-bar {
    height: 8px;
    border-radius: 9999px;
    background: var(--bg-elevated);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #34d399, #059669);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.progress-bar-fill-violet {
    background: linear-gradient(90deg, #a78bfa, #7c3aed);
}

.installment-plan-card {
    padding: 1rem;
}

.unpaid-installment-card {
    background: rgba(69, 10, 10, 0.22);
    border: 1px solid rgba(248, 113, 113, 0.28);
    border-right: 4px solid #f87171;
}

.unpaid-installment-card .list-card-title {
    color: #fecaca;
}

.unpaid-installment-card .list-card-meta {
    color: #fca5a5;
}

.unpaid-installment-pay {
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    color: #fecaca;
    background: rgba(127, 29, 29, 0.45);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 9999px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

.unpaid-installment-pay:active {
    opacity: 0.75;
}

.type-toggle button {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.type-toggle button.active {
    background: var(--accent-muted);
    color: white;
    border-color: var(--accent-muted);
}

.pdp-default {
    z-index: 9999 !important;
}

.card-stat {
    background: var(--bg-surface);
    border-radius: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-subtle);
}

.month-nav-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.month-nav-btn:active {
    background: var(--bg-elevated);
}

.btn-primary {
    background: var(--accent-muted);
    color: white;
    font-weight: 600;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    width: 100%;
    transition: background 0.15s;
}

.btn-primary:hover { background: #047857; }
.btn-primary:disabled { background: #475569; cursor: not-allowed; }

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.btn-danger {
    color: #f87171;
    font-size: 0.875rem;
}

.app-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 1rem;
}

.app-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    outline: none;
}

.app-input::placeholder {
    color: var(--text-muted);
}

.app-input:focus {
    border-color: var(--accent);
}

.alert-warning {
    background: rgba(120, 53, 15, 0.35);
    border: 1px solid rgba(180, 83, 9, 0.5);
    color: #fcd34d;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.empty-state svg {
    color: var(--accent);
    opacity: 0.85;
}

.clickable-card {
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.clickable-card:active .list-card-row {
    background: var(--bg-elevated);
}

.clickable-card:active {
    background: transparent;
}

.section-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.report-stat {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    padding: 0.75rem;
}

.report-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.report-stat-hint {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.report-stat-value {
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1.4;
}

.payment-timeline {
    position: relative;
    padding-right: 1.25rem;
}

.payment-timeline::before {
    content: '';
    position: absolute;
    right: 0.35rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: var(--border-subtle);
}

.payment-part {
    position: relative;
    padding-bottom: 1rem;
}

.payment-part::before {
    content: '';
    position: absolute;
    right: -1.25rem;
    top: 0.4rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-surface);
    transform: translateX(50%);
    margin-right: 0.35rem;
}

.expected-status-pending { border-right: 4px solid #60a5fa; }
.expected-status-overdue { border-right: 4px solid #f87171; }
.expected-status-received { border-right: 4px solid #34d399; opacity: 0.85; }

.hidden-form {
    display: none;
}

.hidden-form.open {
    display: block;
}

.income-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 1rem;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer;
}

.income-action-card:active,
.income-action-card.active {
    background: var(--bg-elevated);
    border-color: var(--accent-muted);
}

.income-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.income-action-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.4;
}

.income-action-card.active .income-action-label {
    color: var(--text-primary);
}

.collapsible-panel {
    display: none;
}

.collapsible-panel.open {
    display: block;
}

.income-list-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    padding: 0.25rem;
}

.income-list-tab {
    flex: 1;
    padding: 0.625rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    transition: background 0.15s, color 0.15s;
}

.income-list-tab.active {
    background: var(--bg-elevated);
    color: var(--accent);
}

.income-list-panel.hidden {
    display: none;
}

.report-list-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
}

.settings-item-name {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.settings-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.settings-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.btn-icon {
    padding: 0.35rem 0.5rem;
    font-size: 0.7rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--text-primary);
}

.btn-icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 0.5rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.btn-icon-action:active {
    background: var(--bg-surface);
}

.btn-icon-danger {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.25);
}

.btn-icon-danger:active {
    background: rgba(248, 113, 113, 0.12);
}

.btn-action-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-action-sm:active {
    background: var(--bg-surface);
}

.list-card {
    padding: 0;
    overflow: hidden;
}

.list-card-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0.625rem 0.75rem 0.875rem;
    min-height: 4rem;
}

.list-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
}

.list-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-card-subline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    min-width: 0;
}

.list-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
}

.list-card-badge-slot {
    display: inline-flex;
    flex-shrink: 0;
}

.list-card-badge-slot .text-xs {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.45rem !important;
    line-height: 1.3;
    white-space: nowrap;
}

.list-card-amount {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    text-align: end;
    max-width: 38%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-card-chevron {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    color: var(--text-muted);
    opacity: 0.35;
    font-size: 1.125rem;
    line-height: 1;
    user-select: none;
}

.list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

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

.list-card-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}

.list-card-meta-highlight {
    color: #34d399;
    opacity: 0.85;
}

.list-card-value {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.3;
}

.list-card-amount-block {
    text-align: end;
    flex-shrink: 0;
}

.list-card-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.list-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px solid var(--border-subtle);
}

.list-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
}

.list-card-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.report-tab-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    margin-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
}

.report-tab-scroll .report-list-tab {
    flex: 0 0 auto;
    min-width: 4.5rem;
}

.loan-card { border-right: 4px solid #f87171; }
.recv-card { border-right: 4px solid #60a5fa; }
.transfer-card { border-right: 4px solid #fbbf24; }

.list-card-delete-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: rgba(248, 113, 113, 0.75);
    cursor: pointer;
}

.list-card-delete-btn:active {
    background: rgba(127, 29, 29, 0.25);
    color: #f87171;
}

.usage-card {
    border-right: 4px solid #a78bfa;
}

.app-input option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.report-list-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.625rem 0.5rem;
    border-radius: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    transition: border-color 0.15s, background 0.15s;
}

.report-list-tab.active {
    background: var(--bg-elevated);
    border-color: var(--accent-muted);
}

.report-list-tab-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

.report-list-tab.active .report-list-tab-label {
    color: var(--accent);
}

.report-list-tab-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.report-list-panel.hidden {
    display: none;
}

input, select, textarea {
    font-size: 16px !important;
}

.pdp-default .pdp-container,
.pdp-default .pdp-header,
.pdp-default .pdp-body,
.pdp-default .pdp-footer {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-subtle) !important;
}

.pdp-default .pdp-day:not(.pdp-disabled):hover,
.pdp-default .pdp-month:not(.pdp-disabled):hover,
.pdp-default .pdp-year:not(.pdp-disabled):hover {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
}

.pdp-default .pdp-selected {
    background: var(--accent-muted) !important;
    color: white !important;
}

.pdp-default .pdp-today {
    color: var(--accent) !important;
}

.pdp-default .pdp-arrow {
    color: var(--text-secondary) !important;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
    display: none;
}

.modal-panel {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    border-radius: 1.25rem 1.25rem 0 0;
    width: 100%;
    max-width: 32rem;
    max-height: 85vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
    animation: sheet-slide-up 0.28s ease-out;
}

.modal-panel::before {
    content: '';
    display: block;
    width: 2.5rem;
    height: 0.25rem;
    background: var(--border);
    border-radius: 9999px;
    margin: 0.75rem auto 0.25rem;
}

@keyframes sheet-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0.6;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 80;
    max-width: calc(100% - 2rem);
    padding: 0.625rem 1rem;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.toast-hidden {
    display: none;
}

.toast.toast-visible {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: toast-slide-up 0.25s ease-out;
}

.toast.toast-fading {
    opacity: 0;
    transform: translateX(-50%) translateY(0.5rem);
}

@keyframes toast-slide-up {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.chart-container {
    height: 200px;
    background: var(--bg-surface);
    border-radius: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-subtle);
}

.collapsible-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.collapsible-body.open {
    max-height: 500px;
    padding-top: 0.5rem;
}

.collapsible-header {
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
}

.add-new-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1.5px dashed rgba(52, 211, 153, 0.35);
    border-radius: 1rem;
    background: rgba(52, 211, 153, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: right;
}

.add-new-card:hover {
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.55);
    color: var(--accent);
}

.add-new-card:active {
    background: rgba(52, 211, 153, 0.12);
    transform: scale(0.99);
}

.add-new-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: rgba(52, 211, 153, 0.12);
    color: var(--accent);
    font-size: 1.375rem;
    font-weight: 300;
    line-height: 1;
    flex-shrink: 0;
}

.add-new-card-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    min-width: 0;
}

.add-new-card-label {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.add-new-card-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.split-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: start;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-subtle);
}

.split-row-field,
.split-row-mode {
    grid-column: 1 / -1;
}

.split-row-remove {
    grid-column: 2;
    grid-row: 1;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.5rem;
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.income-splits-preview {
    line-height: 1.6;
}

/* --- UX overhaul --- */

.nav-bar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
}

.nav-bar-grid .nav-tab {
    min-width: 0;
    padding-left: 0.15rem;
    padding-right: 0.15rem;
}

.nav-label {
    font-size: 11px;
}

.fab-btn {
    position: fixed;
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
    inset-inline-end: 1rem;
    z-index: 45;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-muted));
    color: white;
    font-size: 1.625rem;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(52, 211, 153, 0.35);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.fab-btn:active {
    transform: scale(0.94);
}

.fab-btn.hidden {
    display: none;
}

.more-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
}

.more-sheet-overlay.hidden {
    display: none;
}

.more-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.more-sheet-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    border-radius: 1.25rem 1.25rem 0 0;
    padding: 1rem 1.25rem 1.5rem;
    max-width: 32rem;
    margin: 0 auto;
}

.more-sheet-handle {
    width: 2.5rem;
    height: 0.25rem;
    background: var(--border);
    border-radius: 9999px;
    margin: 0 auto 1rem;
}

.more-sheet-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.more-sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.more-sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 1rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.more-sheet-item:active {
    background: var(--bg-surface);
    border-color: var(--accent-muted);
    color: var(--accent);
}

.more-sheet-icon {
    display: flex;
    line-height: 0;
}

.skeleton-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skeleton-block {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s ease-in-out infinite;
    border-radius: 0.75rem;
}

.skeleton-hero {
    height: 7rem;
}

.skeleton-card {
    height: 4rem;
}

.skeleton-row {
    height: 3.5rem;
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-field-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-secondary {
    padding-top: 0.25rem;
    border-top: 1px solid rgba(51, 65, 85, 0.5);
}

/* Quick-add forms (expense / income) */
.quick-add-card {
    padding: 1rem;
    border-radius: 1rem;
}

.quick-add-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.quick-add-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.quick-add-cancel {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    cursor: pointer;
    line-height: 1.4;
}

.quick-add-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quick-add-form .form-field {
    gap: 0.5rem;
}

.quick-add-form .form-field-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.quick-add-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.quick-add-field-group .form-field {
    margin: 0;
}

.quick-add-balance-hint {
    font-size: 0.75rem;
    line-height: 1.4;
    min-height: 1rem;
    padding-inline-start: 0.125rem;
}

.input-with-suffix {
    position: relative;
    width: 100%;
}

.input-with-suffix .app-input {
    width: 100%;
    padding-right: 1rem;
    padding-left: 4rem;
    text-align: right;
}

.input-with-suffix .input-suffix {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1;
    pointer-events: none;
}

.quick-add-details {
    border-top: 1px solid rgba(51, 65, 85, 0.5);
    padding-top: 0.875rem;
    margin-top: 0.125rem;
}

.quick-add-details-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    margin: 0;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-muted);
    user-select: none;
}

.quick-add-details-check {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--accent-muted);
    cursor: pointer;
}

.quick-add-details-panel {
    margin-top: 0.875rem;
}

.quick-add-details-panel.hidden {
    display: none;
}

.quick-add-details-fields {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.quick-add-details-fields .form-compact-field {
    gap: 0.375rem;
}

.quick-add-details-fields .form-compact-label {
    font-size: 0.75rem;
}

.quick-add-details-fields .app-input-compact {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
}

.quick-add-submit {
    display: block;
    width: 100%;
    margin: 0.25rem 0 0;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(226, 232, 240, 0.35);
    background: transparent;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.4;
    cursor: pointer;
}

.quick-add-submit:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
}

.quick-add-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quick-add-details-panel .split-section {
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px solid rgba(51, 65, 85, 0.4);
}

.quick-add-details-panel .split-section label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
}

.form-compact-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.form-compact-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.form-compact-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.app-input-compact {
    padding: 0.4375rem 0.5rem;
    font-size: 0.8125rem;
}

@media (max-width: 380px) {
    .form-compact-row {
        grid-template-columns: 1fr 1fr;
    }

    .form-compact-row .form-compact-field:last-child {
        grid-column: 1 / -1;
    }
}

.field-error {
    display: block;
    font-size: 0.75rem;
    color: #f87171;
    line-height: 1.3;
}

.field-error.hidden {
    display: none;
}

.app-input.input-error {
    border-color: #f87171;
}

.amount-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-height: 1.125rem;
}

.hero-card {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.12), rgba(30, 41, 59, 0.9));
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: 1.25rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.hero-balance {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.hero-sub {
    font-size: 0.875rem;
    margin-top: 0.35rem;
}

.health-card {
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
}

.health-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
}

.health-card.health-excellent {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.14), rgba(30, 41, 59, 0.95));
    border-color: rgba(52, 211, 153, 0.35);
}

.health-card.health-excellent::before { background: #34d399; }

.health-card.health-good {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.14), rgba(30, 41, 59, 0.95));
    border-color: rgba(96, 165, 250, 0.35);
}

.health-card.health-good::before { background: #60a5fa; }

.health-card.health-warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.14), rgba(30, 41, 59, 0.95));
    border-color: rgba(251, 191, 36, 0.35);
}

.health-card.health-warning::before { background: #fbbf24; }

.health-card.health-bad {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.14), rgba(30, 41, 59, 0.95));
    border-color: rgba(248, 113, 113, 0.35);
}

.health-card.health-bad::before { background: #f87171; }

.health-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.health-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.health-card.health-excellent .health-badge {
    background: rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
}

.health-card.health-good .health-badge {
    background: rgba(96, 165, 250, 0.2);
    color: #93c5fd;
}

.health-card.health-warning .health-badge {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
}

.health-card.health-bad .health-badge {
    background: rgba(248, 113, 113, 0.2);
    color: #fca5a5;
}

.health-savings {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.health-title {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    line-height: 1.35;
}

.health-message {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.health-tip {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.dashboard-charts {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 1rem;
    padding: 1rem;
}

.chart-container-sm {
    height: 160px;
}

.month-selector-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: inherit;
}

.month-selector-center:hover {
    background: rgba(255, 255, 255, 0.04);
}

.month-current-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(52, 211, 153, 0.12);
    padding: 0.1rem 0.45rem;
    border-radius: 9999px;
}

.upcoming-date-tag {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
}

.income-highlight {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.feature-hint {
    padding: 0.75rem 0.875rem;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: 0.75rem;
    font-size: 0.75rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.feature-hint strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.8125rem;
    margin-bottom: 0.35rem;
}

.wallet-budget-card {
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
}

.wallet-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.onboarding-overlay.hidden {
    display: none;
}

.splash-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    padding-top: calc(1.5rem + env(safe-area-inset-top));
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    background: radial-gradient(circle at 50% 30%, rgba(5, 150, 105, 0.18), transparent 55%), var(--bg-base);
    opacity: 1;
    transition: opacity 0.45s ease;
}

.splash-overlay.hidden {
    display: none;
}

.splash-overlay.splash-out {
    opacity: 0;
    pointer-events: none;
}

body.splash-active {
    overflow: hidden;
}

.splash-inner {
    width: 100%;
    max-width: 18rem;
    text-align: center;
    animation: splash-rise 0.65s ease-out both;
}

.splash-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 6.5rem;
    height: 6.5rem;
    margin: 0 auto 1.25rem;
    border-radius: 1.75rem;
    background: rgba(5, 150, 105, 0.12);
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.15), 0 20px 40px rgba(0, 0, 0, 0.35);
    animation: splash-pulse 1.8s ease-in-out infinite;
}

.splash-icon {
    display: block;
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 1.35rem;
}

.splash-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.splash-greeting {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 1.75rem;
    min-height: 1.5rem;
}

.splash-bar {
    width: 5rem;
    height: 0.2rem;
    margin: 0 auto;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    overflow: hidden;
}

.splash-bar-fill {
    display: block;
    width: 40%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-muted), var(--accent));
    animation: splash-bar 1.2s ease-in-out infinite;
}

@keyframes splash-rise {
    from {
        opacity: 0;
        transform: translateY(1.25rem) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes splash-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes splash-bar {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.onboarding-card {
    width: 100%;
    max-width: 24rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 1.25rem;
    padding: 1.5rem;
}

.onboarding-steps {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
}

.onboarding-step-dot {
    flex: 1;
    height: 0.25rem;
    border-radius: 9999px;
    background: var(--bg-elevated);
}

.onboarding-step-dot.active {
    background: var(--accent);
}

.onboarding-step-dot.done {
    background: var(--accent-muted);
}

.confirm-dialog-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.confirm-dialog-actions .btn-primary,
.confirm-dialog-actions .btn-secondary {
    flex: 1;
    width: auto;
}

.btn-danger-solid {
    background: #dc2626;
    color: white;
    font-weight: 600;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    width: 100%;
    border: none;
    cursor: pointer;
}

.btn-danger-solid:hover {
    background: #b91c1c;
}

#header-back-btn .header-icon svg {
    width: 22px;
    height: 22px;
}

/* Detail page */
.detail-hero {
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

.detail-hero-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.detail-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.detail-hero-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

.detail-hero-amount {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.detail-meta-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.detail-meta-item:nth-child(odd) {
    border-inline-start: 1px solid rgba(51, 65, 85, 0.5);
}

.detail-meta-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.detail-meta-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.detail-section {
    margin-bottom: 0.75rem;
}

.detail-section.app-card {
    padding: 1rem;
}

.detail-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.detail-section-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.detail-edit-form .form-field {
    margin-bottom: 0;
}

.detail-edit-form .detail-note-input {
    min-height: 4.5rem;
}

.detail-note-input {
    resize: vertical;
    min-height: 4.5rem;
    line-height: 1.5;
}

.detail-splits-list {
    margin-top: 0.5rem;
}

.detail-split-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

.btn-danger-outline {
    background: transparent;
    color: #f87171;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    width: 100%;
    border: 1px solid rgba(248, 113, 113, 0.35);
    cursor: pointer;
}

.btn-danger-outline:hover {
    background: rgba(248, 113, 113, 0.08);
}

/* Dashboard UX */
.dashboard-section-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.dash-alert {
    border-radius: 0.875rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.625rem;
    border: 1px solid transparent;
}

.dash-alert-warning {
    background: rgba(120, 53, 15, 0.35);
    border-color: rgba(180, 83, 9, 0.45);
}

.dash-alert-info {
    background: rgba(30, 58, 138, 0.25);
    border-color: rgba(59, 130, 246, 0.35);
}

.dash-alert-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #fcd34d;
    margin-bottom: 0.25rem;
}

.dash-alert-info .dash-alert-title {
    color: #93c5fd;
}

.dash-alert-body {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.dash-alert-action {
    margin-top: 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fcd34d;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dash-alert-info .dash-alert-action {
    color: #93c5fd;
}

.dash-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 9999px;
    line-height: 1.3;
    white-space: nowrap;
    vertical-align: middle;
}

.dash-type-income {
    background: rgba(6, 78, 59, 0.5);
    color: #34d399;
    border: 1px solid rgba(6, 95, 70, 0.6);
}

.dash-type-expense {
    background: rgba(69, 10, 10, 0.35);
    color: #fca5a5;
    border: 1px solid rgba(127, 29, 29, 0.5);
}

.dash-type-due {
    background: rgba(120, 53, 15, 0.45);
    color: #fbbf24;
    border: 1px solid rgba(180, 83, 9, 0.5);
}

.list-card-subline .dash-type-badge {
    margin-inline-end: 0.1rem;
}

.dash-activity-card .list-card-row {
    min-height: 3rem;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    gap: 0.5rem;
}

.dash-activity-card .list-card-content {
    gap: 0.15rem;
}

.dash-activity-card .list-card-title {
    font-size: 0.8125rem;
    font-weight: 500;
}

.dash-activity-card .list-card-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
    opacity: 0.75;
}

.dash-activity-card .list-card-subline {
    gap: 0;
}

.dash-activity-card .list-card-amount {
    font-size: 0.8125rem;
}

.dash-activity-card .list-card-chevron {
    font-size: 1rem;
    opacity: 0.25;
}

.dash-view-all-btn {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: center;
}

.dash-view-all-btn:active {
    opacity: 0.7;
}

.calendar-date-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
    margin-bottom: 0.625rem;
}

.calendar-date-field .form-compact-label {
    font-size: 0.75rem;
}

.cal-date-segments {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 0.375rem;
    width: 100%;
}

.cal-date-seg {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1875rem;
    min-width: 0;
}

.cal-date-seg-label {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    line-height: 1;
}

.form-field .calendar-date-field,
.form-compact-field .calendar-date-field {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .cal-date-spinner {
        height: 2.75rem;
    }

    .cal-spin-btn {
        width: 2.25rem;
    }
}

.cal-date-spinner {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 0.625rem;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 2.375rem;
    overflow: hidden;
    user-select: none;
}

.cal-date-spinner:focus-within {
    border-color: var(--accent);
}

.cal-spin-btn {
    flex-shrink: 0;
    width: 1.625rem;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, color 0.1s;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
}

.cal-spin-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    pointer-events: none;
}

.cal-spin-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.cal-spin-btn:active {
    background: var(--border-subtle);
    color: var(--accent);
}

.cal-spin-display-btn {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0 0.125rem;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
}

.cal-spin-display-btn span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-spin-display-btn--month {
    font-size: 0.75rem;
    font-weight: 500;
}

.cal-spin-display-btn.is-open {
    color: var(--accent);
}

.cal-spin-display-btn:active {
    color: var(--accent);
}

.cal-date-list-host {
    margin-top: 0.375rem;
}

.cal-date-list-host[hidden] {
    display: none !important;
}

.cal-date-list-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3125rem;
    max-height: 9rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.375rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 0.625rem;
}

.cal-date-list-panel--months {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
}

.cal-date-list-panel--days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
}

.cal-date-list-panel--years {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cal-date-list-item {
    margin: 0;
    padding: 0.4375rem 0.3125rem;
    border: 1px solid var(--border-subtle);
    border-radius: 0.4375rem;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
}

.cal-date-list-panel--days .cal-date-list-item {
    padding: 0.4375rem 0;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-date-list-panel--months .cal-date-list-item {
    font-size: 0.6875rem;
    padding: 0.5rem 0.25rem;
}

.cal-date-list-item.active {
    border-color: var(--accent);
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent);
    font-weight: 700;
}

.cal-date-list-item:active {
    background: var(--border-subtle);
}

.cal-date-summary {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.375rem;
    min-height: 1.125rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0 0.125rem;
    overflow: hidden;
}

.cal-date-summary-value {
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-date-summary-rel {
    color: var(--accent);
    flex-shrink: 0;
    white-space: nowrap;
}

.calendar-events {
    min-height: 10rem;
    max-height: min(40vh, 18rem);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.15s ease;
}

.calendar-events.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

.calendar-events-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

