/* 
 * CashBook PC - Style System
 * 100% Custom Vanilla CSS for Desktop Ergonomics
 */

/* Google Fonts Import & Globals */
:root {
    /* Font Families */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-heading: 'Outfit', var(--font-primary);

    /* HSL Tailored Dark Theme Palette (Default) */
    --bg-main: #090d16;
    --bg-sidebar: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --border-color: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    
    --success-color: #10b981;
    --success-hover: #059669;
    --success-bg-subtle: rgba(16, 185, 129, 0.1);
    
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg-subtle: rgba(239, 68, 68, 0.1);
    
    --accent-color: #8b5cf6;
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-lg: 16px;
    --border-radius-md: 8px;
    --border-radius-sm: 4px;
}

/* Light Theme Variables */
body.light-theme {
    --bg-main: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --border-color: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    
    --success-color: #10b981;
    --success-hover: #059669;
    --success-bg-subtle: rgba(16, 185, 129, 0.08);
    
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg-subtle: rgba(239, 68, 68, 0.08);
    
    --card-shadow: 0 4px 18px -3px rgba(15, 23, 42, 0.08);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* App Container Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    z-index: 10;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-header {
    margin-bottom: 24px;
}

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

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-badge {
    font-size: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
}

/* Sidebar Navigation Tab Items */
.sidebar-navigation {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: left;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.light-theme .nav-btn:hover {
    background-color: #f1f5f9;
}

.nav-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0 20px 0;
}

.sidebar-section {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.section-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
    margin-bottom: 8px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Sidebar Summary Box for Contacts */
.sidebar-summary-box {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

body.light-theme .sidebar-summary-box {
    background-color: #f8fafc;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

/* Sidebar Books List */
.books-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.book-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    color: var(--text-secondary);
}

.book-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.light-theme .book-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.book-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-color: rgba(59, 130, 246, 0.2);
    font-weight: 600;
}

.book-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-item i {
    font-size: 0.9rem;
}

.book-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.book-item:hover .book-item-actions {
    opacity: 1;
}

.book-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    transition: var(--transition-smooth);
}

.book-action-btn:hover {
    color: var(--text-primary);
}

.book-action-btn.delete-btn-hover:hover {
    color: var(--danger-color);
}

/* Sidebar configuration buttons */
.sidebar-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--border-radius-md);
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
    text-align: left;
}

.sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-primary);
    transform: translateX(2px);
}

body.light-theme .sidebar-btn:hover {
    background-color: #f8fafc;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: var(--border-radius-md);
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition-smooth);
}

body.light-theme .theme-toggle-btn {
    background-color: #f8fafc;
}

.theme-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

body.light-theme .theme-toggle-btn:hover {
    background-color: #f1f5f9;
}

.app-version {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

/* Main Workspace */
.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--bg-main) 0%, rgba(15, 23, 42, 0.3) 100%);
    position: relative;
}

.view-panel {
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: 100%;
}

/* Header Section */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.book-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.export-actions, .transaction-actions {
    display: flex;
    gap: 8px;
}

/* Button Classes */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    outline: none;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-secondary {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

body.light-theme .btn-secondary:hover {
    background-color: #f1f5f9;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-hover);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.btn-text:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.btn-text-danger:hover {
    color: var(--danger-hover);
}

.btn-text-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

.btn-text-icon:hover {
    color: var(--text-primary);
}

.icon-btn-small {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.icon-btn-small:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.flex-1 {
    flex: 1;
}

/* Bento Stats Dashboard Grid */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.5);
}

body.light-theme .stat-card:hover {
    box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.06);
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: var(--font-heading);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.stat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Colors & Highlights for Bento Cards */
.stat-cash-in .stat-icon {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}
.stat-cash-in .stat-value {
    color: var(--success-color);
}

.stat-cash-out .stat-icon {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}
.stat-cash-out .stat-value {
    color: var(--danger-color);
}

.stat-balance .stat-icon {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
}
.stat-balance.negative-balance .stat-value {
    color: var(--danger-color);
}
.stat-balance.positive-balance .stat-value {
    color: var(--primary-color);
}

