/* Kizuna Finance - Anime Neon Glassmorphism Theme */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(255,255,255,0.04);
    --bg-glass: rgba(255,255,255,0.06);
    --border-glass: rgba(255,255,255,0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-primary: #818cf8;
    --accent-secondary: #c084fc;
    --accent-pink: #f472b6;
    --accent-green: #34d399;
    --accent-red: #f87171;
    --accent-yellow: #fbbf24;
    --gradient-main: linear-gradient(135deg, #6366f1, #8b5cf6, #c084fc);
    --gradient-card: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.05));
    --shadow-neon: 0 0 20px rgba(129,140,248,0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-width: 300px;
    --font-main: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;
    --chart-label: #94a3b8;
    --chart-grid: rgba(255,255,255,0.05);
    --alert-error-bg: rgba(248,113,113,0.1);
    --alert-error-border: rgba(248,113,113,0.3);
    --alert-error-text: #fca5a5;
    --alert-success-bg: rgba(52,211,153,0.1);
    --alert-success-border: rgba(52,211,153,0.3);
    --alert-success-text: #6ee7b7;
    --topbar-bg: rgba(12, 12, 28, 0.92);
    --toggle-bg: rgba(255,255,255,0.06);
    --toggle-border: rgba(255,255,255,0.12);
    --toggle-bar: #e2e8f0;
    --select-option-bg: #12122a;
    --select-option-text: #f1f5f9;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg-primary: #f3f0fc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255,255,255,0.92);
    --bg-glass: rgba(255,255,255,0.85);
    --border-glass: rgba(124, 92, 196, 0.14);
    --text-primary: #2a2148;
    --text-secondary: #6a6280;
    --text-muted: #8b849e;
    --gradient-card: linear-gradient(135deg, rgba(124,92,196,0.08), rgba(243,198,222,0.12));
    --shadow-neon: 0 8px 24px rgba(88, 50, 160, 0.08);
    --chart-label: #6a6280;
    --chart-grid: rgba(124, 92, 196, 0.12);
    --alert-error-bg: rgba(220, 38, 38, 0.08);
    --alert-error-border: rgba(220, 38, 38, 0.22);
    --alert-error-text: #b91c1c;
    --alert-success-bg: rgba(5, 150, 105, 0.08);
    --alert-success-border: rgba(5, 150, 105, 0.22);
    --alert-success-text: #047857;
    --topbar-bg: rgba(247, 244, 252, 0.92);
    --toggle-bg: #fff;
    --toggle-border: rgba(124, 58, 237, 0.14);
    --toggle-bar: #7c5cc4;
    --select-option-bg: #ffffff;
    --select-option-text: #2a2148;
    color-scheme: light;
}

[data-theme="dark"] {
    --chart-label: #94a3b8;
    --chart-grid: rgba(255,255,255,0.05);
    --select-option-bg: #12122a;
    --select-option-text: #f1f5f9;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(192,132,252,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(244,114,182,0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--accent-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-secondary); }

/* Layout */
.app-layout { display: flex; min-height: 100vh; position: relative; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    padding: 24px 16px;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 24px;
}

.sidebar-logo h1 {
    font-size: 20px;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.sidebar-logo .logo-icon { font-size: 28px; }

.brand-logo {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    text-decoration: none;
}
.brand-logo img {
    display: block;
    height: auto;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}
.brand-logo--nav img {
    height: 36px;
    max-width: 180px;
}
.brand-logo--sidebar img {
    height: 66px;
    max-width: 200px;
}
.brand-logo--admin img {
    height: 66px;
    max-width: 264px;
}
.landing-nav .logo {
    display: flex;
    align-items: center;
}
.landing-nav .logo a {
    -webkit-text-fill-color: unset;
    background: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(129,140,248,0.1);
    color: var(--accent-primary);
}

.nav-item.active { box-shadow: var(--shadow-neon); }

.nav-item .icon { font-size: 18px; width: 28px; text-align: center; }
.nav-item .icon--svg {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-item .icon--svg img {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
}
.nav-accordion-label .icon--svg {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nav-accordion-label .icon--svg img {
    width: 28px;
    height: 28px;
    display: block;
}
.nav-item .icon--mascot {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-item .icon--mascot img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
    animation: float 2.4s ease-in-out infinite;
    will-change: transform;
}
.nav-item--kizu {
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
}
.nav-item--kizu .icon--mascot img {
    animation: float 2.4s ease-in-out infinite;
}
.page-header-mascot {
    width: 50px;
    height: 50px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
    animation: float 2.4s ease-in-out infinite;
    display: inline-block;
}
.page-header-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 8px;
    display: inline-block;
    flex-shrink: 0;
}
.page-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 0;
}
@media (prefers-reduced-motion: reduce) {
    .nav-item .icon--mascot img,
    .page-header-mascot,
    .stat-card .stat-mascot { animation: none; }
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px;
    min-height: 0;
}
.sidebar-footer {
    margin-top: auto;
    padding-top: 8px;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
}
.sidebar-footer .nav-item--footer {
    flex: 1;
    min-width: 0;
    gap: 6px;
    padding: 8px 8px;
    margin-bottom: 0;
    font-size: 12px;
    font-weight: 600;
    justify-content: center;
    white-space: nowrap;
}
.sidebar-footer .nav-item--footer .icon--svg {
    width: 18px;
    height: 18px;
}
.sidebar-footer .nav-item--footer .icon--svg img {
    width: 18px;
    height: 18px;
}
.nav-divider {
    height: 1px;
    background: var(--border-glass);
    margin: 10px 8px;
}
.nav-accordion {
    margin-bottom: 4px;
}
.nav-accordion-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}
.nav-accordion-toggle:hover,
.nav-accordion.is-open > .nav-accordion-toggle {
    background: rgba(129,140,248,0.08);
    color: var(--accent-primary);
}
.nav-accordion-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.nav-accordion-label .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}
.nav-accordion-chevron {
    font-size: 12px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}
