/* Celengan Ayam — Light theme, sidebar layout */

:root {
    /* Violet palette (primary #6b4bc9) */
    --purple-900: #1e1540;
    --purple-800: #2a1f5e;
    --purple-700: #3d2d87;
    --purple-600: #5a3eb0;
    --purple-500: #6b4bc9;
    --purple-400: #8a6fd9;
    --purple-300: #b199e3;
    --purple-200: #d1c2ef;
    --purple-100: #e7e1f7;
    --purple-50: #f4f0fb;

    /* Indigo accent (sparing: links, info, transfer/savings semantics) */
    --indigo-700: #1e3a8a;
    --indigo-600: #3958b8;
    --indigo-500: #4b74c9;
    --indigo-400: #7a9bd9;
    --indigo-300: #b3c7ec;
    --indigo-100: #dde6f6;
    --indigo-50: #eef3fb;

    /* Legacy aliases */
    --pink-500: var(--indigo-500);
    --pink-400: var(--indigo-400);
    --pink-300: var(--indigo-300);

    /* Semantic */
    --green-600: #16a34a;
    --green-700: #15803d;
    --red-600: #dc2626;
    --red-700: #b91c1c;

    /* Warm stone neutrals + cream surfaces */
    --stone-900: #1c1917;
    --stone-700: #44403c;
    --stone-500: #78716c;
    --stone-300: #d6d3d1;
    --stone-200: #e7e5e4;

    --bg-body: #faf7f2;
    --bg-card: #fefdfb;
    --bg-card-header: #fefdfb;
    --bg-input: #ffffff;
    --bg-table-head: #f5f1ea;
    --bg-hover: var(--purple-50);

    --text-primary: var(--stone-900);
    --text-secondary: var(--stone-700);
    --text-muted: var(--stone-500);

    --border-color: var(--stone-200);
    --border-card: var(--stone-200);
    --border-subtle: rgba(0, 0, 0, 0.06);

    /* Dia-soft shadows */
    --shadow-card:
        0 1px 2px rgba(28, 25, 23, 0.04),
        0 8px 24px rgba(28, 25, 23, 0.06);
    --shadow-hover:
        0 2px 4px rgba(28, 25, 23, 0.05),
        0 12px 32px rgba(28, 25, 23, 0.08);

    /* Radii (macOS-ish) */
    --radius-card: 10px;
    --radius-btn: 8px;
    --radius-modal: 12px;
    --radius-chip: 6px;

    --btn-primary-bg: var(--purple-500);
    --btn-primary-hover: var(--purple-600);
    --focus-ring: rgba(107, 75, 201, 0.2);

    --sidebar-width: 240px;
    --sidebar-width-collapsed: 64px;
    --sidebar-gradient: linear-gradient(
        180deg,
        rgba(30, 21, 64, 0.72) 0%,
        rgba(61, 45, 135, 0.7) 50%,
        rgba(107, 75, 201, 0.68) 100%
    );
    --sidebar-text: rgba(255, 255, 255, 0.78);
    --sidebar-text-active: #ffffff;

    /* Frost recipe (light pages) */
    --frost-bg: rgba(255, 255, 255, 0.72);
    --frost-border: 1px solid rgba(255, 255, 255, 0.6);
    --frost-blur: blur(20px) saturate(180%);
}

/* ── Base ── */
* {
    font-family:
        "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
        sans-serif;
}

body {
    min-height: 100vh;
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-weight: 400;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--indigo-600);
    text-decoration: none;
}
a:hover {
    color: var(--indigo-700);
    text-decoration: underline;
}

