        :root {
            --bg-1: #fff7f2;
            --bg-2: #f0f6ff;
            --ink: #111827;
            --muted: #6b7280;
            --card: rgba(255, 255, 255, 0.9);
            --stroke: rgba(15, 23, 42, 0.09);
            --brand: #e86820;
            --brand-dark: #c05010;
            --income: #208070;
            --expense: #b91c1c;
            --shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
            --radius: 22px;
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            font-family: 'Manrope', sans-serif;
            color: var(--ink);
            background:
                radial-gradient(circle at 8% 8%, #fde5cc 0 24%, transparent 42%),
                radial-gradient(circle at 94% 20%, #d6e8f8 0 22%, transparent 44%),
                linear-gradient(140deg, var(--bg-1), var(--bg-2));
            min-height: 100vh;
            padding: 18px 14px 34px;
        }

        .app {
            max-width: 980px;
            margin: 0 auto;
            animation: rise 420ms ease-out;
        }

        .header {
            background: linear-gradient(140deg, #306080, #1e4a66);
            color: #fff;
            border-radius: var(--radius);
            padding: 18px;
            box-shadow: var(--shadow);
            position: relative;
            overflow: hidden;
        }

        .header::after {
            content: '';
            position: absolute;
            width: 180px;
            height: 180px;
            right: -40px;
            top: -70px;
            border-radius: 999px;
            background: radial-gradient(circle, rgba(232, 104, 32, 0.45), transparent 70%);
        }

        .header-top {
            display: flex;
            align-items: center;
            gap: 14px;
        }

        .header-brand {
            display: inline-flex;
            align-items: center;
            gap: 14px;
        }

        .header-top img.app-logo {
            flex-shrink: 0;
            width: 62px;
            height: 62px;
            border-radius: 16px;
            object-fit: cover;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        }

        .header h1 {
            margin: 0;
            font-family: 'Sora', sans-serif;
            font-weight: 800;
            font-size: 1.5rem;
            letter-spacing: -0.03em;
        }

        .header p {
            margin: 8px 0 0;
            color: rgba(255, 255, 255, 0.82);
            font-size: 0.93rem;
        }

        .header-visibility-btn {
            margin-left: auto;
            width: 44px;
            height: 44px;
            border-radius: 14px;
            border: none;
            background: rgba(255, 255, 255, 0.2);
            color: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            position: relative;
            z-index: 1;
        }

        .header-visibility-btn .material-icons-round {
            font-size: 1.35rem;
        }

        .stats {
            margin-top: 14px;
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 10px;
        }

        .stat {
            background: rgba(255, 255, 255, 0.12);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 16px;
            padding: 10px;
            backdrop-filter: blur(6px);
        }

        .stat .label {
            font-size: 0.75rem;
            opacity: 0.82;
        }

        .stat .value {
            margin-top: 4px;
            font-weight: 700;
            font-size: 0.98rem;
        }

        .layout {
            margin-top: 14px;
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
        }

        .card {
            border: 1px solid var(--stroke);
            border-radius: var(--radius);
            background: var(--card);
            backdrop-filter: blur(8px);
            box-shadow: var(--shadow);
            padding: 16px;
        }

        .card-title {
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0 0 12px;
            font-family: 'Sora', sans-serif;
            font-weight: 700;
            font-size: 1.02rem;
        }

        .filter-title-row {
            justify-content: space-between;
            gap: 10px;
        }

        .card-title-main {
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .badge-warning {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 4px 10px;
            border-radius: 999px;
            border: 1px solid #fcd34d;
            background: #fef3c7;
            color: #92400e;
            font-size: 0.74rem;
            font-weight: 800;
            letter-spacing: 0.01em;
            white-space: nowrap;
        }

        .material-icons-round {
            font-family: 'Material Icons';
            font-weight: normal;
            font-style: normal;
            line-height: 1;
            letter-spacing: normal;
            text-transform: none;
            display: inline-block;
            white-space: nowrap;
            direction: ltr;
            -webkit-font-smoothing: antialiased;
            text-rendering: optimizeLegibility;
            -moz-osx-font-smoothing: grayscale;
            font-feature-settings: 'liga';
            font-size: 1.2rem;
        }

        .filter-row {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .arrow-btn {
            width: 42px;
            height: 42px;
            border: 1px solid #cbd5e1;
            border-radius: 12px;
            background: #fff;
            color: #0f172a;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex-shrink: 0;
        }

        .month-input {
            flex: 1;
            width: 100%;
            border: 1px solid #d1d5db;
            border-radius: 12px;
            background: #fff;
            font: inherit;
            padding: 11px 12px;
            color: #111827;
            min-height: 42px;
            cursor: pointer;
        }

        .month-input::placeholder {
            color: #94a3b8;
        }

        .flatpickr-calendar {
            border-radius: 14px;
            box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
            border: 1px solid #e2e8f0;
        }

        .month-input:focus,
        input:focus,
        select:focus {
            outline: 2px solid rgba(232, 104, 32, 0.22);
            border-color: var(--brand);
        }

        .actions-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .primary-btn,
        .secondary-btn {
            border-radius: 14px;
            padding: 12px 14px;
            font: inherit;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            cursor: pointer;
        }

        .primary-btn {
            border: none;
            color: #fff;
            background: linear-gradient(135deg, #1a9e6e, #14784f);
        }

        .secondary-btn {
            border: none;
            color: #fff;
            background: linear-gradient(135deg, #e86820, #c05010);
        }

        .flash {
            margin-top: 12px;
            border: 1px solid #fcd3a8;
            background: #fff7f0;
            color: #c05010;
            border-radius: 12px;
            padding: 10px 12px;
            font-size: 0.88rem;
        }

        .errors {
            margin-top: 12px;
            border: 1px solid #fecaca;
            background: #fef2f2;
            color: #b91c1c;
            border-radius: 12px;
            padding: 10px 12px;
            font-size: 0.86rem;
        }

        .errors ul {
            margin: 0;
            padding-left: 18px;
        }

        .list {
            display: grid;
            gap: 10px;
        }

        .tabs {
            display: inline-flex;
            gap: 8px;
            margin-bottom: 12px;
            background: #f1f5f9;
            padding: 4px;
            border-radius: 12px;
        }

        .tab-btn {
            border: none;
            border-radius: 10px;
            padding: 8px 12px;
            font: inherit;
            font-weight: 700;
            background: transparent;
            color: #475569;
            cursor: pointer;
        }

        .tab-btn.active {
            background: #fff;
            color: #0f172a;
            box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
        }

        .tab-panel {
            display: none;
        }

        .tab-panel.active {
            display: block;
        }

        .chart-wrap {
            height: 280px;
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            background: #fff;
            padding: 14px;
        }

        .chart-summary {
            margin-top: 10px;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        .chart-pill {
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            background: #fff;
            padding: 8px 10px;
            font-size: 0.86rem;
            font-weight: 700;
        }

        .chart-pill.income {
            color: #15803d;
            border-color: #bbf7d0;
        }

        .chart-pill.expense {
            color: #b91c1c;
            border-color: #fecaca;
        }

        .item {
            border: 1px solid #e5e7eb;
            border-radius: 14px;
            background: #fff;
            padding: 10px;
            display: grid;
            gap: 9px;
            cursor: pointer;
            transition: border-color 0.2s ease;
        }

        .item:hover {
            border-color: #94a3b8;
        }

        .item.item-overdue {
            border-color: #fca5a5;
            background: #fff5f5;
        }

        .item.item-overdue:hover {
            border-color: #ef4444;
        }

        .item-top {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 8px;
            align-items: center;
        }

        .item strong {
            font-size: 0.93rem;
        }

        .item small {
            display: block;
            color: var(--muted);
            margin-top: 2px;
            font-size: 0.76rem;
        }

        .item-meta {
            display: grid;
            gap: 6px;
        }

        .item-status-badges {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .amount {
            font-weight: 800;
            font-family: 'Sora', sans-serif;
            font-size: 0.9rem;
        }

        .income {
            color: var(--income);
        }

        .expense {
            color: var(--expense);
        }

        .item-actions {
            display: none;
            gap: 8px;
            justify-content: flex-end;
        }

        .item.open .item-actions {
            display: flex;
        }

        .icon-btn {
            width: 38px;
            height: 38px;
            border-radius: 11px;
            border: 1px solid #d1d5db;
            background: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: #0f172a;
            padding: 0;
        }

        .field-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .field-head label {
            margin: 0;
        }

        .category-input-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 8px;
            align-items: center;
        }

        .icon-btn.inline-action {
            width: 42px;
            height: 42px;
            border-radius: 12px;
            border-color: #fed7aa;
            background: linear-gradient(135deg, #fb923c, #ea580c);
            color: #fff;
            box-shadow: 0 10px 18px rgba(234, 88, 12, 0.18);
        }

        .icon-btn.inline-action:hover {
            filter: brightness(1.03);
        }

        .icon-btn.inline-action .material-icons-round {
            font-size: 1.05rem;
        }

        .icon-btn.danger {
            color: #b91c1c;
            border-color: #fecaca;
            background: #fff5f5;
        }

        .category-manager {
            margin-top: 16px;
            padding-top: 14px;
            border-top: 1px solid #e2e8f0;
            display: grid;
            gap: 10px;
        }

        .category-manager-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .category-manager-head strong {
            font-size: 0.85rem;
        }

        .category-help {
            margin: 0;
            font-size: 0.78rem;
            color: #64748b;
        }

        .category-list {
            display: grid;
            gap: 8px;
            max-height: 220px;
            overflow: auto;
        }

        .category-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            gap: 8px;
            align-items: center;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            background: #fff;
            padding: 10px 12px;
        }

        .category-row-main {
            display: grid;
            gap: 3px;
            min-width: 0;
        }

        .category-row-title {
            font-size: 0.9rem;
            font-weight: 700;
            color: #0f172a;
        }

        .category-row-meta {
            font-size: 0.76rem;
            color: #64748b;
        }

        .category-transfer {
            display: none;
            gap: 8px;
            padding: 12px;
            border-radius: 12px;
            border: 1px solid #fed7aa;
            background: #fff7ed;
        }

        .category-transfer.open {
            display: grid;
        }

        .category-transfer p {
            margin: 0;
            font-size: 0.8rem;
            color: #9a3412;
        }

        .category-transfer-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        .section-title-row {
            margin: 0 0 10px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .section-title-main {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .section-title-row h3 {
            margin: 0;
            font-size: .92rem;
        }

        .inline-add-btn {
            width: 30px;
            height: 30px;
            border-radius: 10px;
        }

        .inline-add-btn .material-icons-round {
            font-size: 1rem;
        }

        .inline-add-btn.income-add {
            border-color: #86efac;
            background: #ecfdf5;
            color: #047857;
        }

        .inline-add-btn.expense-add {
            border-color: #fda4af;
            background: #fff1f2;
            color: #be123c;
        }

        .icon-btn.success {
            color: #166534;
            border-color: #bbf7d0;
            background: #f0fdf4;
        }

        .paid-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 2px 8px;
            border-radius: 999px;
            background: #dcfce7;
            color: #166534;
            border: 1px solid #bbf7d0;
            font-size: 0.7rem;
            font-weight: 700;
            vertical-align: middle;
            appearance: none;
            cursor: pointer;
            font-family: inherit;
        }

        .overdue-badge {
            display: inline-flex;
            align-items: center;
            padding: 2px 8px;
            border-radius: 999px;
            background: #fee2e2;
            color: #991b1b;
            border: 1px solid #fca5a5;
            font-size: 0.7rem;
            font-weight: 700;
            vertical-align: middle;
        }

        .paid-badge .material-icons-round {
            font-size: 0.9rem;
        }

        .recurrence-icon {
            font-size: 0.95rem;
            color: #0f766e;
            vertical-align: middle;
            margin-left: 4px;
        }

        .paid-percent-badge {
            margin-left: auto;
            display: inline-flex;
            align-items: center;
            padding: 3px 10px;
            border-radius: 999px;
            border: 1px solid #bbf7d0;
            background: #f0fdf4;
            color: #166534;
            font-size: 0.74rem;
            font-weight: 700;
        }

        .empty {
            border: 1px dashed #d1d5db;
            border-radius: 12px;
            padding: 14px;
            text-align: center;
            color: var(--muted);
            font-size: 0.88rem;
        }

        .modal-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(2, 6, 23, 0.56);
            padding: 18px 14px;
            z-index: 40;
            align-items: center;
            justify-content: center;
        }

        .modal-backdrop.open {
            display: flex;
        }

        .modal {
            width: 100%;
            max-width: 480px;
            max-height: 92vh;
            overflow: auto;
            background: #fff;
            border-radius: 18px;
            border: 1px solid #e2e8f0;
            box-shadow: var(--shadow);
            padding: 16px;
        }

        .modal-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
        }

        .modal-head h3 {
            margin: 0;
            font-family: 'Sora', sans-serif;
            font-size: 1rem;
        }

        form {
            display: grid;
            gap: 10px;
        }

        .field {
            display: grid;
            gap: 6px;
        }

        label {
            font-size: 0.83rem;
            font-weight: 700;
            color: #1f2937;
        }

        input,
        select {
            width: 100%;
            border: 1px solid #d1d5db;
            border-radius: 12px;
            background: #fff;
            font: inherit;
            padding: 11px 12px;
            color: #111827;
        }

        .row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.88rem;
            color: #334155;
        }

        .toggle input {
            width: 17px;
            height: 17px;
            accent-color: var(--brand);
        }

        @media (min-width: 920px) {
            body {
                padding: 26px;
            }

            .layout {
                grid-template-columns: 1fr 1fr;
            }

            .card-wide {
                grid-column: span 2;
            }
        }

        @keyframes rise {
            from {
                opacity: 0;
                transform: translateY(10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