.nav-accordion.is-open .nav-accordion-chevron {
    transform: rotate(180deg);
}
.nav-accordion-panel {
    padding: 2px 0 6px 8px;
    border-left: 2px solid rgba(129,140,248,0.18);
    margin: 0 8px 4px 18px;
}
.nav-accordion-panel .nav-item {
    padding: 8px 10px;
    font-size: 15px;
}
.nav-accordion-panel[hidden] {
    display: none !important;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

/* Cards */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.glass-card:hover { box-shadow: var(--shadow-neon); }

.settings-stack {
    display: grid;
    gap: 20px;
    max-width: 640px;
}
.settings-card { max-width: none; }
.settings-help {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 16px;
    line-height: 1.5;
}
.settings-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin: -8px 0 16px;
}
.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    cursor: pointer;
}
.check-row input { margin-top: 3px; flex-shrink: 0; }
.currency-setup {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}
.currency-setup-card {
    width: min(560px, 100%);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    overflow: visible;
    position: relative;
}
.stat-card .stat-icon {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-card .stat-icon img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    display: block;
}
.stat-card .stat-body {
    flex: 1;
    min-width: 0;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin-bottom: 4px; line-height: 1.15; }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); }
.stat-card.income .stat-value { color: var(--accent-green); }
.stat-card.expense .stat-value { color: var(--accent-red); }
.stat-card.savings .stat-value { color: var(--accent-primary); }
.stat-card.has-mascot {
    overflow: visible;
    z-index: 1;
}
.stat-card .stat-icon--mascot {
    width: 96px;
    height: 96px;
    margin: -18px 0 -18px -8px;
    position: relative;
    z-index: 2;
}
.stat-card .stat-mascot {
    width: 110px !important;
    height: 110px !important;
    object-fit: contain;
    animation: float 2.4s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(129, 140, 248, 0.28));
}

/* Mascot / dashboard hero — soft split card like mockup */
.mascot-section {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 22px 26px;
    background: linear-gradient(135deg, #f7f4fc 0%, #efe8fb 55%, #f8f5ff 100%);
    border-radius: 22px;
    border: 1px solid rgba(124, 92, 196, 0.12);
    box-shadow: 0 14px 36px rgba(88, 50, 160, 0.08);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    color: #2a2148;
}

.mascot-section--split {
    display: grid;
    grid-template-columns: minmax(280px, 0.95fr) minmax(300px, 1.2fr);
    align-items: center;
    gap: 8px 28px;
}

.mascot-panel { position: relative; z-index: 1; min-width: 0; }

.mascot-panel--user {
    display: flex;
    align-items: stretch;
    padding-right: 8px;
    min-height: 128px;
}

.user-hero {
    display: flex;
    align-items: stretch;
    gap: 30px;
    width: 100%;
    min-height: inherit;
}

.user-hero-avatar {
    margin: 10px;
    margin-right: 0;
    box-sizing: border-box;
    align-self: center;
    aspect-ratio: 1 / 1;
    height: 70%;
    width: auto;
    min-height: 86px;
    min-width: 86px;
    flex: 0 0 auto;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    border: 3px solid #f3c6de;
    box-shadow:
        0 0 0 4px rgba(243, 198, 222, 0.35),
        0 12px 28px rgba(192, 132, 252, 0.22);
}

.user-hero-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    align-self: center;
    flex: 0 0 auto;
    margin: 10px;
    margin-right: 0;
}

.user-hero-avatar-wrap .user-hero-avatar {
    margin: 0;
    height: auto;
    width: 108px;
    min-width: 108px;
    min-height: 108px;
}

.user-plan-name {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.25;
    max-width: 140px;
}

.user-plan-days {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #6d28d9;
    background: rgba(124, 92, 196, 0.12);
    border: 1px solid rgba(124, 92, 196, 0.18);
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
    text-align: center;
    line-height: 1.2;
}

.user-plan-days.is-expired {
    color: #b91c1c;
    background: rgba(248, 113, 113, 0.14);
    border-color: rgba(248, 113, 113, 0.28);
}

.user-hero-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-hero-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
    padding: 10px 0;
}

.user-hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    min-width: 0;
}

.user-hero-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: inherit;
    white-space: nowrap;
}

.user-hero-stat strong { font-weight: 800; }

.user-hero-stat .stat-ico {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    filter: drop-shadow(0 2px 4px rgba(88, 50, 160, 0.15));
}

.mascot-panel--kizu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mascot-section::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -12%;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(192,132,252,0.16), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.mascot-avatar {
    width: 228px;
    height: 228px;
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
    filter: drop-shadow(0 10px 18px rgba(88, 50, 160, 0.18));
}
.auth-mascot img { width: 110px; height: 110px; border-radius: 0; object-fit: contain; background: transparent; animation: float 3s ease-in-out infinite; }
.hero-mascot { width: 320px; max-width: 100%; height: auto; animation: float 4s ease-in-out infinite; filter: drop-shadow(0 12px 28px rgba(37, 99, 235, 0.25)); border-radius: 0; background: transparent; }
.mascot-speech { flex: 1; z-index: 1; min-width: 0; }
.mascot-speech .greeting {
    font-size: clamp(18px, 2vw, 24px);
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.35;
    color: #2a2148;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mascot-speech .greeting-line {
    display: block;
}
.mascot-speech .message {
    color: #6a6280;
    font-size: 16px;
    line-height: 1.55;
}
[data-theme="dark"] .mascot-speech .greeting { color: var(--text-primary); }
[data-theme="dark"] .mascot-speech .message { color: var(--text-secondary); }