/* Dashboard-only: violet gradient canvas (origin bottom-left → top-right) */
body:has(#content[data-sidebar-mode="dashboard"]) {
    background: linear-gradient(
        35deg,
        #8a6fd9 0%,
        #6b4bc9 18%,
        #3d2d87 42%,
        #1e1540 72%,
        #0d0820 100%
    );
    background-attachment: fixed;
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"]) .hero-title {
    color: #ffffff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

body:has(#content[data-sidebar-mode="dashboard"]) .hero-subtitle,
body:has(#content[data-sidebar-mode="dashboard"]) .manual-toggle {
    color: rgba(255, 255, 255, 0.75) !important;
}

body:has(#content[data-sidebar-mode="dashboard"]) .stats-strip-label {
    color: rgba(255, 255, 255, 0.6);
}

body:has(#content[data-sidebar-mode="dashboard"]) .stats-strip-sep {
    background-color: rgba(255, 255, 255, 0.18);
}

body:has(#content[data-sidebar-mode="dashboard"])
    .stats-strip-value.amount-positive {
    color: #6ee7a7;
}

/* Dashboard amount colors - white for readability */
body:has(#content[data-sidebar-mode="dashboard"]) .card .amount-positive,
body:has(#content[data-sidebar-mode="dashboard"]) .card .amount-negative,
body:has(#content[data-sidebar-mode="dashboard"]) .table .amount-positive,
body:has(#content[data-sidebar-mode="dashboard"]) .table .amount-negative {
    color: #fff !important;
}

body:has(#content[data-sidebar-mode="dashboard"])
    .stats-strip-value.amount-negative {
    color: #fca5a5;
}

body:has(#content[data-sidebar-mode="dashboard"]) .btn-ghost-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body:has(#content[data-sidebar-mode="dashboard"]) .btn-ghost-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"]) .recent-table-wrap {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

body:has(#content[data-sidebar-mode="dashboard"]) .recent-table-wrap .table,
body:has(#content[data-sidebar-mode="dashboard"]) .recent-table-wrap .table td,
body:has(#content[data-sidebar-mode="dashboard"])
    .recent-table-wrap
    .recent-table-header {
    color: rgba(255, 255, 255, 0.92);
}

body:has(#content[data-sidebar-mode="dashboard"])
    .recent-table-wrap
    .table
    thead
    th {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border-bottom-color: rgba(255, 255, 255, 0.18);
}

body:has(#content[data-sidebar-mode="dashboard"])
    .recent-table-wrap
    .text-secondary {
    color: rgba(255, 255, 255, 0.7) !important;
}

body:has(#content[data-sidebar-mode="dashboard"])
    .recent-table-wrap
    .btn-outline-secondary {
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.3);
}

body:has(#content[data-sidebar-mode="dashboard"])
    .recent-table-wrap
    .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"])
    .recent-table-wrap
    .table-hover
    tbody
    tr:hover {
    background: rgba(0, 0, 0, 0.5) !important;
}

body:has(#content[data-sidebar-mode="dashboard"]) .catchup-banner {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

body:has(#content[data-sidebar-mode="dashboard"]) .catchup-banner i {
    color: var(--purple-200);
}

body:has(#content[data-sidebar-mode="dashboard"]) .hero-input {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1) !important;
    position: relative;
}

body:has(#content[data-sidebar-mode="dashboard"]) .hero-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* General placeholder styling */
.hero-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

body:has(#content[data-sidebar-mode="dashboard"]) .hero-input:focus {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow:
        0 4px 28px rgba(0, 0, 0, 0.14),
        0 0 0 0.2rem rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

/* Minimalist arrow button on dashboard */
body:has(#content[data-sidebar-mode="dashboard"]) .hero-btn {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
}

body:has(#content[data-sidebar-mode="dashboard"]) .hero-btn:hover,
body:has(#content[data-sidebar-mode="dashboard"]) .hero-btn:focus {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width-collapsed);
    height: 100vh;
    background: transparent;
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.5rem 1rem;
    z-index: 1030;
    box-shadow: 2px 0 18px rgba(26, 10, 46, 0.1);
    overflow: hidden;
    transition:
        width 0.2s ease,
        padding 0.2s ease,
        box-shadow 0.2s ease;
    outline: none;
}

.sidebar:hover,
.sidebar:focus,
.sidebar:focus-within {
    width: var(--sidebar-width);
    padding: 1.25rem 0.75rem 1rem;
}

/* ── Sidebar light variant (non-dashboard pages) ── */
.sidebar.sidebar-light {
    background: transparent;
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
    border-right: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: none;
    color: var(--purple-700);
}

.sidebar.sidebar-light:hover,
.sidebar.sidebar-light:focus,
.sidebar.sidebar-light:focus-within {
    box-shadow: 2px 0 14px rgba(26, 10, 46, 0.08);
}

.sidebar.sidebar-light .sidebar-brand {
    border-bottom-color: var(--border-color);
}

.sidebar.sidebar-light .sidebar-brand a,
.sidebar.sidebar-light .sidebar-brand-icon {
    color: var(--purple-700);
}

.sidebar.sidebar-light .sidebar-link {
    color: var(--purple-700);
}

.sidebar.sidebar-light .sidebar-link i {
    color: var(--purple-700);
    opacity: 1;
}

.sidebar.sidebar-light .sidebar-link:hover {
    background-color: var(--purple-50);
    color: var(--purple-800);
}

.sidebar.sidebar-light .sidebar-link.active {
    background-color: var(--purple-100);
    color: var(--purple-900);
}

.sidebar.sidebar-light .sidebar-footer {
    border-top-color: var(--border-color);
}

.sidebar.sidebar-light .sidebar-user {
    color: var(--text-muted);
}

.sidebar-brand {
    padding: 0.25rem 0.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 1rem;
}

.sidebar-brand a {
    color: #ffffff;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

.sidebar-brand-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.sidebar-label {
    opacity: 0;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.sidebar:hover .sidebar-label,
.sidebar:focus .sidebar-label,
.sidebar:focus-within .sidebar-label {
    opacity: 1;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 400;
    white-space: nowrap;
    transition:
        background-color 0.15s,
        color 0.15s;
}

.sidebar-link i {
    font-size: 1.15rem;
    opacity: 0.9;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.sidebar-link:hover {
    color: var(--sidebar-text-active);
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active {
    color: var(--sidebar-text-active);
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 500;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.sidebar-user {
    padding: 0.25rem 0.85rem 0.5rem;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Mobile sidebar */
.sidebar-toggle {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1050;
    background-color: var(--purple-500);
    color: #fff;
    border: none;
    border-radius: var(--radius-btn);
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    visibility: visible;
    opacity: 1;
}
@media (max-width: 991.98px) {
    body.sidebar-open #sidebarToggle {
        display: none !important;
    }
}
@media (min-width: 992px) {
    .sidebar-toggle {
        display: none !important;
    }
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1025;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 992px) {
    .sidebar:not(.sidebar-light) {
        background: var(--sidebar-gradient);
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        width: var(--sidebar-width);
        padding: 1.25rem 0.75rem 1rem;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        overflow-y: auto;
    }
    .sidebar.sidebar-light {
        background: var(--frost-bg);
    }
    .sidebar .sidebar-label {
        opacity: 1;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    /* Disable hover-expand on touch */
    .sidebar:hover {
        width: var(--sidebar-width);
    }
}

/* ── Main ── */
.app-main {
    margin-left: var(--sidebar-width-collapsed);
    min-height: 100vh;
}

.app-main-auth {
    margin-left: 0;
}

@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
        padding-top: 3rem;
    }
}

/* ── Cards ── */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    opacity: 0.8;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 500;
    font-size: 0.9rem;
}

.stat-card {
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.stat-card .stat-value {
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}
.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 400;
}

/* Mobile: smaller stat values */
@media (max-width: 767px) {
    .stat-card .stat-value {
        font-size: 1rem;
    }
    .stat-card .stat-label {
        font-size: 0.65rem;
    }
}

/* ── Forms ── */
.form-control,
.form-select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-btn);
    color: var(--text-primary);
    font-weight: 400;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--purple-400);
    box-shadow: 0 0 0 0.2rem var(--focus-ring);
}

.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* ── Buttons ── */
.btn {
    border-radius: var(--radius-btn);
    font-weight: 500;
    letter-spacing: -0.005em;
}

.btn-primary {
    background-color: var(--btn-primary-bg);
    border-color: var(--btn-primary-bg);
    color: #fff;
}

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

.btn-primary:focus,
.btn-primary:active {
    background-color: var(--purple-700);
    border-color: var(--purple-700);
    box-shadow: 0 0 0 0.2rem var(--focus-ring);
}

.btn-outline-primary {
    color: var(--purple-600);
    border-color: var(--purple-500);
}

.btn-outline-primary:hover {
    background-color: var(--purple-500);
    color: #fff;
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

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

.btn-success {
    background-color: var(--green-600);
    border-color: var(--green-600);
}

.btn-purple {
    background-color: var(--purple-500);
    border-color: var(--purple-500);
    color: #fff;
}
.btn-purple:hover {
    background-color: var(--purple-600);
    border-color: var(--purple-600);
    color: #fff;
}

/* ── Tables ── */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-hover-bg: var(--bg-hover);
}

.table-transactions {
    font-size: 0.88rem;
    min-width: 520px;
    white-space: nowrap;
}
.table-hover tbody tr:hover {
    background-color: var(--bg-hover);
}

/* Dashboard transaction table - dark hover */
body:has(#content[data-sidebar-mode="dashboard"]) .table-transactions {
    --bs-table-hover-bg: rgba(33, 37, 41, 0.1);
}

.table thead th {
    background-color: var(--bg-table-head);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    border-bottom-color: var(--border-color);
}

/* ── Badges ── */
.badge-income {
    background-color: var(--green-600);
    color: #fff;
}
.badge-expense {
    background-color: var(--red-600);
    color: #fff;
}
.badge-transfer {
    background-color: var(--indigo-500);
    color: #fff;
}
.badge-savings {
    background-color: var(--indigo-600);
    color: #fff;
}
.badge-assets {
    background-color: var(--purple-400);
    color: #fff;
}

/* ── Amount Colors ── */
.table .amount-positive,
.amount-positive {
    color: #16a34a !important;
    font-weight: 600;
}
.table .amount-negative,
.amount-negative {
    color: #dc2626 !important;
    font-weight: 600;
}

/* ── Auth ── */
body.auth-page,
.auth-page body {
    min-height: 100vh;
    background: linear-gradient(135deg, #6b4bc9 0%, #3d2d87 50%, #1e1540 100%) !important;
    margin: 0;
    padding: 0;
}

.auth-page .container,
.auth-page #content,
.auth-page .app-main,
.auth-page .py-4 {
    background: transparent !important;
    padding: 0;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.alert {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1050;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-card);
    border-width: 1px;
    overflow: hidden;
}

.alert .btn-close {
    filter: invert(0.5);
}

.auth-container {
    max-width: 400px;
    width: 100%;
    padding: 1rem;
}

.auth-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.auth-icon {
    font-size: 3rem;
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.auth-card h2 {
    color: #fff;
    font-weight: 600;
    font-size: 1.5rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.auth-card .form-label {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.auth-card .form-control {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
}

.auth-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.auth-card .form-control:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
}

.auth-card .form-check-label {
    color: rgba(255,255,255,0.8);
}

.auth-card .btn-link {
    color: #fff;
    text-decoration: underline;
}

.auth-card .btn-link:hover {
    color: rgba(255,255,255,0.8);
}

/* ── Categories ── */
.category-type-income {
    border-left: 3px solid var(--green-600);
}
.category-type-expense {
    border-left: 3px solid var(--red-600);
}
.category-type-savings {
    border-left: 3px solid var(--indigo-500);
}
.category-type-assets {
    border-left: 3px solid var(--purple-500);
}

.list-group-item {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ── Pagination ── */
.page-link {
    color: var(--purple-600);
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

.page-link:hover {
    background-color: var(--bg-hover);
}

.page-item.active .page-link {
    background-color: var(--purple-700);
    border-color: var(--purple-700);
}

/* ── Alerts ── */
.alert-success {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
    border-left: 4px solid #22c55e;
}
.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}
.alert-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}
.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* ── Dashboard Hero ── */
.dashboard-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14vh 1rem 3rem;
    text-align: center;
}

@media (max-width: 767.98px) {
    .dashboard-hero {
        padding-top: 8vh;
        min-height: auto;
        padding-bottom: 1rem;
    }
}

.hero-logo {
    font-size: 3.5rem;
    color: var(--purple-400);
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 12px rgba(107, 75, 201, 0.35));
    animation: logo-glow 3s ease-in-out infinite;
}

body:has(#content[data-sidebar-mode="dashboard"]) .hero-logo {
    color: var(--purple-300);
    filter: drop-shadow(0 2px 16px rgba(138, 111, 217, 0.5));
    animation: logo-glow-dashboard 3s ease-in-out infinite;
}

@keyframes logo-glow {
    0%, 100% { filter: drop-shadow(0 2px 8px rgba(107, 75, 201, 0.25)); }
    50% { filter: drop-shadow(0 2px 20px rgba(107, 75, 201, 0.5)); }
}

@keyframes logo-glow-dashboard {
    0%, 100% { filter: drop-shadow(0 2px 10px rgba(138, 111, 217, 0.35)); }
    50% { filter: drop-shadow(0 2px 24px rgba(138, 111, 217, 0.7)); }
}

.hero-title {
    font-size: 2.4rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--purple-600);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 2.5rem;
    max-width: 400px;
}

.hero-input-wrap {
    width: 100%;
    max-width: 580px;
    position: relative;
}
.hero-input-row {
    display: flex;
    gap: 0.5rem;
    position: relative;
}

.hero-input-wrap.hero-input-loading .hero-input,
body:has(#content[data-sidebar-mode="dashboard"]) .hero-input-wrap.hero-input-loading .hero-input {
    box-shadow: 0 0 15px rgba(138, 111, 217, 0.4), 0 0 30px rgba(138, 111, 217, 0.2) !important;
    animation: hero-input-breathe 1.5s ease-in-out infinite;
}

@keyframes hero-input-breathe {
    0%, 100% { box-shadow: 0 0 10px rgba(138, 111, 217, 0.3), 0 0 20px rgba(138, 111, 217, 0.15) !important; }
    50% { box-shadow: 0 0 20px rgba(138, 111, 217, 0.6), 0 0 40px rgba(138, 111, 217, 0.3) !important; }
}

@keyframes hero-glow-line {
    0% {
        left: 0;
        right: 100%;
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
    100% {
        left: 100%;
        right: 0;
        opacity: 0.3;
    }
}

@keyframes hero-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

.hero-input {
    font-size: 1.1rem !important;
    padding: 0.75rem 1.2rem !important;
    border-radius: 2rem !important;
    border-color: var(--border-color) !important;
    box-shadow: var(--shadow-card);
}

.hero-input:focus {
    border-color: var(--purple-400) !important;
    box-shadow:
        0 1px 8px var(--focus-ring),
        0 0 0 0.2rem var(--focus-ring) !important;
}

.hero-btn {
    border-radius: 2rem !important;
    padding: 0.75rem 1.2rem !important;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.manual-toggle {
    text-decoration: none;
    font-size: 0.82rem;
}
.manual-toggle:hover {
    color: var(--text-primary) !important;
}
.manual-form {
    max-width: 580px;
    margin: 0 auto;
    padding: 1.5rem;
    background: rgba(107, 75, 201, 0.08);
    border: 1px solid rgba(107, 75, 201, 0.15);
    border-radius: 1rem;
}

body:has(#content[data-sidebar-mode="dashboard"]) .manual-form {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

body:has(#content[data-sidebar-mode="dashboard"]) .manual-form .form-select,
body:has(#content[data-sidebar-mode="dashboard"]) .manual-form .form-control {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"]) .manual-form .form-select option {
    background: var(--purple-800);
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"]) .manual-form .form-label {
    color: rgba(255, 255, 255, 0.8);
}

.manual-form .form-label {
    color: var(--text-secondary);
}

/* ── Stats Strip ── */
.stats-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 0;
    margin-bottom: 1rem;
}

.stats-strip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}
.stats-strip-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 500;
}
.stats-strip-value {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}
.stats-strip-sep {
    width: 1px;
    height: 2rem;
    background-color: var(--border-color);
}

/* ── Recent Section ── */
.recent-section {
    max-width: 720px;
    margin: 2rem auto 2rem;
}

.btn-ghost-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 400;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    transition:
        background-color 0.15s,
        color 0.15s;
}

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

.recent-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    padding: 0.75rem;
    background-color: var(--bg-card);
}

.recent-table-header {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ── Catch-up Banner ── */
.catchup-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--purple-100);
    border-radius: 0.5rem;
    background-color: var(--purple-50);
    color: var(--text-primary);
    font-size: 0.88rem;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.catchup-banner i {
    font-size: 1.2rem;
    color: var(--purple-500);
    flex-shrink: 0;
}
.catchup-banner div {
    flex: 1;
}

/* ── Account Cards (Credit Card Style) ── */
.account-card {
    background: linear-gradient(145deg, var(--card-color, #6b4bc9) 0%, color-mix(in srgb, var(--card-color, #6b4bc9) 85%, black) 100%);
    border-radius: 16px;
    padding: 1.25rem;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 0;
    overflow: hidden;
}

@media (min-width: 768px) {
    .account-card {
        min-height: 200px;
    }
}

/* Mobile: 1 card per row */
@media (max-width: 767.98px) {
    .row-cols-sm-1 > * {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Web: 2 cards per row */
@media (min-width: 768px) {
    .row-cols-md-2 > * {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
    transition: transform 0.2s, box-shadow 0.2s;
}
/* Satin matte texture */
.account-card.matte::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='sand'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='2.5' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23sand)'/%3E%3C/svg%3E");
    opacity: 0.3;
    pointer-events: none;
}
.account-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
/* Glossy metallic - bright silver shine */
.account-card.glossy {
    background: linear-gradient(135deg, var(--card-color, #6b4bc9) 0%, color-mix(in srgb, var(--card-color, #6b4bc9) 40%, white) 30%, color-mix(in srgb, var(--card-color, #6b4bc9) 60%, white) 50%, var(--card-color, #6b4bc9) 100%);
}
.account-card.glossy::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 80%;
    height: 100%;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: 2;
    animation: glossyShine 10s ease-in-out infinite;
}
@keyframes glossyShine {
    0%, 100% { left: -50%; }
    50% { left: 120%; }
}
/* Satin shimmer effect - light color, more subtle */
.account-card.matte::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(120deg, transparent 0%, transparent 35%, rgba(255,255,255,0.03) 48%, rgba(255,255,255,0.04) 50%, rgba(255,255,255,0.03) 52%, transparent 65%, transparent 100%);
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: 2;
    animation: satinShimmer 10s ease-in-out infinite;
}
@keyframes satinShimmer {
    0%, 100% { left: -50%; }
    50% { left: 120%; }
}
.account-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 50%);
    pointer-events: none;
}

.account-card-chip {
    width: 40px;
    height: 30px;
    background: linear-gradient(135deg, #d4af37 0%, #f5d68a 50%, #d4af37 100%);
    border-radius: 6px;
    margin-bottom: auto;
}

.account-card-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.account-card-type {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}
.account-card-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
}
.account-tag {
    font-size: 0.65rem;
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
.account-card-balance {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin: 0.25rem 0;
}
.account-card-date {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
}

.account-card-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    margin-top: auto;
}
.account-card-actions .form-control {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.account-card-actions .form-control::placeholder {
    color: rgba(255,255,255,0.6);
}
.account-card-actions .btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.account-card-actions .btn:hover {
    background: rgba(255,255,255,0.25);
}
/* Preview card - no shimmer */
.account-card.preview::after {
    display: none;
}
.account-card.preview::before {
    display: none;
}
/* Bright color text */
.account-card.bright .account-card-name,
.account-card.bright .account-card-type,
.account-card.bright .account-card-balance,
.account-card.bright .account-card-date,
.account-card.bright .account-tag {
    color: #1e1e1e;
    text-shadow: none;
}
.account-card.bright .account-card-actions .form-control,
.account-card.bright .account-card-actions .btn {
    background: rgba(0,0,0,0.1);
    border-color: rgba(0,0,0,0.2);
    color: #1e1e1e;
}

/* Star icon visibility */
.account-card .bi-star,
.account-card .bi-star-fill {
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Color swatches */
.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid transparent;
}
.color-swatch:hover {
    transform: scale(1.1);
}
.color-swatch input {
    display: none;
}
.color-swatch:has(input:checked) {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--card-color, #6b4bc9);
}
.color-swatch i {
    color: #fff;
    font-size: 0.9rem;
    display: none;
}
.color-swatch:has(input:checked) i {
    display: block;
}

/* ── Onboarding ── */
.onboarding-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6vh 1rem 2rem;
    text-align: center;
}

.onboarding-form-wrap {
    width: 100%;
    max-width: 580px;
    text-align: left;
}

.account-row {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: var(--bg-card);
}

/* ── Catch-up Wizard ── */
.catchup-wizard {
    max-width: 640px;
    margin: 2rem auto;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.step-indicator .step {
    padding: 0.3rem 0;
}

.step-indicator .step.active {
    color: var(--purple-600);
    font-weight: 500;
    border-bottom: 2px solid var(--purple-600);
}

.step-indicator .step.done {
    color: var(--green-600);
}

.catchup-account-row {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: var(--bg-card);
}

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

.catchup-unexplained {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

/* ── Page Transitions (htmx + View Transitions API) ── */
@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 140ms;
    }
    ::view-transition-old(root) {
        animation: fade-out 140ms ease forwards;
    }
    ::view-transition-new(root) {
        animation: fade-in 140ms ease forwards;
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Top progress bar during htmx requests */
.page-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--purple-500), var(--purple-300));
    transform: scaleX(0);
    transform-origin: left;
    z-index: 1080;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.page-progress.htmx-request {
    opacity: 1;
    animation: progress-slide 0.9s ease-out infinite;
}

@keyframes progress-slide {
    0% {
        transform: scaleX(0);
        transform-origin: left;
    }
    50% {
        transform: scaleX(0.7);
        transform-origin: left;
    }
    100% {
        transform: scaleX(1);
        transform-origin: right;
    }
}

/* ── Misc ── */
.text-secondary {
    color: var(--text-secondary) !important;
}
.border-secondary {
    border-color: var(--border-color) !important;
}

::selection {
    background-color: var(--purple-200);
    color: var(--purple-900);
}

/* ── Frost utilities (light pages: modal / dropdown / toast) ── */
body:not(:has(#content[data-sidebar-mode="dashboard"])) .modal-content {
    background: var(--frost-bg);
    backdrop-filter: var(--frost-blur);
    -webkit-backdrop-filter: var(--frost-blur);
    border: var(--frost-border);
    border-radius: var(--radius-modal);
    box-shadow: var(--shadow-hover);
}

body:not(:has(#content[data-sidebar-mode="dashboard"])) .modal-header,
body:not(:has(#content[data-sidebar-mode="dashboard"])) .modal-footer {
    border-color: var(--border-subtle);
    background: transparent;
}

/* Dashboard modal styling */
body:has(#content[data-sidebar-mode="dashboard"]) .modal-content {
    background: rgba(30, 21, 64, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-modal);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"]) .modal-header,
body:has(#content[data-sidebar-mode="dashboard"]) .modal-footer {
    border-color: rgba(255, 255, 255, 0.1);
    background: transparent;
}

body:has(#content[data-sidebar-mode="dashboard"]) .modal-title {
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"]) .btn-close {
    filter: invert(1);
}

body:has(#content[data-sidebar-mode="dashboard"]) .form-label {
    color: rgba(255, 255, 255, 0.8);
}

body:has(#content[data-sidebar-mode="dashboard"]) .form-select,
body:has(#content[data-sidebar-mode="dashboard"]) .form-control {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"]) .form-select option {
    background: var(--purple-800);
    color: #ffffff;
}

body:has(#content[data-sidebar-mode="dashboard"]) .form-select:focus,
body:has(#content[data-sidebar-mode="dashboard"]) .form-control:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--purple-400);
    color: #ffffff;
    box-shadow: 0 0 0 0.2rem var(--focus-ring);
}

.modal-backdrop.show {
    opacity: 0.3;
}

.dropdown-menu {
    background: var(--frost-bg);
    backdrop-filter: var(--frost-blur);
    -webkit-backdrop-filter: var(--frost-blur);
    border: var(--frost-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 0.35rem;
}

.dropdown-item {
    border-radius: var(--radius-chip);
    padding: 0.4rem 0.7rem;
    font-size: 0.9rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--purple-50);
    color: var(--purple-700);
}

.toast {
    background: var(--frost-bg);
    backdrop-filter: var(--frost-blur);
    -webkit-backdrop-filter: var(--frost-blur);
    border: var(--frost-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-hover);
}

.toast-header {
    background: rgba(107, 75, 201, 0.1);
    border-bottom: 1px solid var(--frost-border);
    color: var(--purple-300);
}

.toast-header .btn-close {
    filter: invert(1);
}

.toast-success {
    border-left: 4px solid var(--green-500);
}
.toast-danger {
    border-left: 4px solid var(--red-500);
}
.toast-warning {
    border-left: 4px solid var(--amber-500);
}
.toast-info {
    border-left: 4px solid var(--purple-400);
}

/* ── Misc polish ── */
.badge {
    border-radius: var(--radius-chip);
    font-weight: 500;
    letter-spacing: 0.01em;
}


.list-group-item {
    border-color: var(--border-subtle);
}

.table thead th {
    background-color: transparent;
    border-bottom: 1px solid var(--border-subtle);
}

.table td {
    border-bottom-color: var(--border-subtle);
}
