/* ==========================================================================
   QUẢN LÝ CHI TIÊU - HELLO KITTY PASTEL MOBILE DESIGN SYSTEM
   Tối ưu hóa đặc biệt cho màn hình 360px - 430px (chuẩn iPhone 390 x 844px)
   Theme: Cute Hello Kitty Pastel (#FF8FB1 | #FFD6E3 | #FFF3F7 | #4A3B40)
   ========================================================================== */

:root {
    /* Hello Kitty Pastel Color Palette */
    --primary-brand: #FF8FB1;        /* Primary Pink */
    --primary-dark: #E0698B;         /* Deeper Pink */
    --primary-light: #FFD6E3;        /* Light Pink */
    --primary-very-light: #FFF3F7;   /* Very Light Pink */
    --primary-gradient: linear-gradient(135deg, #FF8FB1 0%, #FFB6C9 100%);
    --nav-gradient: linear-gradient(135deg, #FF8FB1 0%, #FFB6C9 100%);
    
    --income-green: #62C99D;         /* Success Pastel Green */
    --income-light: #E8F8F0;
    --expense-red: #FF6B81;          /* Expense Pastel Red/Pink */
    --expense-light: #FFF0F3;
    --warning-orange: #FFB347;
    --warning-light: #FFF8EB;
    
    --bg-page: #FFF3F7;
    --bg-card: #FFFFFF;
    --bg-subtle: #FFF3F7;
    --border-color: #F4CCD9;         /* Pastel Pink Border */
    --border-subtle: #F9DEE6;
    
    --text-primary: #4A3B40;         /* Soft Dark Cocoa */
    --text-secondary: #927A82;       /* Soft Muted Mauve */
    --text-muted: #B5A1A8;
    --text-white: #FFFFFF;
    
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 6px rgba(255, 143, 177, 0.12);
    --shadow-card: 0 4px 16px -2px rgba(255, 143, 177, 0.10), 0 2px 6px -1px rgba(74, 59, 64, 0.03);
    --shadow-float: 0 6px 18px rgba(255, 143, 177, 0.35);
    --shadow-modal: 0 -10px 40px rgba(74, 59, 64, 0.16);
    
    --nav-height: 68px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 12px);
}

[data-theme="dark"] {
    --bg-page: #23181C;
    --bg-card: #312328;
    --bg-subtle: #3D2C32;
    --border-color: #523D45;
    --border-subtle: rgba(82, 61, 69, 0.6);
    --text-primary: #FFF0F5;
    --text-secondary: #D4BDC5;
    --text-muted: #9F8A92;
    --primary-light: #4A2B35;
    --primary-very-light: #3D232C;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Be Vietnam Pro", "SF Pro Text", "Segoe UI", Roboto, Helvetica, sans-serif;
    touch-action: manipulation;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: #FDE8EF;
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   MOBILE APP CONTAINER (Full screen on mobile, Centered phone view on desktop)
   ========================================================================== */

.app-root {
    width: 100%;
    height: 100%;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-app-shell {
    width: 100%;
    max-width: 440px;
    height: 100%;
    height: 100dvh;
    background-color: var(--bg-page);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(255, 143, 177, 0.25);
}

/* Khi trên điện thoại thật hoặc mở dạng PWA Standalone: Chiếm trọn 100% */
@media (max-width: 600px), (display-mode: standalone) {
    body {
        background-color: var(--bg-page);
    }
    .mobile-app-shell {
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
    }
}

/* Safe area header padding on iOS */
.mobile-header-safe {
    width: 100%;
    height: var(--safe-top);
    background: transparent;
    flex-shrink: 0;
}

/* ==========================================================================
   SCROLLABLE MAIN CONTENT
   ========================================================================== */

.app-viewport {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* Đảm bảo nội dung cuối không bao giờ bị bottom navigation che */
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 26px);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.app-viewport::-webkit-scrollbar {
    display: none;
}

/* Screen Switcher */
.mobile-screen {
    display: none;
    padding: 16px 16px 20px 16px;
    animation: screenSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.mobile-screen.active {
    display: block;
}

@keyframes screenSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   FLOATING BOTTOM NAVIGATION (PASTEL GRADIENT, CUTE BOW & ROUND "+" BUTTON)
   ========================================================================== */

.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--nav-gradient);
    border-top-left-radius: 26px;
    border-top-right-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    box-shadow: 0 -4px 25px rgba(255, 143, 177, 0.35);
    user-select: none;
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
    background: none;
    border: none;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    gap: 3px;
    width: 62px;
    height: 52px;
    position: relative;
    transition: transform 0.15s ease, color 0.15s ease;
}

.nav-tab:active {
    transform: scale(0.92);
}

.nav-tab .tab-icon {
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.nav-tab.active {
    color: #FFFFFF;
    font-weight: 800;
}

.nav-tab.active .tab-icon {
    transform: scale(1.12);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 14px;
    height: 3px;
    background: #FFFFFF;
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.95);
}

/* Center Floating White "+" Button with Cute Hello Kitty Bow */
.nav-center-slot {
    position: relative;
    width: 58px;
    display: flex;
    justify-content: center;
}

/* Tiny Hello Kitty decorative bow floating above "+" */
.nav-center-slot::before {
    content: '🎀';
    position: absolute;
    top: -38px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    z-index: 120;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(255, 143, 177, 0.35));
}

.btn-center-add {
    position: absolute;
    top: -28px;
    width: 56px;
    height: 56px;
    background: #FFFFFF;
    border-radius: 50%;
    border: 3.5px solid var(--primary-brand);
    box-shadow: 0 6px 20px rgba(255, 143, 177, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-brand);
    font-size: 28px;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 110;
}

.btn-center-add:active {
    transform: scale(0.90);
    box-shadow: 0 2px 10px rgba(255, 143, 177, 0.35);
}

.btn-center-add svg {
    width: 26px;
    height: 26px;
    stroke-width: 3.2;
    stroke: var(--primary-brand);
}

/* ==========================================================================
   COMPONENTS: CUTE ROUNDED CARDS, BUTTONS & LISTS
   ========================================================================== */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-card);
    border: 1.5px solid var(--border-color);
    margin-bottom: 14px;
    position: relative;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

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

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-link {
    font-size: 13px;
    color: var(--primary-brand);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.section-link:active {
    opacity: 0.7;
}

/* Primary Cute Button: Nền hồng, chữ trắng, bo góc 18px, shadow hồng nhẹ */
.btn-primary {
    background: var(--primary-gradient);
    color: #FFFFFF;
    border: none;
    border-radius: 18px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 700;
    width: 100%;
    min-height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-float);
    transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.btn-primary:active {
    transform: scale(0.97);
    opacity: 0.94;
    background: linear-gradient(135deg, #F07E9F 0%, #FFA8BD 100%);
}

/* Secondary Cute Button: Nền trắng/hồng nhạt, border hồng, chữ hồng */
.btn-secondary {
    background: #FFF3F7;
    color: var(--primary-brand);
    border: 1.5px solid var(--primary-light);
    border-radius: 18px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    min-height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.12s ease, background 0.12s ease;
}

.btn-secondary:active {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: scale(0.97);
}

/* Segmented Control Tabs */
.segmented-tabs {
    display: flex;
    background: #FFF3F7;
    padding: 4px;
    border-radius: 18px;
    gap: 4px;
    margin-bottom: 14px;
    border: 1px solid var(--primary-light);
}

.segmented-tab {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    min-height: 38px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.segmented-tab.active {
    background: #FFFFFF;
    color: var(--primary-brand);
    border-color: var(--primary-brand);
    box-shadow: 0 3px 10px rgba(255, 143, 177, 0.22);
}

/* 4 Tabs Trên Màn Hình Thêm Giao Dịch: 🎀 Chi tiền | ♡ Thu tiền | ⇄ Chuyển | ♡ Vay nợ */
#sheetTxTypeTabs {
    gap: 3px;
    padding: 3px;
    background: #FFF3F7;
    border-radius: 18px;
    border: 1.5px solid var(--primary-light);
}

#sheetTxTypeTabs .segmented-tab {
    padding: 8px 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.2px;
    white-space: nowrap;
    border-radius: 14px;
}

#sheetTxTypeTabs .tab-cute-icon {
    font-size: 10px;
    line-height: 1;
}