.mascot-stats { display: flex; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.mascot-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.user-hero-main .xp-bar {
    width: 100%;
    height: 10px;
    background: rgba(124, 92, 196, 0.14);
    border-radius: 999px;
    overflow: hidden;
    margin: 0;
    flex: 0 0 auto;
}

.xp-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #9b7dd4, #7c5cc4);
    border-radius: 999px;
    transition: width 0.5s ease;
}

@media (max-width: 900px) {
    .mascot-section--split {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .mascot-panel--user { padding-right: 0; }
    .mascot-panel--kizu {
        order: -1;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .mascot-avatar {
        width: 132px;
        height: 132px;
        margin: 0 auto;
    }
    .mascot-speech {
        width: 100%;
    }
    .mascot-speech .greeting {
        font-size: 16px;
        line-height: 1.4;
    }
    .mascot-speech .message {
        font-size: 15px;
    }
    .user-hero {
        gap: 14px;
        align-items: center;
    }
    .user-hero-avatar-wrap {
        margin: 4px;
    }
    .user-hero-avatar-wrap .user-hero-avatar,
    .user-hero-avatar {
        width: 72px;
        height: 72px;
        min-width: 72px;
        min-height: 72px;
        margin: 0;
    }
    .user-plan-days { font-size: 10px; padding: 3px 8px; }
    .user-hero-main { padding: 4px 0; gap: 10px; }
    .user-hero-stats { gap: 8px 10px; }
    .user-hero-stat {
        font-size: 12px;
        white-space: normal;
        gap: 6px;
    }
    .user-hero-stat .stat-ico {
        width: 18px;
        height: 18px;
        flex-basis: 18px;
    }
}

/* Quests */
.quest-list { display: flex; flex-direction: column; gap: 8px; }
.quest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    transition: all 0.2s;
}

.quest-item.completed { opacity: 0.6; border-color: rgba(52,211,153,0.3); }
.quest-item.completed .quest-check { background: var(--accent-green); color: #fff; }

.quest-check {
    width: 24px; height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.quest-info { flex: 1; }
.quest-name { font-size: 14px; font-weight: 600; }
.quest-xp { font-size: 12px; color: var(--accent-yellow); font-weight: 700; }

/* Transactions */
.tx-list { display: flex; flex-direction: column; gap: 4px; }
.tx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.tx-item:hover { background: rgba(255,255,255,0.03); }
.tx-icon { font-size: 24px; width: 40px; text-align: center; }
.tx-info { flex: 1; }
.tx-name { font-size: 14px; font-weight: 600; }
.tx-date { font-size: 12px; color: var(--text-muted); }
.tx-amount { font-size: 15px; font-weight: 700; }
.tx-amount.income { color: var(--accent-green); }
.tx-amount.expense { color: var(--accent-red); }

.tx-filters { margin-bottom: 0; }
.tx-filters .form-label {
    font-size: 11px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tx-filters .form-input,
.tx-filters .form-select {
    padding: 8px 10px;
    font-size: 13px;
}
.tx-filter-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 10px;
}
.tx-filter-form .form-group {
    margin-bottom: 0;
    flex: 1 1 0;
    min-width: 0;
}
.tx-filter-form .form-group:first-child {
    flex: 1.35 1 0;
}
.tx-filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
    padding-bottom: 1px;
}
.tx-filter-actions .btn {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
}

/* Subscriptions toolbar */
.sub-stats-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 16px 20px;
    margin-bottom: 24px;
}
.sub-stats-cards {
    flex: 1 1 420px;
    margin-bottom: 0;
    min-width: 0;
}
.sub-add-btn {
    align-self: center;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .sub-add-btn {
        width: 100%;
        margin-left: 0;
        text-align: center;
        justify-content: center;
    }
}
.tx-card.is-inactive {
    opacity: 0.72;
}
.sub-status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 8px;
    border-radius: 999px;
    margin-right: auto;
}
.sub-status-badge.is-active {
    color: #065f46;
    background: rgba(52, 211, 153, 0.18);
}
.sub-status-badge.is-inactive {
    color: #7f1d1d;
    background: rgba(248, 113, 113, 0.16);
}
[data-theme="dark"] .sub-status-badge.is-active {
    color: #a7f3d0;
}
[data-theme="dark"] .sub-status-badge.is-inactive {
    color: #fecaca;
}

