/* ==============================
   Finance Lite — Finmap Style Design System
   ============================== */

:root {
    /* Finmap-inspired palette */
    --bg-main: #f5f6fa;
    --bg-side: #ffffff;
    --bg-card: #ffffff;
    --hdr-bg: #1a1d26;
    --border: #e8eaef;
    --border-light: #f0f1f5;

    /* Text */
    --text-primary: #1a1d26;
    --text-secondary: #5a5f72;
    --text-muted: #9ca3b4;
    --text-white: #ffffff;

    /* Accents — Finmap green */
    --accent: #00c853;
    --accent-hover: #00b548;
    --accent-light: #e8f9ef;

    /* Semantic */
    --color-income: #00c853;
    --color-income-bg: #e8f9ef;
    --color-expense: #ff3d57;
    --color-expense-bg: #fff0f2;
    --color-transfer: #5c6bc0;
    --color-transfer-bg: #eef0ff;

    /* Sizing */
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.10);
    --transition: 0.2s ease;

    --sidebar-width: 360px;
    /* Increased from 300px */
    --header-height: 56px;
}

/* ==============================
   BASE
   ============================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
}

/* ==============================
   HEADER
   ============================== */
.hdr {
    height: var(--header-height);
    background: var(--hdr-bg);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 200;
    gap: 16px;
}