.badge-positive {
    background-color: var(--success-bg-subtle);
    color: var(--success-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-negative {
    background-color: var(--danger-bg-subtle);
    color: var(--danger-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Middle Analytics & Filters Section */
.analytics-filters-container {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr;
    gap: 20px;
}

.analytics-card, .filters-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px 24px;
    box-shadow: var(--card-shadow);
}

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

.card-header-simple h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.text-muted {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chart-wrapper {
    height: 120px;
    position: relative;
    display: flex;
    align-items: flex-end;
}

/* Filters Component */
.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.filters-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.col-span-2 {
    grid-column: span 2;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group input, .filter-group select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
    width: 100%;
}

.filter-group input:focus, .filter-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.search-input-container {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-container input {
    padding-left: 36px;
}

.inline-search input {
    padding: 6px 12px 6px 32px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Custom Date collapsibles */
.custom-date-range {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color);
    animation: slideDown 0.25s ease-out;
}

.date-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-input-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.date-input-group input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 0.85rem;
    outline: none;
}

.hidden {
    display: none !important;
}

/* Dynamic Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ledger Table Section */
.ledger-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ledger-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

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

.badge-neutral {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

body.light-theme .badge-neutral {
    background-color: #f1f5f9;
}

/* Table styling */
.ledger-table-container {
    width: 100%;
    overflow-x: auto;
    position: relative;
    min-height: 250px;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.ledger-table th {
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ledger-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.ledger-table tbody tr {
    transition: var(--transition-smooth);
}

.ledger-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

body.light-theme .ledger-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Columns values classes */
.amount-value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
}

.amount-in {
    color: var(--success-color);
}

.amount-out {
    color: var(--danger-color);
}

/* Category pills */
.category-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
}

/* Payment badges */
.payment-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

body.light-theme .payment-pill {
    background-color: #f8fafc;
}

/* Receipt column button */
.receipt-btn {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.receipt-btn:hover {
    transform: scale(1.15);
    color: var(--primary-hover);
}

/* Action buttons in rows */
.row-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.action-btn {
    border: none;
    background: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.light-theme .action-btn:hover {
    background-color: #f1f5f9;
}

.action-btn.edit-btn:hover {
    color: var(--primary-color);
}

.action-btn.delete-btn:hover {
    color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.1);
}

/* Time formats */
.date-primary {
    font-weight: 600;
}

.time-secondary {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.btn-margin {
    margin-top: 16px;
}

/* ------------------------------------------------------------- */
/* CREDIT / DEBIT CONTACTS LAYOUT                               */
/* ------------------------------------------------------------- */
.contacts-grid-container {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr;
    gap: 20px;
    height: calc(100vh - 280px);
}

.contacts-list-card, .contact-ledger-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.contacts-list-scrollable {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

/* Single Contact item in list */
.contact-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.contact-item-row:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: var(--text-muted);
}

body.light-theme .contact-item-row {
    background-color: #f8fafc;
}

body.light-theme .contact-item-row:hover {
    background-color: #f1f5f9;
}

.contact-item-row.active {
    background-color: rgba(59, 130, 246, 0.08);
    border-color: var(--primary-color);
}

.contact-info-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.contact-phone {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.contact-balance-block {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-bal-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.contact-bal-val {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
}

/* Contact detail view ledger */
.contact-ledger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.contact-header-left h3 {
    font-size: 1.4rem;
    font-weight: 700;
}

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

.contact-balance-badge {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

body.light-theme .contact-balance-badge {
    background-color: #f8fafc;
}

.contact-balance-badge strong {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
}

.contact-ledger-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.contact-table-wrapper {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

/* ------------------------------------------------------------- */
/* SECURITY PIN LOCK MODULE                                      */
/* ------------------------------------------------------------- */
.pin-lock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0b0f19;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.pin-lock-card {
    background-color: #151d30;
    border: 1px solid #2e3d5a;
    border-radius: 24px;
    width: 320px;
    padding: 32px 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pin-lock-icon {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, var(--danger-color), var(--accent-color));
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.pin-lock-card h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.pin-lock-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.pin-dots {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.pin-dots .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #2e3d5a;
    transition: var(--transition-smooth);
}

.pin-dots .dot.filled {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    transform: scale(1.15);
}

.pin-keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.pin-key {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid #2e3d5a;
    background-color: rgba(255, 255, 255, 0.02);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    outline: none;
}

.pin-key:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pin-key:active {
    transform: scale(0.92);
}

.pin-key-action {
    font-size: 1.1rem;
    border-color: transparent;
    background-color: transparent;
    color: var(--text-muted);
}

.pin-key-action:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.pin-error {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 8px;
    font-weight: 600;
}

/* File Input & Base64 Attachments Previews */
.file-input {
    background: none !important;
    border: 1px dashed var(--border-color) !important;
    cursor: pointer;
}

.attachment-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    margin-top: 6px;
}

body.light-theme .attachment-preview {
    background-color: #f8fafc;
}

.attachment-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Modal Overlay Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 550px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.7);
    transform: translateY(20px);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-card-small {
    max-width: 400px;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

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

.close-modal-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Modal form controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.required {
    color: var(--danger-color);
}

.form-group input, .form-group select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    padding: 11px 14px;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.3fr;
    gap: 14px;
}

.amount-input-container {
    position: relative;
}

.currency-symbol {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: var(--text-secondary);
}

.amount-input-container input {
    padding-left: 32px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
}

/* Custom In/Out Toggle for form */
.transaction-type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.toggle-option {
    position: relative;
    cursor: pointer;
}

.toggle-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border-radius: var(--border-radius-md);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.toggle-in input:checked + .toggle-indicator {
    background-color: var(--success-bg-subtle);
    border-color: var(--success-color);
    color: var(--success-color);
}

.toggle-out input:checked + .toggle-indicator {
    background-color: var(--danger-bg-subtle);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}

/* Inline Form for Categorie/Metodi addition */
.inline-add-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background-color: rgba(0, 0, 0, 0.1);
    padding: 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

.color-picker-wrapper {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.color-picker-wrapper input[type="color"] {
    padding: 0;
    width: 150%;
    height: 150%;
    margin: -10px;
    border: none;
    cursor: pointer;
}

.btn-align-bottom {
    height: 44px;
}

/* Manager Lists within Modals */
.list-manager-section {
    margin-top: 10px;
}

.list-manager-section h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.manager-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.manager-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
}

body.light-theme .manager-list-item {
    background-color: #f8fafc;
}

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

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.manager-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.manager-item-delete:hover {
    color: var(--danger-color);
}

/* Custom Dynamic SVG charts details */
.chart-bar-in {
    fill: var(--success-color);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.chart-bar-in:hover {
    opacity: 1;
}

.chart-bar-out {
    fill: var(--danger-color);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.chart-bar-out:hover {
    opacity: 1;
}

.chart-text {
    font-size: 7px;
    fill: var(--text-muted);
    font-weight: 500;
}

.chart-grid-line {
    stroke: var(--border-color);
    stroke-width: 0.5;
    stroke-dasharray: 2 2;
}

/* PIN Security box status styling */
.pin-status-box {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    text-align: center;
    margin-bottom: 12px;
}

body.light-theme .pin-status-box {
    background-color: #f8fafc;
}

.pin-status-box strong {
    color: var(--primary-color);
}

/* fadeIn animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Toast Notifications System styling */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
    pointer-events: none;
}

.toast-message {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    padding: 14px 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    pointer-events: all;
    animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               toastFadeOut 0.3s ease-in 2.7s forwards;
}

.toast-message.toast-error {
    border-left-color: var(--danger-color);
}

.toast-message.toast-success {
    border-left-color: var(--success-color);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Centered Confirm Modal Footer */
.confirm-modal-footer {
    display: flex !important;
    justify-content: center !important;
    padding-bottom: 8px !important;
}

/* ------------------------------------------------------------- */
/* PREMIUM DESIGN SELECT CUSTOM CHEVRONS                         */
/* ------------------------------------------------------------- */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 40px !important;
    cursor: pointer;
    transition: var(--transition-smooth);
}

body.light-theme select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Beautiful Options List Dropdown Container */
select option {
    background-color: #1e293b;
    color: #f8fafc;
    padding: 12px;
    font-size: 0.95rem;
}

body.light-theme select option {
    background-color: #ffffff;
    color: #0f172a;
}

/* ------------------------------------------------------------- */
/* PRINT AND PDF RENDER SYSTEM                                    */
/* ------------------------------------------------------------- */
.print-only {
    display: none;
}

@media print {
    body {
        background-color: white !important;
        color: black !important;
        height: auto !important;
        overflow: visible !important;
        font-size: 10pt !important;
    }
    
    /* Enforce dark text colors globally for all printed text to prevent white-on-white in dark mode */
    #print-report-container, 
    #print-report-container *,
    .print-only,
    .print-only * {
        color: #111111 !important;
        background-color: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    /* Preserve green and red highlights for financial numbers and transactions */
    #print-report-container .in,
    #print-report-container .amount-in,
    #print-report-container .print-stat-val.in,
    #print-report-container .print-amount.in {
        color: #059669 !important;
    }
    
    #print-report-container .out,
    #print-report-container .amount-out,
    #print-report-container .print-stat-val.out,
    #print-report-container .print-amount.out {
        color: #dc2626 !important;
    }
    
    /* Keep printed metadata in structured grey text */
    #print-report-container .print-footer,
    #print-report-container .print-footer span,
    #print-report-container .print-date,
    #print-report-container .print-header-left p {
        color: #555555 !important;
    }
    
    .app-container, .modal-overlay, #pin-lock-screen {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
        padding: 20px;
    }
    
    .print-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 3px solid #333;
        padding-bottom: 14px;
        margin-bottom: 24px;
    }
    
    .print-header-left h1 {
        font-size: 24pt;
        font-family: 'Outfit', sans-serif;
        color: #111;
        margin-bottom: 4px;
    }
    
    .print-header-left p {
        color: #555;
        font-size: 10pt;
    }
    
    .print-header-right {
        text-align: right;
    }
    
    .print-date {
        font-size: 9pt;
        color: #666;
    }
    
    .print-stats-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        margin-bottom: 28px;
    }
    
    .print-stat-box {
        border: 1px solid #ccc;
        border-radius: 8px;
        padding: 12px 16px;
        background-color: #fafafa;
    }
    
    .print-stat-label {
        font-size: 8pt;
        font-weight: bold;
        text-transform: uppercase;
        color: #666;
        margin-bottom: 4px;
    }
    
    .print-stat-val {
        font-size: 16pt;
        font-weight: bold;
        font-family: 'Outfit', sans-serif;
    }
    
    .print-stat-val.in {
        color: #059669;
    }
    
    .print-stat-val.out {
        color: #dc2626;
    }
    
    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 30px;
    }
    
    .print-table th {
        background-color: #f3f4f6;
        border-bottom: 2px solid #333;
        padding: 8px 10px;
        font-size: 8pt;
        text-transform: uppercase;
        font-weight: bold;
        text-align: left;
    }
    
    .print-table td {
        padding: 10px 8px;
        border-bottom: 1px solid #ddd;
        font-size: 9pt;
    }
    
    .print-table tr {
        page-break-inside: avoid;
    }
    
    .print-amount {
        font-weight: bold;
        text-align: right;
    }
    
    .print-amount.in {
        color: #059669;
    }
    
    .print-amount.out {
        color: #dc2626;
    }
    
    .print-footer {
        border-top: 1px solid #ddd;
        padding-top: 12px;
        font-size: 8pt;
        color: #888;
        display: flex;
        justify-content: space-between;
    }
}

/* ==========================================
 * CONDOMINIUM MODULE CUSTOM STYLING [NEW]
 * ========================================== */

/* ==========================================
   ALWAYS-VISIBLE CONDO KPI BAR
   ========================================== */

.condo-kpi-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 14px 18px;
    transition: var(--transition-smooth);
    cursor: default;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.kpi-icon {
    font-size: 1.5rem;
    opacity: 0.7;
    color: var(--primary-color);
    flex-shrink: 0;
}

.kpi-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Saldo positive/negative state */
.kpi-saldo-card.kpi-positive {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}
.kpi-saldo-card.kpi-positive .kpi-icon { color: var(--success-color); }
.kpi-saldo-card.kpi-positive .kpi-value { color: var(--success-color); }

.kpi-saldo-card.kpi-negative {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}
.kpi-saldo-card.kpi-negative .kpi-icon { color: var(--danger-color); }
.kpi-saldo-card.kpi-negative .kpi-value { color: var(--danger-color); }

body.light-theme .kpi-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

@media (max-width: 1200px) {
    .condo-kpi-bar {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .condo-kpi-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

.condo-sub-nav {
    display: flex;
    gap: 8px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 6px;
    border-radius: var(--border-radius-lg);
    overflow-x: auto;
    white-space: nowrap;
}


.condo-sub-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--border-radius-md);
    background: none;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.condo-sub-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

body.light-theme .condo-sub-btn:hover {
    background-color: #f1f5f9;
}

.condo-sub-btn.active {
    background-color: var(--bg-card);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
}

body.light-theme .condo-sub-btn.active {
    background-color: #ffffff;
    box-shadow: var(--card-shadow);
}

.condo-subview {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: condoTabIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes condoTabIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.995);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.condo-two-columns {
    display: flex;
    gap: 24px;
    width: 100%;
}

@media (max-width: 1100px) {
    .condo-two-columns {
        flex-direction: column;
    }
}

.condo-budget-card, .condo-allocation-card {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mini-table {
    max-height: 380px;
    overflow-y: auto;
}

.compact-text {
    font-size: 0.85rem;
}

.compact-text td, .compact-text th {
    padding: 8px 10px !important;
}

.budget-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    flex-wrap: wrap;
    gap: 10px;
}

body.light-theme .budget-totals-row {
    background-color: #f8fafc;
}

/* Incassi Matrix Styles */
.matrix-table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    background-color: var(--bg-card);
    box-shadow: var(--card-shadow);
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.matrix-table th, .matrix-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.matrix-table th {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

body.light-theme .matrix-table th {
    background-color: #f8fafc;
}

.matrix-table td.sticky-col, .matrix-table th.sticky-col {
    position: sticky;
    left: 0;
    background-color: var(--bg-card);
    z-index: 2;
    border-right: 2px solid var(--border-color);
    font-weight: 600;
}

.matrix-input {
    width: 55px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 5px 8px;
    font-size: 0.85rem;
    font-family: var(--font-heading);
    font-weight: 600;
    text-align: right;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    cursor: text;
}

.matrix-input:hover {
    border-color: var(--border-color);
    background-color: rgba(255, 255, 255, 0.04);
}

.matrix-input:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-input);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
    z-index: 1;
    position: relative;
}

/* Select variant of matrix-input */
select.matrix-input {
    cursor: pointer;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

body.light-theme .matrix-input:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

body.light-theme .matrix-input:focus {
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Highlight when a value has been entered */
.matrix-input:not([value=""]):not([value="0"]) {
    color: var(--text-primary);
}

.matrix-input-personal {
    width: 65px;
    color: var(--accent-color);
}



.highlight-tot {
    font-weight: 700;
    color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.04);
}

.highlight-balance {
    font-weight: 700;
    background-color: rgba(59, 130, 246, 0.04);
}

/* Printable Voucher Preview and Layout */
.receipt-preview-frame {
    background-color: #121824;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

body.light-theme .receipt-preview-frame {
    background-color: #f1f5f9;
}

/* High Fidelity Receipt styling */
.print-receipt-card {
    background-color: #ffffff;
    color: #000000;
    width: 100%;
    max-width: 800px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: grid;
    grid-template-columns: 240px 1px 1fr; /* Madre (240px), separator line, Figlia */
    overflow: hidden;
    font-family: "Courier New", Courier, monospace; /* Bank slip feel */
    font-size: 11px;
    line-height: 1.4;
}

.receipt-part-madre {
    padding: 16px;
    background-color: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.receipt-part-separator {
    background-color: #ffffff;
    border-left: 2px dashed #aaa;
    position: relative;
}

.receipt-part-separator::after {
    content: "✂";
    position: absolute;
    top: 50%;
    left: -7px;
    transform: translateY(-50%);
    font-size: 14px;
    color: #666;
    background: #fff;
    padding: 2px 0;
}

.receipt-part-figlia {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
}

.receipt-header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px double #000;
    padding-bottom: 6px;
}

.receipt-header-logo .icon {
    font-size: 20px;
}

.receipt-header-logo .title {
    font-weight: bold;
    font-size: 12px;
    letter-spacing: -0.5px;
    font-family: var(--font-primary);
}

.receipt-metadata {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #444;
    margin-bottom: 4px;
}

.receipt-title-box {
    text-align: center;
    border: 1px solid #000;
    padding: 6px;
    font-weight: bold;
    font-size: 13px;
    background-color: #f0f0f0;
    text-transform: uppercase;
}

.receipt-grid-values {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
}

.receipt-grid-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dotted #ccc;
    padding: 2px 0;
}

.receipt-grid-row.bold-row {
    font-weight: bold;
    font-size: 12px;
    border-bottom: 1.5px solid #000;
    padding: 4px 0;
}

.receipt-bank-footer {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    background-color: #fafafa;
    font-size: 9px;
    font-family: var(--font-primary);
}

.receipt-signatures {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 10px;
}

.receipt-signature-line {
    width: 140px;
    border-top: 1px solid #000;
    text-align: center;
    margin-top: 25px;
    padding-top: 2px;
}

/* Specific Print Overrides */
@media print {
    body {
        background-color: #fff !important;
        color: #000 !important;
        overflow: visible !important;
        height: auto !important;
    }
    
    .sidebar, .main-content > header, .condo-sub-nav, .condo-budget-card, .btn, .export-actions, #pin-lock-screen, .toast-container {
        display: none !important;
    }
    
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        background: none !important;
        overflow: visible !important;
        height: auto !important;
    }

    #condo-view {
        display: block !important;
    }

    .condo-subview {
        display: block !important;
    }

    /* Print Single Receipt layout */
    .print-receipt-card {
        border: none !important;
        box-shadow: none !important;
        max-width: 100% !important;
        width: 100% !important;
        page-break-inside: avoid;
    }

    .receipt-part-separator::after {
        background: #fff !important;
    }
}

/* ================================================================= */
/* MOBILE RESPONSIVE AND PERFORMANCE OPTIMIZATION SYSTEM            */
/* ================================================================= */

/* Hide mobile elements by default on desktop */
.mobile-header, .sidebar-backdrop {
    display: none;
}

@media (max-width: 992px) {
    /* Mobile Header Layout */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background-color: var(--bg-sidebar);
        border-bottom: 1px solid var(--border-color);
        padding: 0 16px;
        z-index: 999;
    }
    
    .mobile-logo-text {
        font-family: var(--font-heading);
        font-size: 1.2rem;
        font-weight: 800;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .mobile-logo-text i {
        color: var(--primary-color);
    }
    
    .hamburger-btn, .mobile-action-btn {
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.3rem;
        cursor: pointer;
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: opacity 0.15s ease;
    }
    
    .hamburger-btn:active, .mobile-action-btn:active {
        opacity: 0.6;
    }

    /* Sidebar Drawer Off-Canvas styling */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        height: 100vh;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
        border-right: 1px solid var(--border-color);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Sidebar Drawer Backdrop Overlay */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.6);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    
    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: all;
    }
    
    /* Layout Adjustments */
    body, html {
        overflow-x: hidden !important;
    }
    
    .app-container {
        flex-direction: column;
        padding-top: 60px; /* spacing for fixed mobile header */
        height: 100vh;
        overflow: hidden;
    }
    
    .main-content {
        padding: 20px 16px;
        height: calc(100vh - 60px);
        overflow-y: auto;
        overflow-x: hidden !important; /* Strictly lock horizontal viewport scrolling */
    }
}

@media (max-width: 768px) {
    /* General Mobile Layout */
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    
    .header-right {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
        gap: 10px;
    }
    
    .export-actions, .transaction-actions {
        display: flex;
        gap: 10px;
        width: 100%;
    }
    
    .export-actions .btn, .transaction-actions .btn {
        flex: 1;
        justify-content: center;
        padding: 12px;
        font-size: 0.9rem;
    }
    
    /* Dashboard Stat Cards Stack */
    .dashboard-stats {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px !important;
    }
    
    .stat-value {
        font-size: 1.7rem !important;
    }
    
    /* Analytics & Filters Stack */
    .analytics-filters-container {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .filters-grid {
        grid-template-columns: 1fr !important;
    }
    
    .filter-group.col-span-2 {
        grid-column: span 1 !important;
    }
    
    /* Contacts Section */
    .contacts-grid-container {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .contacts-list-card {
        max-height: 250px;
    }
    
    .contact-ledger-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .contact-header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Condominium Module specifics */
    .condo-kpi-bar {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .condo-kpi-bar .kpi-card:nth-child(5) {
        grid-column: span 2;
    }
    
    .condo-info-inline-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Override fixed inline grids on mobile */
    div[style*="minmax(400px"], div[style*="minmax(400px"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    div[style*="1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    /* Horizontal scrolling for wide data tables */
    .ledger-table-container, .matrix-table-container {
        border-radius: var(--border-radius-md);
        box-shadow: none;
    }
    
    .ledger-table th, .ledger-table td, .matrix-table th, .matrix-table td {
        font-size: 0.8rem;
        padding: 8px 6px;
    }
    
    /* Mobile-first bottom sheet styling for popups/modals */
    .modal-overlay {
        align-items: flex-end;
    }
    
    .modal-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0;
        border-radius: 20px 20px 0 0 !important;
        max-height: 88vh;
        transform: translateY(100%);
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .modal-overlay.active .modal-card {
        transform: translateY(0);
    }
    
    /* Keep confirmation/small popups centered */
    #custom-confirm-modal .modal-card, #security-pin-modal .modal-card {
        margin: auto !important;
        border-radius: var(--border-radius-lg) !important;
        width: 90% !important;
        position: relative;
        bottom: auto;
        transform: scale(0.9);
        transition: transform 0.15s ease;
    }
    
    #custom-confirm-modal.active .modal-card, #security-pin-modal.active .modal-card {
        transform: scale(1);
    }
    
    /* Touch optimization */
    input, select, button, .sidebar-btn, .nav-btn, .book-item, .condo-sub-btn {
        min-height: 44px; /* Native tap target size */
    }
    
    .matrix-input {
        width: 65px;
        min-height: 36px;
        padding: 6px;
    }
    
    .matrix-table td.sticky-col, .matrix-table th.sticky-col {
        border-right: 1.5px solid var(--border-color);
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    }
    
    /* Disable all heavy 3D rendering and complex keyframe animations on mobile for max speed */
    * {
        animation-duration: 0.01s !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.15s !important;
        transform: none !important; /* avoid composition costs where unnecessary */
        will-change: auto !important;
    }
    
    /* Keep translate and off-canvas drawers working */
    .sidebar {
        transform: translateX(-100%) !important;
    }
    .sidebar.active {
        transform: translateX(0) !important;
    }
    .modal-card {
        transform: translateY(100%) !important;
    }
    .modal-overlay.active .modal-card {
        transform: translateY(0) !important;
    }
}

/* ==========================================
   PREMIUM MOBILE TAB BAR STYLE & GLASSMORPHISM
   ========================================== */
.mobile-tab-bar {
    display: none;
}

@media (max-width: 992px) {
    /* Hide top elements on mobile */
    .mobile-header #mobile-theme-toggle {
        display: none !important; /* redundant since it is in bottom menu */
    }
    
    .hamburger-btn {
        display: none !important; /* redundant since we have Menu trigger in bottom bar */
    }

    /* Floating Premium Glassmorphism Bottom Tab Bar */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 66px;
        background: rgba(15, 23, 42, 0.85); /* dark glass */
        backdrop-filter: blur(16px) saturate(180%);
        -webkit-backdrop-filter: blur(16px) saturate(180%);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom, 0);
        z-index: 1999; /* stays above all sheets, but below modals */
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
    }
    
    body.light-theme .mobile-tab-bar {
        background: rgba(255, 255, 255, 0.85); /* light glass */
        border-top: 1px solid rgba(15, 23, 42, 0.06);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.05);
    }

    .mobile-tab-btn {
        background: none;
        border: none;
        color: var(--text-secondary);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: 0.72rem;
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-smooth);
        flex: 1;
        height: 100%;
        min-height: auto !important; /* overwrite tap targets */
        opacity: 0.75;
    }
    
    .mobile-tab-btn i {
        font-size: 1.2rem;
        transition: transform 0.15s ease;
    }
    
    .mobile-tab-btn.active {
        color: var(--primary-color);
        opacity: 1;
    }
    
    .mobile-tab-btn.active i {
        transform: translateY(-1px) scale(1.05);
    }
    
    /* Shift app container for bottom navigation */
    .app-container {
        padding-bottom: 66px !important;
    }
}