.tx-results.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.tx-card.is-unpaid {
    border-style: dashed;
    opacity: 0.92;
}
.tx-pay-toggle {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.tx-pay-form {
    display: inline;
    margin: 0;
}
.tx-pay-badge {
    appearance: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 9px;
    border-radius: 999px;
    line-height: 1.2;
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tx-pay-badge.is-unpaid.is-selected {
    color: #9a3412;
    background: rgba(251, 146, 60, 0.2);
    border-color: rgba(251, 146, 60, 0.35);
}
.tx-pay-badge.is-paid.is-selected {
    color: #065f46;
    background: rgba(52, 211, 153, 0.2);
    border-color: rgba(52, 211, 153, 0.35);
}
.tx-pay-badge:not(.is-selected):hover {
    border-color: rgba(124, 92, 196, 0.35);
    color: var(--text-primary);
}
[data-theme="dark"] .tx-pay-badge.is-unpaid.is-selected {
    color: #fdba74;
}
[data-theme="dark"] .tx-pay-badge.is-paid.is-selected {
    color: #a7f3d0;
}
.kakeibo-pay-pill {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    vertical-align: middle;
}
.kakeibo-pay-pill.is-unpaid {
    color: #9a3412;
    background: rgba(251, 146, 60, 0.18);
}
.kakeibo-pay-pill.is-paid {
    color: #065f46;
    background: rgba(52, 211, 153, 0.18);
}

.tx-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}
.tx-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: rgba(255,255,255,0.02);
    min-height: 148px;
}
.tx-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.tx-card .tx-icon {
    width: auto;
    font-size: 28px;
    line-height: 1;
}
.tx-card .tx-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.tx-card-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.tx-delete-form { display: inline; margin: 0; }
.tx-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-glass);
}
.tx-pager-info {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 0 8px;
    font-weight: 600;
}
.btn.is-disabled,
.btn.is-disabled:hover {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}
.btn-danger {
    background: rgba(248, 113, 113, 0.18);
    color: var(--accent-red);
    border: 1px solid rgba(248, 113, 113, 0.35);
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.28);
}

@media (max-width: 1200px) {
    .tx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tx-filter-form { flex-wrap: wrap; }
    .tx-filter-form .form-group {
        flex: 1 1 calc(33.333% - 10px);
        min-width: 140px;
    }
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.form-input, .form-select,
select.form-input, select.form-select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    color-scheme: inherit;
}

.form-input:focus, .form-select:focus,
select.form-input:focus, select.form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(129,140,248,0.15);
}

/* Native dropdown list: prevent light text on white popup in dark UI */
select,
.form-select,
.lang-select {
    color-scheme: inherit;
}

select option,
.form-select option,
.form-input option,
.lang-select option {
    background-color: var(--select-option-bg);
    color: var(--select-option-text);
}

select option:checked,
.form-select option:checked,
.form-input option:checked,
.lang-select option:checked {
    background-color: #4f46e5 linear-gradient(0deg, #4f46e5 0%, #4f46e5 100%);
    color: #ffffff;
}

select option:disabled,
.form-select option:disabled {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-main);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); color: #fff; }
.btn-secondary { background: var(--bg-glass); color: var(--text-primary); border: 1px solid var(--border-glass); }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* Budget bar */
.budget-bar { margin-top: 12px; }
.budget-bar-track { height: 10px; background: rgba(255,255,255,0.1); border-radius: 5px; overflow: hidden; }
.budget-bar-fill { height: 100%; border-radius: 5px; transition: width 0.5s; }
.budget-bar-fill.safe { background: var(--accent-green); }
.budget-bar-fill.warning { background: var(--accent-yellow); }
.budget-bar-fill.danger { background: var(--accent-red); }

/* Landing */
.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(10,10,26,0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
}

.landing-nav .logo { display: flex; align-items: center; }
.landing-nav .nav-links { display: flex; gap: 32px; align-items: center; }
.landing-nav .nav-links a { color: var(--text-secondary); font-size: 14px; font-weight: 500; }
.landing-nav .nav-links a:hover { color: var(--text-primary); }

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 40px 80px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 60px;
}

.hero-content { flex: 1; }
.hero-content h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 800; line-height: 1.2; margin-bottom: 20px; }
.hero-content h1 span { background: var(--gradient-main); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-content p { font-size: 18px; color: var(--text-secondary); margin-bottom: 32px; max-width: 500px; }
.hero-buttons { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-visual { flex: 1; display: flex; justify-content: center; }
.hero-mascot { width: 320px; max-width: 100%; height: auto; animation: float 4s ease-in-out infinite; filter: drop-shadow(0 12px 28px rgba(37, 99, 235, 0.25)); border-radius: 0; background: transparent; }

.features-section { padding: 80px 40px; max-width: 1200px; margin: 0 auto; }
.section-title { text-align: center; font-size: 36px; font-weight: 700; margin-bottom: 16px; }
.section-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 48px; font-size: 16px; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.feature-card { padding: 32px; text-align: center; }
.feature-card .feature-icon { font-size: 48px; margin-bottom: 16px; }
.feature-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { color: var(--text-secondary); font-size: 14px; }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; max-width: 1000px; margin: 0 auto; }
.pricing-card { padding: 40px 32px; text-align: center; position: relative; }
.pricing-card.featured { border-color: var(--accent-primary); box-shadow: var(--shadow-neon); }
.pricing-card .plan-name { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.pricing-card .plan-price { font-size: 40px; font-weight: 800; margin-bottom: 4px; }
.pricing-card .plan-price span { font-size: 16px; color: var(--text-secondary); font-weight: 400; }
.pricing-card .plan-features { list-style: none; margin: 24px 0; text-align: left; }
.pricing-card .plan-features li { padding: 8px 0; font-size: 14px; color: var(--text-secondary); }
.pricing-card .plan-features li::before { content: 'âœ“ '; color: var(--accent-green); font-weight: 700; }

.landing-footer { padding: 40px; text-align: center; border-top: 1px solid var(--border-glass); color: var(--text-muted); font-size: 13px; }

/* Auth */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.auth-card h2 { text-align: center; font-size: 24px; margin-bottom: 8px; }
.auth-card .auth-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 32px; font-size: 14px; }
.auth-mascot { text-align: center; margin-bottom: 24px; }
.auth-mascot img { width: 110px; height: 110px; border-radius: 0; object-fit: contain; background: transparent; animation: float 3s ease-in-out infinite; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: var(--alert-error-bg); border: 1px solid var(--alert-error-border); color: var(--alert-error-text); }
.alert-success { background: var(--alert-success-bg); border: 1px solid var(--alert-success-border); color: var(--alert-success-text); }

/* Admin */
.admin-sidebar { width: 280px; }
.admin-sidebar .nav-section { margin-bottom: 24px; }
.admin-sidebar .nav-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 0 16px; margin-bottom: 8px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.page-header h2 { font-size: 24px; font-weight: 700; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-glass); font-size: 14px; }
.data-table th { color: var(--text-secondary); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-success { background: rgba(52,211,153,0.15); color: var(--accent-green); }
.badge-warning { background: rgba(251,191,36,0.15); color: var(--accent-yellow); }
.badge-danger { background: rgba(248,113,113,0.15); color: var(--accent-red); }

/* Mobile topbar + sidebar */
.app-topbar { display: none; }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(15, 10, 30, 0.45);
    backdrop-filter: blur(2px);
    border: 0;
    padding: 0;
    cursor: pointer;
}
.sidebar-backdrop.is-visible { display: block; }
.sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    background: var(--bg-glass);
    color: var(--text-primary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.mobile-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--toggle-border);
    border-radius: 12px;
    background: var(--toggle-bg);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 0;
    color: var(--toggle-bar);
    flex-shrink: 0;
}
.mobile-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--toggle-bar);
    border-radius: 2px;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(129,140,248,0.15); }
    50% { box-shadow: 0 0 30px rgba(129,140,248,0.3); }
}