.hdr-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hdr-center {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.hdr-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.logo-text {
    display: flex;
    align-items: baseline;
    gap: 0;
}

.l-white {
    color: white;
}

.l-green {
    color: var(--accent);
}

.l-lite {
    font-size: 0.7em;
    font-weight: 600;
    color: var(--text-muted);
    /* Grey */
    margin-left: 2px;
    position: relative;
    top: -6px;
    /* Superscript effect */
}

/* Telegram Icon styling */
.icon-telegram {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url('../img/telegram.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    transition: var(--transition);
    opacity: 0.9;
    flex-shrink: 0;
}

.icon-telegram:hover {
    opacity: 1;
    transform: scale(1.1);
}

.btn-top {
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    color: white;
    white-space: nowrap;
}

.btn-inc {
    background: var(--color-income) !important;
    color: white;
}

.btn-inc:hover {
    background: #00b548 !important;
    transform: translateY(-1px);
}

.btn-exp {
    background: var(--color-expense) !important;
    color: white;
}

.btn-exp:hover {
    background: #e62e4a !important;
    transform: translateY(-1px);
}

.btn-trs {
    background: var(--color-transfer);
}

.btn-trs:hover {
    background: #4a5ab0;
    transform: translateY(-1px);
}

.user-name {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ==============================
   LAYOUT
   ============================== */
.wrap {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

/* ==============================
   SIDEBAR
   ============================== */
.side {
    width: var(--sidebar-width);
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    overflow-y: auto;
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
}

.side-section {
    margin-bottom: 28px;
}

.side-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.side-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.total-balance {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.scheduled-summary {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-icon-sm {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon-sm:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* User Dropdown Modern */
.user-menu {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-right: 8px;
}

.user-name {
    font-weight: 600;
    color: white;
    /* Fix: Ensure visible on dark header */
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
    user-select: none;
}

.user-name:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-name::after {
    content: '▼';
    font-size: 0.6em;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 1px;
}

.user-name.no-dropdown::after {
    display: none;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% - 10px);
    /* Overlap slightly to catch hover */
    right: 0;
    padding-top: 10px;
    /* Gap filler */
    z-index: 1000;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown-content {
    background: white;
    min-width: 260px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    overflow: hidden;
    padding: 6px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

.dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: normal;
    /* Reset button line-height */
}

.dropdown-item span {
    position: relative;
    top: 1px;
    /* Subtle pixel-perfect adjustment */
}

.dropdown-item:hover {
    background: var(--bg-main);
    color: var(--accent);
}

/* Icon style (Gray lines, like password eye) */
.menu-icon {
    width: 16px;
    height: 16px;
    color: #94a3b8;
    flex-shrink: 0;
    transition: color 0.2s;
    margin-top: -2px;
    /* Pull icon up slightly to center heavily */
}

.dropdown-item:hover .menu-icon {
    color: var(--accent);
}

/* Sidebar Tree Modern */
.sidebar-tree {
    display: flex;
    flex-direction: column;
    gap: 12px;
}



.project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    color: var(--text-secondary);
}

.project-header:hover {
    background: rgba(255, 255, 255, 0.05);
    /* very subtle on dark bg? Wait sidebar is light */
    background: #f1f5f9;
    color: var(--text-primary);
}

.project-header.active {
    background: #e2e8f0;
    color: var(--text-primary);
    font-weight: 600;
}

.project-left {
    display: flex;
    align-items: center;
    gap: 2px;
}

.btn-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 4px;
}

.btn-toggle:hover {
    background: #cbd5e1;
    color: #475569;
}

.project-name-text {
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 4px;
}

.project-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-balance {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

.btn-edit-mini {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #cbd5e1;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.btn-edit-mini:hover {
    color: var(--text-primary);
    background: #e2e8f0;
}

.project-accounts {
    display: none;
    flex-direction: column;
    margin-top: 4px;
    padding-left: 12px;
    /* Indent */
    position: relative;
}

/* Vertical line for indentation */
.project-accounts::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 0;
    bottom: 10px;
    width: 1px;
    background: #e2e8f0;
}

.project-accounts.open {
    display: flex;
}

/* Account Row */
.tree-acc {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid transparent;
}

.tree-acc:hover {
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tree-acc.active {
    background: white;
    border-color: var(--accent);
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.15);
}

.tree-acc-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-acc-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.tree-acc-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tree-acc.active .tree-acc-name {
    color: var(--text-primary);
    font-weight: 600;
}

.tree-acc-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tree-acc-bal {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.tree-acc.active .tree-acc-bal {
    color: var(--accent);
    font-weight: 700;
}

.mt-2 {
    margin-top: 16px;
}

.empty-accounts {
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 4px 0 4px 16px;
    font-style: italic;
}

.acc-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

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

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

.acc-bal {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 1px;
}

.acc-actions {
    display: none;
    gap: 2px;
}

.acc-card:hover .acc-actions {
    display: flex;
}

.acc-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.acc-card-all {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1.5px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.acc-card-all:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.acc-card-all.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* ==============================
   MAIN CONTENT
   ============================== */
.main {
    flex: 1;
    padding: 24px 32px;
    min-width: 0;
}

/* NAVIGATION TABS */
.nav-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    width: fit-content;
}

.nav-tab {
    padding: 8px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: inherit;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-main);
}

.nav-tab.active {
    background: var(--hdr-bg);
    color: white;
}

/* TAB CONTENT */
.tab-content {
    display: none;
}

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

.tab-title {
    font-size: 15px;
    font-weight: 700;
}

/* TOOLBAR */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-select,
.filter-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.filter-select:focus,
.filter-input:focus {
    border-color: var(--accent);
}

#filter-search {
    width: 220px;
}

.tx-count {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-action {
    padding: 8px 16px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Reset generic .btn-icon styles when inside .btn-action */
.btn-action .btn-icon {
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.1em;
}

.btn-action:hover {
    background: var(--accent-hover);
}

/* TABLE */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.tbl {
    width: 100%;
    border-collapse: collapse;
}

.tbl-tx th,
.tbl-tx td {
    width: auto;
}

.tbl th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    white-space: nowrap;
}

.tbl td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.tbl tr:last-child td {
    border-bottom: none;
}

.tbl tbody tr {
    transition: var(--transition);
}

.tbl tbody tr:hover td {
    background: #fafbfc;
}

.th-actions {
    width: 80px;
}

.empty-row {
    text-align: center;
    padding: 40px 16px !important;
    color: var(--text-muted);
    font-size: 13px;
}

/* Transaction styles */
.tx-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tx-type-badge.income {
    background: var(--color-income-bg);
    color: var(--color-income);
}

.tx-type-badge.expense {
    background: var(--color-expense-bg);
    color: var(--color-expense);
}

.tx-type-badge.transfer {
    background: var(--color-transfer-bg);
    color: var(--color-transfer);
}

.tx-amount {
    font-weight: 700;
    font-size: 13px;
}

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

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

.tx-amount.transfer {
    color: var(--color-transfer);
}

.tx-account span {
    white-space: nowrap;
}

.tx-account-arrow {
    color: var(--text-muted);
    margin: 0 2px;
}

/* UTILS */
.hide {
    display: none !important;
}

/* Row action buttons */
.row-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.tbl tbody tr:hover .row-actions {
    opacity: 1;
}

.row-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.row-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.row-btn.danger:hover {
    border-color: var(--color-expense);
    color: var(--color-expense);
}

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

/* COUNTERPARTY DETAILS */
.cp-details-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.cp-summary-item {
    background: white;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.cp-summary-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.cp-summary-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.cp-summary-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* CATEGORIES */
.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.cat-column {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.cat-col-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

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

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

.cat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.cat-item:hover {
    background: var(--bg-main);
}

.cat-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.cat-item-icon {
    font-size: 16px;
}

.cat-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.cat-item-edit,
.cat-item-del {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-item:hover .cat-item-edit,
.cat-item:hover .cat-item-del {
    opacity: 1;
}

.cat-item-edit:hover {
    color: var(--accent);
    background: rgba(46, 204, 113, 0.1);
}

.cat-item-del:hover {
    color: var(--color-expense);
    background: var(--color-expense-bg);
}

/* PAGINATION */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: inherit;
    transition: var(--transition);
}

.page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.active {
    background: var(--hdr-bg);
    color: white;
    border-color: var(--hdr-bg);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ==============================
   MODALS
   ============================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

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

/* Nested modals (edit project/account/category) must appear above settings modal */
#modal-project,
#modal-account,
#modal-cat {
    z-index: 1100;
}

.modal-window {
    background: white;
    width: 100%;
    max-width: 520px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.25s;
}

/* Allow picker dropdowns to overflow the transaction modal */
#modal-tx .modal-window {
    overflow: visible;
}

#modal-tx .modal-header {
    border-radius: 16px 16px 0 0;
}

#modal-tx .modal-footer {
    border-radius: 0 0 16px 16px;
}

.modal-sm {
    max-width: 440px;
}

.modal-xs {
    max-width: 380px;
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    background: #fafbfc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Type Switcher */
.type-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-main);
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.sw-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.sw-btn.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Form Elements */
.f-group {
    margin-bottom: 16px;
}

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

/* .f-half removed */

.f-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.f-input {
    width: 100%;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.f-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.08);
}

.f-input-lg {
    font-size: 1.4rem;
    font-weight: 800;
    padding: 14px 12px;
}

.f-input-color {
    padding: 4px;
    height: 42px;
    cursor: pointer;
}

select.f-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239ca3b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ===== PICKER COMPONENT ===== */
.picker-wrap {
    position: relative;
}

.picker-btn {
    width: 100%;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 32px 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.picker-btn::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 8px;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239ca3b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
}

.picker-btn:hover {
    border-color: var(--accent);
}

.picker-btn.open {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.08);
}

.picker-btn .picker-placeholder {
    color: var(--text-muted);
}

.picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1200;
    flex-direction: column;
}

.picker-dropdown.open {
    display: flex;
}

.picker-search {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.picker-search input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

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

.picker-list {
    overflow-y: auto;
    flex: 1;
    max-height: 170px;
}

.picker-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.picker-item:hover {
    background: var(--bg-hover);
}

.picker-item.selected {
    background: rgba(0, 200, 83, 0.08);
    font-weight: 600;
}

.picker-item .picker-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.picker-item .picker-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.picker-item .picker-item-sub {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.picker-create {
    border-top: 1px solid var(--border);
    padding: 6px 10px;
    flex-shrink: 0;
}

.picker-create-btn {
    width: 100%;
    background: transparent;
    border: 1.5px dashed var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.picker-create-btn:hover {
    background: rgba(0, 200, 83, 0.06);
    border-color: var(--accent);
}

.picker-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Inline create form inside picker */
.picker-inline-form {
    display: none;
    border-top: 1px solid var(--border);
    padding: 8px 10px;
    gap: 6px;
    flex-shrink: 0;
    flex-direction: column;
}

.picker-inline-form.open {
    display: flex;
}

.picker-inline-form input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.picker-inline-form input:focus {
    border-color: var(--accent);
}

.picker-inline-form button {
    background: var(--accent);
    border: none;
    border-radius: 6px;
    color: white;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

/* Buttons */
.btn-save {
    background: var(--accent);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-save:hover {
    background: var(--accent-hover);
}

.btn-cancel {
    background: white;
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    font-family: inherit;
}

.btn-cancel:hover {
    background: var(--bg-main);
}

.btn-delete {
    background: var(--color-expense);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-delete:hover {
    background: #e62e4a;
}

.btn-confirm-green {
    background: var(--color-income);
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-confirm-green:hover {
    background: #00b548;
}

.confirm-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==============================
   TOAST NOTIFICATIONS
   ============================== */
.toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s;
    cursor: pointer;
    max-width: 360px;
}

.toast.success {
    background: var(--color-income);
}

.toast.error {
    background: var(--color-expense);
}

.toast.info {
    background: var(--color-transfer);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

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

/* ==============================
   PROJECT SETTINGS MODAL
   ============================== */
.modal-lg {
    max-width: 720px;
}

.ps-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 300px;
}

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

.ps-section-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.btn-add-sm {
    padding: 4px 12px;
    font-size: 12px;
    background: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-add-sm:hover {
    background: #27ae60;
}

.ps-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ps-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 8px;
}

.ps-item:hover {
    background: #eef1f5;
}

.ps-item.active {
    background: #e8f5e9;
    border: 1px solid #2ecc71;
}

.ps-item-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.ps-item-info {
    font-size: 11px;
    color: #999;
    margin-right: 8px;
}

.ps-item-actions {
    display: flex;
    gap: 4px;
}

.ps-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    background: transparent;
}

.ps-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.ps-btn-delete:hover {
    background: #ffebee;
    color: #e74c3c;
}

.ps-empty {
    padding: 30px;
    text-align: center;
    color: #aaa;
    font-size: 13px;
}

.ps-acc-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* ==============================
   FAB (Floating Action Buttons)
   ============================== */
.fab-group {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 100;
    flex-direction: column;
    gap: 12px;
}

.fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.fab:active {
    transform: scale(0.92);
}

.fab-income {
    background: #2ecc71;
}

.fab-expense {
    background: #e74c3c;
}

.fab-transfer {
    background: #3498db;
}

/* ==============================
   MOBILE SLIDE-OUT SIDEBAR
   ============================== */
.mobile-accounts {
    display: none;
}

.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 200;
}

.mobile-sidebar-overlay.open {
    display: block;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 201;
    transition: left 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
}

.mobile-sidebar.open {
    left: 0;
}

.mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #eee;
    background: #fafbfc;
    position: sticky;
    top: 0;
    z-index: 1;
}

.mobile-sidebar-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.mobile-sidebar-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-sidebar-close:hover {
    background: #f0f0f0;
}

.mobile-sidebar-body {
    padding: 12px;
    flex: 1;
}

.mobile-sidebar-footer {
    border-top: 1px solid #eee;
    padding: 12px;
    background: #fafbfc;
}

.mob-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 8px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
}

.mob-menu-item:hover {
    background: #f0f0f0;
}

.mob-menu-item.danger {
    color: #e74c3c;
}

.mob-project-group {
    margin-bottom: 16px;
}

.mob-project-name {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 8px 6px;
}

.mob-acc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.mob-acc-item:hover {
    background: #f5f5f5;
}

.mob-acc-item.active {
    background: #e8f5e9;
}

.mob-acc-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.mob-acc-info {
    flex: 1;
    min-width: 0;
}

.mob-acc-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mob-acc-bal {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.mob-total {
    padding: 12px;
    margin: 0 4px 12px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
}

.mob-total-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mob-total-amount {
    font-size: 1.3rem;
    font-weight: 800;
    color: #333;
    margin-top: 2px;
}

/* Toggle button for mobile sidebar */
.btn-mob-sidebar {
    display: none;
    width: 42px;
    height: 42px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    font-size: 28px;
    cursor: pointer;
    border-radius: 8px;
    color: #fff;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==============================
   ONBOARDING
   ============================== */
.onboarding-box {
    text-align: center;
    padding: 40px 20px;
}

.onboarding-box h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.onboarding-box p {
    color: #999;
    font-size: 13px;
    margin-bottom: 16px;
}

.btn-onboarding {
    padding: 10px 24px;
    background: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-onboarding:hover {
    background: #27ae60;
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 1024px) {
    .side {
        width: 220px;
    }

    .main {
        padding: 20px;
    }
}

@media (max-width: 768px) {

    /* HEADER */
    .hdr {
        padding: 0 12px;
        gap: 8px;
    }

    /* Hide desktop action buttons on mobile */
    .hdr-center {
        display: none;
    }

    .btn-top {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* SIDEBAR — hide on mobile */
    .side {
        display: none;
    }

    /* Show mobile sidebar toggle */
    .btn-mob-sidebar {
        display: flex;
    }

    /* Show FABs */
    .fab-group {
        display: flex;
    }

    .main {
        padding: 16px;
    }

    /* NAV TABS */
    .nav-tabs {
        overflow-x: auto;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tab {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 12px;
    }

    /* TOOLBAR */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .toolbar-left {
        flex-wrap: wrap;
    }

    .toolbar-right {
        justify-content: flex-end;
    }

    .filter-select,
    .filter-input {
        flex: 1;
        min-width: 0;
    }

    /* TABLE scroll container */
    .card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tbl {
        min-width: 700px;
    }

    .tbl th,
    .tbl td {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* CATEGORIES */
    .categories-grid {
        grid-template-columns: 1fr;
    }

    /* FORMS */
    .f-row {
        grid-template-columns: 1fr;
    }

    /* MODALS — mobile scrollable */
    .modal-overlay {
        align-items: flex-start;
        padding: 8px;
    }

    .modal-window {
        max-width: 100%;
        max-height: calc(100vh - 16px);
        overflow-y: auto;
        margin: 0;
        border-radius: 12px;
    }

    .modal-sm {
        max-width: calc(100% - 16px);
    }

    .modal-xs {
        max-width: calc(100% - 16px);
    }

    .modal-lg {
        max-width: calc(100% - 16px);
    }

    /* Project Settings — stack on mobile */
    .ps-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }
}

@media (max-width: 480px) {

    /* Extra compact header */
    .hdr {
        padding: 0 8px;
        height: 50px;
    }

    .logo {
        font-size: 1rem;
    }

    .btn-top {
        padding: 5px 8px;
        font-size: 11px;
        gap: 3px;
    }

    .user-name {
        display: none;
    }

    .main {
        padding: 12px 8px;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }

    .page-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ==============================
   Password Toggle
   ============================== */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .f-input {
    padding-right: 80px;
    /* Space for 2 buttons */
}

.toggle-password-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #94a3b8;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.generate-password-btn {
    position: absolute;
    right: 44px;
    /* Left of toggle button (12 + 24 + 8 gap) */
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #94a3b8;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    transition: color 0.2s;
}

.generate-password-btn:hover {
    color: #10b981;
    /* Green hover for formatting action */
}

.toggle-password-btn:hover {
    color: #64748b;
}

/* ==============================
   Header Wallets Button
   ============================== */
.btn-wallets {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 12px;
    line-height: 1;
    /* Fix selection height and vertical alignment */
}

.btn-wallets:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-wallets svg {
    fill: none;
    flex-shrink: 0;
    display: block;
}



/* ==============================
   Wallets Page — Card Grid
   ============================== */
.wallets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    padding: 4px 0;
}

.wallets-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.wallets-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.wallets-empty h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.wallets-empty p {
    font-size: 14px;
    margin-bottom: 20px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

.wallet-card {
    background: white;
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.wallet-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.wallet-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 12px;
}

.wallet-card-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.wallet-card-icon {
    font-size: 24px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.wallet-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.wallet-card-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.wallet-card-balance-block {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.wallet-card-balance {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
}

.wallet-card-toggle {
    padding: 8px 20px 12px;
    cursor: pointer;
    user-select: none;
}

.wallet-card-toggle span {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    transition: color 0.15s;
}

.wallet-card-toggle:hover span {
    color: var(--primary-hover);
}

.wallet-card-accounts {
    display: none;
    border-top: 1px solid var(--border);
}

.wallet-card-accounts.open {
    display: block;
}

.wallet-card-acc {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.wallet-card-acc:last-child {
    border-bottom: none;
}

.wallet-card-acc:hover {
    background: var(--bg-main, #f9fafb);
}

.wallet-card-acc-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.wallet-card-acc-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.wallet-card-acc-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.wallet-card-acc-project {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.wallet-card-acc-balance {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.wallet-card-acc-empty {
    padding: 16px 20px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

@media (max-width: 600px) {
    .btn-wallets-label {
        display: none;
    }

    .btn-wallets {
        padding: 7px 10px;
        margin-right: 8px;
    }

    .wallets-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* ==============================
   Analytics
   ============================== */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-card h4 {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 16px;
    text-align: center;
}

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    /* Ensure labels aren't clipped if they go outside canvas area (Chart.js usually handles this within canvas, but padding is needed) */
}

/* Force visibility fixes */
.analytics-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    min-height: 400px;
    position: relative;
    z-index: 5;
}

.chart-card {
    background: white;
    border-radius: 12px;
    /* var(--radius-lg) hardcoded for safety */
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    /* var(--shadow-sm) */
    display: flex !important;
    flex-direction: column;
    align-items: center;
    min-height: 300px;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* RESPONSIVE QUERIES MUST BE AT ROOT LEVEL */
@media (max-width: 900px) {
    .analytics-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 600px) {

    /* Hide button text on mobile */
    .btn-action .btn-text {
        display: none;
    }

    /* Make button icon-only */
    .btn-action {
        padding: 0;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }

    .btn-action .btn-icon {
        font-size: 1.2rem;
        font-weight: 700;
        line-height: 1;
    }

    /* Also override btn-top if used */
    .btn-top {
        padding: 0;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Chart Details List */
.chart-details {
    width: 100%;
    margin-top: 20px;
    border-top: 1px solid #f3f4f6;
    padding-top: 15px;
    max-height: 220px;
    overflow-y: auto;
}

.chart-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px dashed #f3f4f6;
}

.chart-detail-item:last-child {
    border-bottom: none;
}

.chart-detail-left {
    display: flex;
    align-items: center;
}

.chart-detail-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

/* Radio Card for Feedback */
.radio-card {
    cursor: pointer;
    position: relative;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card .card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.radio-card input:checked+.card-content {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.radio-card:hover .card-content {
    background: #f0f0f0;
}

.chart-detail-amount {
    font-weight: 500;
}