#sheetTxTypeTabs .segmented-tab.active {
    background: #FFFFFF;
    color: var(--primary-brand);
    border: 1.5px solid var(--primary-brand);
    box-shadow: 0 2px 8px rgba(255, 143, 177, 0.25);
}

/* ==========================================================================
   SCREEN 1: TỔNG QUAN (OVERVIEW) & HELLO KITTY HEADER
   ========================================================================== */

.overview-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Cute Kitty + Bow Avatar */
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD6E3 0%, #FFF3F7 100%);
    border: 2px solid var(--primary-brand);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 12px rgba(255, 143, 177, 0.3);
    position: relative;
    user-select: none;
}

.user-welcome-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-welcome-sub {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 2px;
}

/* ==========================================================================
   8. CARD TỔNG TÀI SẢN (HELLO KITTY GRADIENT #FF8FB1 -> #FFB6C9)
   ========================================================================== */

.total-assets-card {
    background: linear-gradient(135deg, #FF8FB1 0%, #FFB6C9 100%);
    color: #FFFFFF;
    border-radius: 24px;
    padding: 20px 18px;
    box-shadow: 0 10px 28px -4px rgba(255, 143, 177, 0.42);
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Watermark chìm: Nơ chìm & trái tim Hello Kitty */
.total-assets-card::before {
    content: '🎀 ♡ 🐾 ♡ 🎀';
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 12px;
    opacity: 0.28;
    letter-spacing: 3px;
    pointer-events: none;
    user-select: none;
}

/* Radial light glow top-right */
.total-assets-card::after {
    content: '';
    position: absolute;
    width: 170px;
    height: 170px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 70%);
    top: -40px;
    right: -40px;
    border-radius: 50%;
    pointer-events: none;
}

.assets-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    position: relative;
    z-index: 2;
}