@media (max-width: 768px) {
    .app-topbar {
        display: block;
        position: sticky;
        top: 0;
        z-index: 200;
        background: var(--topbar-bg);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-glass);
    }
    .app-topbar-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 16px;
        min-height: 64px;
    }
    .app-topbar .brand-logo--nav img {
        height: 40px;
        max-width: 160px;
    }
    .mobile-toggle { display: inline-flex; }

    .sidebar {
        transform: translateX(-100%);
        z-index: 300;
        box-shadow: 16px 0 40px rgba(0, 0, 0, 0.35);
        background: var(--bg-secondary);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: inline-flex; }
    .sidebar-logo { padding-right: 48px; }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 16px;
    }

    body.sidebar-open { overflow: hidden; }

    .mascot-section {
        padding: 16px;
        text-align: left;
    }
    .hero { flex-direction: column; text-align: center; padding: 100px 20px 60px; }
    .hero-content p { margin: 0 auto 32px; }
    .hero-buttons { justify-content: center; }
    .hero-mascot { width: 320px; max-width: 100%; height: auto; animation: float 4s ease-in-out infinite; filter: drop-shadow(0 12px 28px rgba(37, 99, 235, 0.25)); border-radius: 0; background: transparent; }
    .landing-nav { padding: 16px 20px; }
    .landing-nav .nav-links { gap: 16px; }
    .card-grid { grid-template-columns: 1fr 1fr; }
    .tx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tx-filter-form { flex-wrap: wrap; }
    .tx-filter-form .form-group {
        flex: 1 1 calc(50% - 10px);
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .card-grid { grid-template-columns: 1fr; }
    .tx-grid { grid-template-columns: 1fr; }
    .mascot-avatar {
        width: 112px;
        height: 112px;
    }
    .app-topbar .brand-logo--nav img {
        height: 36px;
        max-width: 140px;
    }
}

/* Chart container */
.chart-container { position: relative; height: 300px; margin-top: 16px; }

.section-title-sm { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-title-ico {
    width: 45px;
    height: 45px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lang-switch-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
.lang-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    min-width: 120px;
    color-scheme: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%9494a3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.lang-select:hover, .lang-select:focus {
    border-color: rgba(129,140,248,0.45);
    outline: none;
}
.lang-switch--compact .lang-select {
    min-width: 110px;
    padding: 6px 28px 6px 10px;
    font-size: 12px;
    width: 100%;
}

.streak-fire { font-size: 20px; animation: pulse-glow 2s infinite; }

.goal-progress { margin-top: 8px; }
.goal-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.goal-bar-fill { height: 100%; background: var(--gradient-main); border-radius: 3px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

/* Account (subscription / billing) */
.account-stack {
    display: grid;
    gap: 20px;
    max-width: 960px;
}
.account-card { max-width: none; }
.account-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border: 1px solid rgba(129, 140, 248, 0.35);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(255, 255, 255, 0.03));
}
.account-banner--warn {
    border-color: rgba(248, 113, 113, 0.35);
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.1), rgba(255, 255, 255, 0.03));
}
.account-banner-text { flex: 1; min-width: 200px; }
.account-banner-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}
.account-banner-text p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.45;
}
.account-plan-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.account-plan-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}
.account-days {
    text-align: center;
    min-width: 88px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(129, 140, 248, 0.25);
}
.account-days-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--accent-primary);
}
.account-days-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.account-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.account-meta {
    padding: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
}
.account-meta-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.account-meta-value {
    font-size: 15px;
    font-weight: 600;
}
.account-table-wrap { overflow-x: auto; }
.account-upgrade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.account-upgrade-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s, transform 0.2s;
}
.account-upgrade-card:hover {
    border-color: rgba(129, 140, 248, 0.4);
    transform: translateY(-2px);
}
.account-upgrade-card.is-featured {
    border-color: rgba(129, 140, 248, 0.45);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.1), rgba(255, 255, 255, 0.02));
}
.account-upgrade-card.is-current {
    border-color: rgba(52, 211, 153, 0.4);
}
.account-upgrade-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green);
}
.account-upgrade-badge--hot {
    background: rgba(99, 102, 241, 0.18);
    color: var(--accent-primary);
}
.account-upgrade-card h3 {
    margin: 0 28px 0 0;
    font-size: 18px;
}
.account-upgrade-prices {
    display: grid;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}