@media (max-width: 768px) {
    /* TABLE TO MOBILE CARDS CONVERSION SYSTEM (HIGH FIDELITY) */
    .ledger-table-container, .contact-table-wrapper {
        overflow-x: visible !important;
        background: none !important;
        border: none !important;
    }
    
    .ledger-table {
        background: none !important;
        border: none !important;
    }
    
    .ledger-table thead {
        display: none !important;
    }
    
    .ledger-table, .ledger-table tbody, .ledger-table tr {
        display: block !important;
        width: 100% !important;
    }
    
    /* 1. Cashbook Transactions to Premium Cards */
    #transactions-tbody tr {
        background-color: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-lg);
        padding: 16px;
        margin-bottom: 14px;
        position: relative;
        display: grid !important;
        grid-template-areas: 
            "remark amount"
            "category amount"
            "date payment"
            "actions actions";
        grid-template-columns: 1fr auto;
        gap: 8px 12px;
        box-shadow: var(--card-shadow);
        transition: transform 0.1s ease;
    }
    
    body.light-theme #transactions-tbody tr {
        background-color: #ffffff;
    }
    
    #transactions-tbody tr td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        background: none !important;
    }
    
    #transactions-tbody tr td:nth-child(1) { /* Date & Time */
        grid-area: date;
        font-size: 0.8rem;
        color: var(--text-muted);
        display: flex !important;
        align-items: center;
        gap: 6px;
    }
    
    #transactions-tbody tr td:nth-child(2) { /* Tipo */
        display: none !important; /* hidden, handled by colors and borders */
    }
    
    /* Premium border color depending on cash in/out */
    #transactions-tbody tr:has(.badge-positive) {
        border-left: 4px solid var(--success-color) !important;
    }
    #transactions-tbody tr:has(.badge-negative) {
        border-left: 4px solid var(--danger-color) !important;
    }
    
    #transactions-tbody tr td:nth-child(3) { /* Remark/Description */
        grid-area: remark;
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--text-primary);
        word-break: break-word;
        padding-right: 24px !important; /* preserve space for receipt button */
    }
    
    #transactions-tbody tr td:nth-child(4) { /* Category */
        grid-area: category;
        display: flex !important;
        align-items: center;
    }
    
    #transactions-tbody tr td:nth-child(5) { /* Payment mode */
        grid-area: payment;
        font-size: 0.8rem;
        color: var(--text-secondary);
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
    }
    
    #transactions-tbody tr td:nth-child(6) { /* Attachment receipt btn */
        position: absolute;
        top: 14px;
        right: 14px;
        z-index: 5;
    }
    
    #transactions-tbody tr td:nth-child(7) { /* Amount */
        grid-area: amount;
        font-size: 1.2rem !important;
        font-weight: 800;
        font-family: var(--font-heading);
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        align-self: center;
    }
    
    #transactions-tbody tr td:nth-child(8) { /* Actions */
        grid-area: actions;
        border-top: 1px solid var(--border-color) !important;
        padding-top: 10px !important;
        margin-top: 4px;
        display: flex !important;
        justify-content: flex-end;
        gap: 12px;
    }
    
    /* 2. Contacts Ledger Transactions to Premium Cards */
    #contact-transactions-tbody tr {
        background-color: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-lg);
        padding: 14px;
        margin-bottom: 12px;
        display: grid !important;
        grid-template-areas: 
            "remark amount"
            "date amount"
            "actions actions";
        grid-template-columns: 1fr auto;
        gap: 6px 12px;
        box-shadow: var(--card-shadow);
        position: relative;
    }
    
    body.light-theme #contact-transactions-tbody tr {
        background-color: #ffffff;
    }
    
    #contact-transactions-tbody tr td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        background: none !important;
    }
    
    #contact-transactions-tbody tr td:nth-child(1) { /* Date */
        grid-area: date;
        font-size: 0.8rem;
        color: var(--text-muted);
    }
    
    #contact-transactions-tbody tr td:nth-child(2) { /* Remark */
        grid-area: remark;
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--text-primary);
        word-break: break-word;
    }
    
    #contact-transactions-tbody tr td:nth-child(3),
    #contact-transactions-tbody tr td:nth-child(4) { /* Dato & Ricevuto amounts */
        grid-area: amount;
        font-size: 1.15rem !important;
        font-weight: 800;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
    }
    
    #contact-transactions-tbody tr td:nth-child(3):empty,
    #contact-transactions-tbody tr td:nth-child(4):empty {
        display: none !important;
    }
    
    #contact-transactions-tbody tr td:nth-child(5) { /* Actions */
        grid-area: actions;
        border-top: 1px solid var(--border-color) !important;
        padding-top: 8px !important;
        margin-top: 2px;
        display: flex !important;
        justify-content: flex-end;
        gap: 12px;
    }

    /* ------------------------------------------------------------- */
    /* SPECIFIC CONDOMINIUM MODULE RESPONSIVE OVERRIDES              */
    /* ------------------------------------------------------------- */
    
    /* Shrink navigation tabs so they are extremely elegant and touch-friendly */
    .condo-sub-nav {
        padding: 4px !important;
        gap: 4px !important;
    }
    
    .condo-sub-btn {
        min-height: auto !important;
        height: 32px !important;
        padding: 6px 10px !important;
        font-size: 0.72rem !important;
        gap: 4px !important;
        border-radius: var(--border-radius-sm) !important;
    }
    
    .condo-sub-btn i {
        font-size: 0.85rem !important;
    }
    
    /* Shrink always-visible KPI bar cards to fit beautifully in 2 columns */
    .condo-kpi-bar {
        padding: 8px !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
        border-radius: var(--border-radius-md) !important;
    }
    
    .kpi-card {
        padding: 8px 10px !important;
        gap: 8px !important;
        min-height: auto !important;
        border-radius: var(--border-radius-md) !important;
    }
    
    .kpi-card:hover {
        transform: none !important; /* disable hover translation on mobile */
    }
    
    .kpi-icon {
        font-size: 1.1rem !important;
    }
    
    .kpi-value {
        font-size: 0.88rem !important;
    }
    
    .kpi-label {
        font-size: 0.58rem !important;
    }
    
    /* Inline inputs grid settings */
    .condo-info-inline-grid {
        padding: 12px !important;
        gap: 10px !important;
        margin-bottom: 14px !important;
        border-radius: var(--border-radius-md) !important;
    }
    
    .condo-info-inline-grid .form-group {
        margin-bottom: 0 !important;
    }
    
    .condo-info-inline-grid label {
        font-size: 0.7rem !important;
        margin-bottom: 2px !important;
    }
    
    .condo-info-inline-grid input {
        min-height: auto !important;
        height: 34px !important;
        font-size: 0.8rem !important;
        padding: 6px 10px !important;
    }
    
    /* App header, title, subtitles text optimizations */
    .app-header {
        margin-bottom: 14px !important;
    }
    
    .app-header .book-title {
        font-size: 1.35rem !important;
        letter-spacing: -0.5px !important;
        line-height: 1.2 !important;
    }
    
    .app-header .header-subtitle {
        font-size: 0.72rem !important;
        line-height: 1.3 !important;
        display: block !important;
        word-break: break-word !important;
        color: var(--text-secondary) !important;
    }
    
    #edit-condo-info-btn {
        min-height: auto !important;
        width: 30px !important;
        height: 30px !important;
    }
    
    /* Specific spreadsheet inputs height fix (overwriting standard touch height) */
    .matrix-table input, 
    .matrix-table select, 
    .ledger-table input, 
    .ledger-table select, 
    .matrix-input,
    .matrix-input-personal {
        min-height: auto !important;
        height: 28px !important;
        padding: 2px 6px !important;
        font-size: 0.75rem !important;
        width: 52px !important;
        border-radius: var(--border-radius-sm) !important;
    }
    
    /* Sticky column font size */
    .matrix-table td.sticky-col, 
    .matrix-table th.sticky-col {
        font-size: 0.75rem !important;
        padding: 4px 6px !important;
        max-width: 90px !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Sub-tab headers with buttons */
    .ledger-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        margin-bottom: 12px !important;
    }
    
    .ledger-header h2 {
        font-size: 1.05rem !important;
    }
    
    .ledger-header-right {
        width: 100% !important;
    }
    
    .ledger-header-right .btn {
        width: 100% !important;
        justify-content: center !important;
        min-height: auto !important;
        height: 36px !important;
        font-size: 0.8rem !important;
    }
}

@media (max-width: 480px) {
    /* Extra narrow screens */
    .condo-kpi-bar {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        white-space: nowrap;
        padding: 10px;
    }
    
    .condo-kpi-bar .kpi-card {
        flex: 0 0 160px;
        padding: 10px;
        box-sizing: border-box;
    }
}