.assets-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 1px 2px rgba(180, 50, 90, 0.2);
}

.assets-amount {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(180, 50, 90, 0.25);
    position: relative;
    z-index: 2;
}

.month-flow-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 12px 14px;
    border-radius: 16px;
    backdrop-filter: blur(8px);
    position: relative;
    z-index: 2;
}

.flow-col {
    display: flex;
    flex-direction: column;
}

.flow-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.flow-value {
    font-size: 14px;
    font-weight: 800;
    color: #FFFFFF;
    text-shadow: 0 1px 2px rgba(180, 50, 90, 0.2);
}

.flow-col.income .flow-value {
    color: #FFFFFF;
}

.flow-col.expense .flow-value {
    color: #FFFFFF;
}

/* ==========================================================================
   9. TÀI KHOẢN / VÍ (CUTE PASTEL CARDS)
   ========================================================================== */

.my-wallets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.wallets-scroll-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 16px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.wallets-scroll-row::-webkit-scrollbar {
    display: none;
}

.wallet-mini-card {
    min-width: 142px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: 18px;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wallet-mini-card:active {
    transform: scale(0.96);
    box-shadow: 0 1px 4px rgba(255, 143, 177, 0.2);
}

.wallet-mini-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.wallet-mini-icon {
    font-size: 18px;
}

.wallet-mini-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wallet-mini-balance {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

/* ==========================================================================
   TRANSACTIONS LIST ITEMS
   ========================================================================== */

.tx-row {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    min-height: 58px;
    transition: transform 0.1s ease, background 0.15s ease;
}

.tx-row:active {
    background: #FFF3F7;
    transform: scale(0.985);
}

.tx-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

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

.tx-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-sub {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.tx-wallet-tag {
    background: #FFF3F7;
    border: 1px solid var(--primary-light);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--primary-dark);
}

.tx-amount {
    font-size: 15px;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.tx-amount.expense { color: var(--expense-red); }
.tx-amount.income { color: var(--income-green); }
.tx-amount.transfer { color: var(--primary-brand); }
.tx-amount.debt_borrow { color: var(--primary-brand); }
.tx-amount.debt_lend { color: #E08200; }
.tx-amount.debt_repay { color: var(--expense-red); }
.tx-amount.debt_collect { color: var(--income-green); }

/* ==========================================================================
   SCREEN: CHI TIẾT VÍ (WALLET DETAIL SCREEN)
   ========================================================================== */

.wallet-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.back-btn {
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-brand);
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    min-height: 44px;
}

.wallet-hero-card {
    background: var(--bg-card);
    border-radius: 22px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    border: 1.5px solid var(--border-color);
    text-align: center;
}

.wallet-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: #FFF3F7;
    border: 1.5px solid var(--primary-light);
}

.wallet-hero-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.wallet-hero-balance-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wallet-hero-balance {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-brand);
    margin: 4px 0 16px;
}

.wallet-hero-flow {
    display: flex;
    justify-content: space-around;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.wallet-hero-flow-item {
    display: flex;
    flex-direction: column;
}

.wallet-hero-flow-item .label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.wallet-hero-flow-item .val {
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
}

/* 3 Quick Action Buttons for Wallet: [ Thu ] [ Chi ] [ Chuyển ] */
.wallet-actions-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.wallet-action-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    padding: 12px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    min-height: 54px;
    transition: transform 0.1s ease, background 0.15s ease;
}

.wallet-action-btn:active {
    transform: scale(0.95);
    background: #FFF3F7;
}

.wallet-action-btn.income-btn { color: var(--income-green); }
.wallet-action-btn.expense-btn { color: var(--expense-red); }
.wallet-action-btn.transfer-btn { color: var(--primary-brand); }

/* ==========================================================================
   13. MOBILE BOTTOM SHEET (HELLO KITTY STYLE MODALS)
   ========================================================================== */

.mobile-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(74, 59, 64, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-sheet-backdrop.show {
    display: flex;
    opacity: 1;
}

.mobile-bottom-sheet {
    width: 100%;
    max-width: 440px;
    background: #FFFFFF;
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    border-top: 2px solid var(--primary-light);
    max-height: 92dvh;
    overflow-y: auto;
    padding: 16px 20px calc(24px + var(--safe-bottom));
    box-shadow: var(--shadow-modal);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-overflow-scrolling: touch;
}

.mobile-sheet-backdrop.show .mobile-bottom-sheet {
    transform: translateY(0);
}

.sheet-handle {
    width: 44px;
    height: 5px;
    background: var(--primary-light);
    border-radius: 99px;
    margin: 0 auto 14px;
}

.sheet-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.sheet-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sheet-close {
    background: #FFF3F7;
    border: 1px solid var(--primary-light);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: transform 0.1s ease, background 0.15s ease, color 0.15s ease;
}

.sheet-close:active {
    background: var(--primary-light);
    color: var(--primary-brand);
    transform: scale(0.92);
}

/* ==========================================================================
   5. Ô NHẬP SỐ TIỀN (BIG CUTE AMOUNT DISPLAY CARD)
   ========================================================================== */

.amount-display-box {
    background: #FFF3F7;
    border: 2px solid var(--primary-brand);
    border-radius: 20px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(255, 143, 177, 0.14);
}

.amount-display-box input {
    width: 80%;
    border: none;
    background: transparent;
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary);
    outline: none;
    caret-color: var(--primary-brand);
    font-family: inherit;
}

.amount-suffix {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-brand);
}