.account-upgrade-prices strong {
    color: var(--text-primary);
    font-size: 18px;
}
.account-feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
    flex: 1;
}
.account-feature-list li {
    position: relative;
    padding-left: 18px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}
.account-feature-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-green);
    font-weight: 700;
}
.account-upgrade-btn { width: 100%; text-align: center; margin-top: auto; }
.account-pricing-link {
    margin: 16px 0 0;
    text-align: center;
}
.account-pricing-link a {
    color: var(--accent-primary);
    font-size: 14px;
    font-weight: 600;
}
@media (max-width: 768px) {
    .account-meta-grid { grid-template-columns: 1fr; }
    .account-plan-hero { flex-direction: column; }
}

/* Cart / Checkout */
.checkout-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    gap: 20px;
    width: min(920px, 100%);
    margin: 0 auto;
    padding: 0 16px;
}
.checkout-form-card,
.checkout-summary-card { width: 100%; max-width: none; }
.checkout-line {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-glass);
}
.checkout-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    font-size: 18px;
}
@media (max-width: 768px) {
    .checkout-layout { grid-template-columns: 1fr; }
}


/* ===== Kakeibo cash ledger ===== */
.kakeibo-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}
.kakeibo-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.kakeibo-header h2 {
    min-width: 0;
    word-break: break-word;
}
.kakeibo-month-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.kakeibo-month-label {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-primary);
    min-width: 6.5em;
    text-align: center;
}
.kakeibo-lead {
    margin: -4px 0 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.55;
    max-width: 52em;
}
.kakeibo-workspace {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 18px;
    margin: 24px 0;
    align-items: start;
    min-width: 0;
}
.kakeibo-cal,
.kakeibo-ledger {
    min-width: 0;
}
.kakeibo-cal {
    padding: 16px;
}
.kakeibo-cal-title {
    font-weight: 800;
    font-size: 0.92rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.kakeibo-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}
.kakeibo-cal-wd {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 4px 0;
    letter-spacing: 0.02em;
}
.kakeibo-cal-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    background: rgba(124, 92, 196, 0.06);
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.kakeibo-cal-cell.is-empty {
    background: transparent;
    pointer-events: none;
}
.kakeibo-cal-cell:hover {
    background: rgba(124, 92, 196, 0.14);
    border-color: rgba(124, 92, 196, 0.25);
}
.kakeibo-cal-cell.is-today {
    box-shadow: inset 0 0 0 1.5px rgba(124, 92, 196, 0.45);
}
.kakeibo-cal-cell.is-selected {
    background: linear-gradient(145deg, #8b6fd4, #6d52b8);
    color: #fff;
    border-color: transparent;
}
.kakeibo-cal-cell.has-activity .kakeibo-cal-num { margin-bottom: 2px; }
.kakeibo-cal-dots {
    display: flex;
    gap: 3px;
    height: 5px;
}
.kakeibo-cal-dots .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: block;
}
.kakeibo-cal-dots .dot.income { background: var(--accent-green); }
.kakeibo-cal-dots .dot.expense { background: var(--accent-red); }
.kakeibo-cal-cell.is-selected .dot.income { background: #b8f5d0; }
.kakeibo-cal-cell.is-selected .dot.expense { background: #ffc9d4; }

.kakeibo-cal-mascot {
    margin-top: 16px;
    padding: 14px 10px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    border-radius: 16px;
    background: rgba(124, 92, 196, 0.06);
    border: 1px dashed rgba(124, 92, 196, 0.18);
}
.kakeibo-cal-mascot img {
    width: auto;
    height: 165px;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 18px rgba(70, 50, 120, 0.22));
}
.kakeibo-cal-mascot-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 4px;
}
.kakeibo-cal-mascot-meta strong {
    font-size: 0.95rem;
    color: var(--text-primary);
}
.kakeibo-cal-mascot-meta span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    word-break: break-word;
}
.kakeibo-cal-mascot.mood-celebrate { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.28); }
.kakeibo-cal-mascot.mood-cheer,
.kakeibo-cal-mascot.mood-yay { background: rgba(110, 231, 183, 0.1); border-color: rgba(110, 231, 183, 0.24); }
.kakeibo-cal-mascot.mood-great { background: rgba(196, 181, 253, 0.12); border-color: rgba(167, 139, 250, 0.28); }
.kakeibo-cal-mascot.mood-calm { background: rgba(124, 92, 196, 0.06); }
.kakeibo-cal-mascot.mood-think { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.28); }
.kakeibo-cal-mascot.mood-worried { background: rgba(251, 146, 60, 0.12); border-color: rgba(251, 146, 60, 0.28); }
.kakeibo-cal-mascot.mood-oops,
.kakeibo-cal-mascot.mood-sad { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.28); }