/* ==========================================================================
   4. NÚT SỐ TIỀN NHANH (CUTE PILLS)
   ========================================================================== */

.quick-amount-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.quick-amount-chips::-webkit-scrollbar {
    display: none;
}

.chip-btn {
    background: #FFF3F7;
    border: 1.5px solid var(--primary-light);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-brand);
    white-space: nowrap;
    cursor: pointer;
    min-height: 36px;
    transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}

.chip-btn:active {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-brand);
    transform: scale(0.96);
}

/* Form Controls */
.mobile-input-group {
    margin-bottom: 14px;
}

.mobile-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.mobile-input, .mobile-select {
    width: 100%;
    background: #FFF3F7;
    border: 1.5px solid var(--primary-light);
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 15px;
    color: var(--text-primary);
    outline: none;
    min-height: 48px;
    -webkit-appearance: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.mobile-input:focus, .mobile-select:focus {
    border-color: var(--primary-brand);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(255, 143, 177, 0.18);
}

/* ==========================================================================
   6. DANH MỤC (ROUNDED 16PX CUTE CARDS)
   ========================================================================== */

.category-mobile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
    margin-bottom: 14px;
    -webkit-overflow-scrolling: touch;
}

.category-chip-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 4px;
    border-radius: 16px;
    background: #FFFFFF;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.category-chip-item:active {
    transform: scale(0.96);
}

.category-chip-item.selected {
    background: #FFF0F5;
    border-color: var(--primary-brand);
    box-shadow: 0 4px 12px rgba(255, 143, 177, 0.22);
}

.category-chip-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.category-chip-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 68px;
}

/* Toast Floating Message */
.mobile-toast {
    position: fixed;
    top: calc(20px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    background: rgba(74, 59, 64, 0.95);
    color: #FFFFFF;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 25px rgba(255, 143, 177, 0.35);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--primary-light);
}

.mobile-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   10. VAY NỢ (LOANS & DEBTS) CUTE STYLING
   ========================================================================== */

/* Overview Debt Summary Strip */
.debt-overview-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    padding: 10px 14px;
    margin-top: 10px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.15s ease, transform 0.1s ease;
}

.debt-overview-strip:active {
    background: rgba(255, 255, 255, 0.32);
    transform: scale(0.985);
}

.debt-strip-col {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.debt-strip-col .strip-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2px;
}

.debt-strip-col .strip-val {
    font-size: 13px;
    font-weight: 800;
    color: #FFFFFF;
}

.debt-strip-col .strip-val.income { color: #FFFFFF; }
.debt-strip-col .strip-val.expense { color: #FFFFFF; }

.debt-strip-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 12px;
}

.debt-strip-arrow {
    color: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    margin-left: 6px;
    font-weight: 700;
}

/* Debt Type Switcher: [ ĐI VAY ] [ CHO VAY ] 2 CUTE CARDS */
.debt-type-switch {
    display: flex;
    background: #FFF3F7;
    border-radius: 18px;
    padding: 4px;
    gap: 6px;
    margin-bottom: 14px;
    border: 1.5px solid var(--primary-light);
}

.debt-type-btn {
    flex: 1;
    border: 1.5px solid transparent;
    background: transparent;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.debt-type-btn.active[data-debttype="borrow"] {
    background: #FFFFFF;
    color: var(--primary-brand);
    border-color: var(--primary-brand);
    box-shadow: 0 3px 10px rgba(255, 143, 177, 0.25);
}

.debt-type-btn.active[data-debttype="lend"] {
    background: #FFFFFF;
    color: #0F6B47;
    border-color: var(--income-green);
    box-shadow: 0 3px 10px rgba(98, 201, 157, 0.25);
}

[data-theme="dark"] .debt-type-btn.active[data-debttype="borrow"] {
    background: var(--bg-card);
    color: var(--primary-brand);
}

[data-theme="dark"] .debt-type-btn.active[data-debttype="lend"] {
    background: var(--bg-card);
    color: var(--income-green);
}

/* Debt Management Box & Summary */
.debt-management-box {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1.5px dashed var(--border-color);
}

.debt-mgmt-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.debt-mgmt-heading {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.debt-badge-count {
    font-size: 11px;
    font-weight: 700;
    background: #FFF3F7;
    color: var(--primary-dark);
    padding: 3px 10px;
    border-radius: 99px;
    border: 1px solid var(--primary-light);
}

.debt-stat-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.debt-stat-card {
    border-radius: 18px;
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    border: 1.5px solid var(--border-color);
}

/* Nợ phải thu: Pastel Green */
.debt-stat-card.receivable {
    border-color: var(--income-green);
    background: #E8F8F0;
}

/* Nợ phải trả: Pastel Pink/Red */
.debt-stat-card.payable {
    border-color: var(--primary-brand);
    background: #FFF0F3;
}

.debt-card-top {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.debt-arrow-icon {
    font-size: 14px;
}

.debt-card-name {
    font-size: 11px;
    font-weight: 700;
}

.debt-stat-card.receivable .debt-card-name { color: #0F6B47; }
.debt-stat-card.payable .debt-card-name { color: #9E2A43; }

.debt-card-val {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 2px;
}

.debt-stat-card.receivable .debt-card-val { color: #0F6B47; }
.debt-stat-card.payable .debt-card-val { color: #FF6B81; }

.debt-card-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Debt Card Item in List */
.debt-card-item {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease;
}

.debt-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.debt-person-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.debt-status-tag {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
}

/* Trạng thái: Đã thanh toán -> Green | Còn nợ -> Pink | Quá hạn -> Red */
.debt-status-tag.active-rec { background: #E8F8F0; color: #0F6B47; border: 1px solid #A7F3D0; }
.debt-status-tag.active-pay { background: #FFF0F5; color: #C5223D; border: 1px solid #FFD6E3; }
.debt-status-tag.completed { background: #F1F5F9; color: #64748B; border: 1px solid #E2E8F0; }

[data-theme="dark"] .debt-status-tag.active-rec { background: rgba(98, 201, 157, 0.2); color: #62C99D; }
[data-theme="dark"] .debt-status-tag.active-pay { background: rgba(255, 107, 129, 0.2); color: #FF6B81; }
[data-theme="dark"] .debt-status-tag.completed { background: rgba(148, 163, 184, 0.2); color: #CBD5E1; }

.debt-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 4px;
}

.debt-item-lbl {
    color: var(--text-secondary);
    font-size: 12px;
}

.debt-item-val {
    font-weight: 700;
    color: var(--text-primary);
}

.debt-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
}

.btn-debt-action {
    padding: 8px 16px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.1s ease;
}

.btn-debt-action:active {
    transform: scale(0.95);
}

.btn-debt-action.btn-collect {
    background: var(--income-green);
    color: #FFFFFF;
    box-shadow: 0 3px 10px rgba(98, 201, 157, 0.35);
}

.btn-debt-action.btn-repay {
    background: var(--primary-gradient);
    color: #FFFFFF;
    box-shadow: 0 3px 10px rgba(255, 143, 177, 0.35);
}

.btn-debt-delete {
    background: #FFF3F7;
    border: 1px solid var(--primary-light);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 10px;
    transition: all 0.15s ease;
}

.btn-debt-delete:hover, .btn-debt-delete:active {
    color: var(--expense-red);
    background: #FFF0F3;
    border-color: #FFB8C6;
}

/* ==========================================================================
   16. MOBILE RESPONSIVENESS & BREAKPOINTS (360px - 430px)
   ========================================================================== */

@media (max-width: 375px) {
    #sheetTxTypeTabs .segmented-tab {
        font-size: 10px;
        padding: 6px 1px;
        gap: 2px;
    }
    #sheetTxTypeTabs .tab-cute-icon {
        font-size: 9px;
    }
    .total-assets-card {
        padding: 16px 14px;
        border-radius: 20px;
    }
    .assets-amount {
        font-size: 26px;
    }
    .amount-display-box input {
        font-size: 25px;
    }
    .amount-suffix {
        font-size: 20px;
    }
    .chip-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

@media (min-width: 376px) and (max-width: 414px) {
    #sheetTxTypeTabs .segmented-tab {
        font-size: 11px;
        padding: 8px 2px;
    }
}

@media (min-width: 415px) {
    #sheetTxTypeTabs .segmented-tab {
        font-size: 11.5px;
        padding: 8px 4px;
    }
}