.kakeibo-ledger-frame {
    position: relative;
    border-radius: 18px;
    padding: 22px 20px 16px;
    background:
        linear-gradient(180deg, rgba(255, 252, 247, 0.97), rgba(248, 242, 232, 0.95));
    color: #3d3428;
    border: 1.5px solid rgba(140, 110, 70, 0.28);
    box-shadow:
        0 14px 36px rgba(70, 50, 30, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
    overflow: hidden;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
[data-theme="dark"] .kakeibo-ledger-frame {
    background:
        linear-gradient(180deg, rgba(48, 40, 58, 0.96), rgba(36, 30, 48, 0.98));
    color: #efe6d8;
    border-color: rgba(196, 168, 120, 0.28);
    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.kakeibo-ledger-frame::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(140, 110, 70, 0.18);
    border-radius: 12px;
    pointer-events: none;
}
[data-theme="dark"] .kakeibo-ledger-frame::before {
    border-color: rgba(196, 168, 120, 0.16);
}
.kakeibo-ledger-head {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1.5px double rgba(140, 110, 70, 0.35);
}
[data-theme="dark"] .kakeibo-ledger-head {
    border-bottom-color: rgba(196, 168, 120, 0.3);
}
.kakeibo-ledger-seal {
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #9a6b3c;
}
[data-theme="dark"] .kakeibo-ledger-seal { color: #d4b07a; }
.kakeibo-ledger-head h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.kakeibo-ledger-date {
    font-weight: 700;
    font-size: 0.95rem;
    opacity: 0.85;
}
.kakeibo-ledger-table {
    position: relative;
    display: grid;
    gap: 0;
}
.kakeibo-ledger-section-label {
    margin: 12px 0 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9a6b3c;
    background: rgba(154, 107, 60, 0.08);
    border-radius: 6px;
}
[data-theme="dark"] .kakeibo-ledger-section-label {
    color: #d4b07a;
    background: rgba(212, 176, 122, 0.1);
}
.kakeibo-ledger-row {
    display: grid;
    grid-template-columns: 7.5em minmax(0, 1fr) auto;
    gap: 10px;
    align-items: baseline;
    padding: 9px 8px;
    border-bottom: 1px dashed rgba(140, 110, 70, 0.22);
    font-size: 0.9rem;
}
[data-theme="dark"] .kakeibo-ledger-row {
    border-bottom-color: rgba(196, 168, 120, 0.18);
}
.kakeibo-ledger-label { font-weight: 700; opacity: 0.8; }
.kakeibo-ledger-desc {
    min-width: 0;
    line-height: 1.4;
}
.kakeibo-ledger-desc small {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    opacity: 0.65;
}
.kakeibo-ledger-amt {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.kakeibo-ledger-amt.is-plus { color: #1f8a5b; }
.kakeibo-ledger-amt.is-minus { color: #c0455c; }
[data-theme="dark"] .kakeibo-ledger-amt.is-plus { color: #5ee0a0; }
[data-theme="dark"] .kakeibo-ledger-amt.is-minus { color: #ff8fa3; }
.kakeibo-ledger-row.is-carry {
    background: rgba(154, 107, 60, 0.07);
    border-radius: 8px;
    border-bottom: none;
    margin-bottom: 4px;
}
.kakeibo-ledger-row.is-empty-row { opacity: 0.55; font-style: italic; }
.kakeibo-ledger-row.is-subtotal {
    border-bottom-style: solid;
    border-bottom-color: rgba(140, 110, 70, 0.28);
}
.kakeibo-ledger-row.is-diff {
    background: rgba(124, 92, 196, 0.08);
    border-radius: 8px;
    border-bottom: none;
    margin-top: 6px;
}
.kakeibo-ledger-row.is-closing {
    margin-top: 6px;
    background: rgba(154, 107, 60, 0.12);
    border-radius: 8px;
    border-bottom: none;
    font-size: 0.98rem;
}
.kakeibo-reflect {
    margin-top: 8px;
    max-width: none;
}
.kakeibo-notebook {
    position: relative;
    border-radius: 18px;
    padding: 24px 22px 20px;
    background:
        repeating-linear-gradient(
            transparent,
            transparent 27px,
            rgba(140, 110, 70, 0.12) 28px
        ),
        linear-gradient(180deg, #fbf6ec 0%, #f3e8d4 100%);
    color: #3d3428;
    border: 1.5px solid rgba(140, 110, 70, 0.32);
    box-shadow:
        0 14px 36px rgba(70, 50, 30, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    overflow: hidden;
}
.kakeibo-notebook::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 28px;
    background:
        linear-gradient(90deg, rgba(180, 60, 60, 0.14), rgba(180, 60, 60, 0.05) 70%, transparent),
        repeating-linear-gradient(
            180deg,
            transparent 0 18px,
            rgba(120, 70, 40, 0.18) 18px 19px
        );
    border-right: 1px solid rgba(180, 60, 60, 0.28);
    pointer-events: none;
}
.kakeibo-notebook::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(140, 110, 70, 0.16);
    border-radius: 12px;
    pointer-events: none;
}
[data-theme="dark"] .kakeibo-notebook {
    background:
        repeating-linear-gradient(
            transparent,
            transparent 27px,
            rgba(196, 168, 120, 0.1) 28px
        ),
        linear-gradient(180deg, rgba(52, 42, 58, 0.98), rgba(38, 30, 46, 0.98));
    color: #efe6d8;
    border-color: rgba(196, 168, 120, 0.28);
    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .kakeibo-notebook::before {
    background:
        linear-gradient(90deg, rgba(212, 120, 120, 0.16), rgba(212, 120, 120, 0.04) 70%, transparent),
        repeating-linear-gradient(
            180deg,
            transparent 0 18px,
            rgba(196, 168, 120, 0.16) 18px 19px
        );
    border-right-color: rgba(212, 140, 140, 0.28);
}
[data-theme="dark"] .kakeibo-notebook::after {
    border-color: rgba(196, 168, 120, 0.14);
}
.kakeibo-notebook-head {
    position: relative;
    z-index: 1;
    margin: 0 0 18px 22px;
    padding-bottom: 12px;
    border-bottom: 1.5px double rgba(140, 110, 70, 0.35);
}
[data-theme="dark"] .kakeibo-notebook-head {
    border-bottom-color: rgba(196, 168, 120, 0.3);
}
.kakeibo-notebook-seal {
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #9a6b3c;
}
[data-theme="dark"] .kakeibo-notebook-seal { color: #d4b07a; }
.kakeibo-notebook-head h3 {
    margin: 0;
    font-size: clamp(1.15rem, 2.2vw, 1.4rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    color: inherit;
}
.kakeibo-notebook-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    margin-left: 22px;
}
.kakeibo-notebook-field { margin-bottom: 0; }
.kakeibo-notebook-field .form-label {
    color: inherit;
    opacity: 0.9;
    font-weight: 800;
}
.kakeibo-notebook-input {
    background: rgba(255, 252, 245, 0.72) !important;
    border: 1px solid rgba(140, 110, 70, 0.28) !important;
    color: #3d3428 !important;
    border-radius: 12px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
    min-height: 150px;
    line-height: 1.65;
    resize: vertical;
}
.kakeibo-notebook-input:focus {
    border-color: rgba(154, 107, 60, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(154, 107, 60, 0.15);
}
.kakeibo-notebook-input::placeholder { color: rgba(61, 52, 40, 0.45); }
[data-theme="dark"] .kakeibo-notebook-input {
    background: rgba(28, 22, 36, 0.55) !important;
    border-color: rgba(196, 168, 120, 0.25) !important;
    color: #efe6d8 !important;
}
[data-theme="dark"] .kakeibo-notebook-input::placeholder { color: rgba(239, 230, 216, 0.4); }
.kakeibo-notebook-actions {
    position: relative;
    z-index: 1;
    margin: 18px 0 0 22px;
}

@media (max-width: 1100px) {
    .kakeibo-workspace {
        grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
        gap: 14px;
    }
}
@media (max-width: 900px) {
    .kakeibo-workspace {
        grid-template-columns: 1fr;
    }
    .kakeibo-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .kakeibo-header h2 {
        font-size: clamp(1.2rem, 5vw, 1.5rem);
    }
    .kakeibo-month-nav {
        justify-content: space-between;
        width: 100%;
    }
    .kakeibo-lead {
        font-size: 0.9rem;
        margin-bottom: 16px;
    }
    .kakeibo-cal {
        order: 0;
    }
    .kakeibo-ledger {
        order: 1;
        min-width: 0;
    }
    .kakeibo-cal-mascot img {
        height: 120px;
    }
}
@media (max-width: 800px) {
    .kakeibo-notebook-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .kakeibo-page,
    .kakeibo-workspace,
    .kakeibo-reflect {
        width: 100%;
        max-width: 100%;
    }
    .kakeibo-cal {
        padding: 12px;
    }
    .kakeibo-cal-grid {
        gap: 3px;
    }
    .kakeibo-cal-wd {
        font-size: 0.62rem;
        padding: 2px 0;
    }
    .kakeibo-cal-cell {
        min-height: 36px;
        font-size: 0.78rem;
        border-radius: 8px;
    }
    .kakeibo-cal-mascot {
        margin-top: 12px;
        padding: 12px 8px 8px;
    }
    .kakeibo-cal-mascot img {
        height: 100px;
    }
    .kakeibo-cal-mascot-meta strong { font-size: 0.9rem; }
    .kakeibo-cal-mascot-meta span { font-size: 0.75rem; }
    .kakeibo-ledger-frame {
        padding: 16px 12px 12px;
        border-radius: 14px;
    }
    .kakeibo-ledger-frame::before {
        inset: 6px;
    }
    .kakeibo-ledger-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 12px;
    }
    .kakeibo-ledger-head h3 {
        font-size: 1.05rem;
    }
    .kakeibo-ledger-date {
        font-size: 0.85rem;
    }
    .kakeibo-ledger-row {
        grid-template-columns: 1fr;
        gap: 2px 8px;
        padding: 10px 6px;
    }
    .kakeibo-ledger-amt {
        text-align: left;
        font-size: 0.95rem;
    }
    .kakeibo-ledger-label {
        font-size: 0.8rem;
    }
    .kakeibo-notebook {
        padding: 16px 12px 14px;
        border-radius: 14px;
    }
    .kakeibo-notebook::before {
        width: 16px;
    }
    .kakeibo-notebook-head,
    .kakeibo-notebook-grid,
    .kakeibo-notebook-actions {
        margin-left: 10px;
    }
    .kakeibo-notebook-head h3 {
        font-size: 1.05rem;
        line-height: 1.35;
    }
    .kakeibo-notebook-input {
        min-height: 120px;
        font-size: 0.92rem;
    }
    .kakeibo-notebook-actions .btn {
        width: 100%;
    }
}
@media (max-width: 420px) {
    .kakeibo-cal-cell {
        min-height: 32px;
        font-size: 0.72rem;
    }
    .kakeibo-cal-mascot img {
        height: 88px;
    }
    .kakeibo-month-label {
        font-size: 0.95rem;
        min-width: 0;
        flex: 1;
    }
}
