/* ===== CSS Variables & Design System ===== */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111127;
    --bg-card: rgba(22, 22, 50, 0.7);
    --bg-card-solid: #161632;
    --bg-input: rgba(30, 30, 65, 0.6);
    --bg-nav: rgba(10, 10, 26, 0.95);

    --text-primary: #f0f0f5;
    --text-secondary: #a0a0c0;
    --text-muted: #6a6a90;

    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);

    --red-primary: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);

    --green-primary: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);

    --blue-primary: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);

    --orange-primary: #f59e0b;
    --orange-bg: rgba(245, 158, 11, 0.12);

    --border-color: rgba(99, 102, 241, 0.15);
    --border-light: rgba(255, 255, 255, 0.06);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;

    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Outfit', 'Inter', sans-serif;

    --header-height: 64px;
    --nav-height: 72px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body.light-theme {
    --bg-primary: #f4f5f8;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-solid: #ffffff;
    --bg-input: rgba(235, 237, 243, 0.8);
    --bg-nav: rgba(255, 255, 255, 0.95);

    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;

    --accent-primary: #4f46e5;
    --accent-secondary: #6366f1;
    --accent-glow: rgba(79, 70, 229, 0.12);
    --accent-gradient: linear-gradient(135deg, #4f46e5, #7c3aed, #9333ea);

    --red-primary: #dc2626;
    --red-bg: rgba(220, 38, 38, 0.08);

    --green-primary: #16a34a;
    --green-bg: rgba(22, 163, 74, 0.08);

    --blue-primary: #2563eb;
    --blue-bg: rgba(37, 99, 235, 0.08);

    --orange-primary: #d97706;
    --orange-bg: rgba(217, 119, 6, 0.08);

    --border-color: rgba(79, 70, 229, 0.1);
    --border-light: rgba(0, 0, 0, 0.06);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
}


/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.04) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

body.light-theme::before {
    background: radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 50%, rgba(168, 85, 247, 0.02) 0%, transparent 70%);
}


.hidden { display: none !important; }

/* ===== Splash Screen ===== */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.splash-content {
    text-align: center;
    animation: splashIn 0.8s ease-out;
}

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

.splash-logo {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    margin-bottom: 20px;
    animation: logoPulse 2s ease-in-out infinite;
    object-fit: contain;
    background: white;
    padding: 4px;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: var(--shadow-glow), var(--shadow-lg); }
    50% { box-shadow: 0 0 40px var(--accent-glow), var(--shadow-lg); }
}

.splash-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.splash-tagline {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    margin-bottom: 30px;
}

.splash-loader {
    width: 180px;
    height: 3px;
    background: var(--bg-card);
    border-radius: 3px;
    margin: 0 auto;
    overflow: hidden;
}

.splash-loader-bar {
    width: 40%;
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    animation: splashLoad 1.2s ease-in-out infinite;
}

@keyframes splashLoad {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ===== App Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

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

.header-logo {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    object-fit: contain;
    background: white;
    padding: 2px;
    box-shadow: var(--shadow-sm);
}

.header-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.3px;
}

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

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.icon-btn .material-icons-round { font-size: 20px; }

.sync-btn.spinning .material-icons-round {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-light);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.online {
    background: var(--green-primary);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.offline {
    background: var(--red-primary);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Page Container ===== */
.page-container {
    padding-top: calc(var(--header-height) + 12px);
    padding-bottom: calc(var(--safe-bottom) + 20px);
    padding-left: 16px;
    padding-right: 16px;
    min-height: 100vh;
}

.page {
    display: none;
    animation: pageIn 0.4s ease-out;
}

.page.active { display: block; }

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

.page-header {
    margin-bottom: 20px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-icon {
    font-size: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-desc {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 4px;
    margin-left: 36px;
}

/* ===== Form Card ===== */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-label .material-icons-round {
    font-size: 16px;
    color: var(--accent-secondary);
}

.optional-tag {
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    font-size: 0.75rem;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(35, 35, 70, 0.8);
}

.form-textarea {
    resize: none;
    min-height: 60px;
}

.amount-input {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-family: var(--font-display);
}

/* ===== Chip Group ===== */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chip .material-icons-round { font-size: 16px; }

.chip:hover {
    border-color: var(--accent-secondary);
    color: var(--text-primary);
}

.chip.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

/* ===== Submit Button ===== */
.submit-btn {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-glow);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.submit-btn:hover::before { opacity: 1; }

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--accent-glow), var(--shadow-lg);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.submit-btn .material-icons-round { font-size: 20px; }

/* ===== Dashboard Summary Cards ===== */
.summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.summary-card:first-child {
    grid-column: 1 / -1;
}

.summary-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.summary-icon-wrap .material-icons-round { font-size: 22px; }

.total-card .summary-icon-wrap {
    background: var(--accent-glow);
    color: var(--accent-secondary);
}

.count-card .summary-icon-wrap {
    background: var(--blue-bg);
    color: var(--blue-primary);
}

.today-card .summary-icon-wrap {
    background: var(--green-bg);
    color: var(--green-primary);
}

.summary-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.summary-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.summary-value {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.total-card .summary-value { font-size: 1.5rem; }

/* ===== Filters Bar ===== */
.filters-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box .material-icons-round {
    font-size: 20px;
    color: var(--text-muted);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    outline: none;
}

.search-input::placeholder { color: var(--text-muted); }

.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
}

.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.filter-chip:hover {
    border-color: var(--accent-secondary);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}

/* ===== Date Filter Bar ===== */
.date-filter-bar {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.date-input-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-input-wrap label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.date-filter-input {
    padding: 10px 12px !important;
    font-size: 0.82rem !important;
}

.clear-filter-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.clear-filter-btn:hover {
    background: var(--red-bg);
    color: var(--red-primary);
    border-color: var(--red-primary);
}

/* ===== Records Table ===== */
.records-container {
    position: relative;
}

.records-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.records-table thead {
    background: rgba(99, 102, 241, 0.08);
    border-bottom: 1px solid var(--border-color);
}

.records-table th {
    padding: 14px 16px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-card-solid);
}

.records-table td {
    padding: 14px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.records-table tr {
    transition: background 0.2s ease;
}

.records-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.records-table tbody tr:last-child td {
    border-bottom: none;
}

.td-amount {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--accent-secondary) !important;
}

.td-serial {
    color: var(--text-muted) !important;
    font-weight: 500;
    font-size: 0.78rem !important;
}

.td-mode {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mode-cash {
    background: var(--green-bg);
    color: var(--green-primary);
}

.mode-upi {
    background: var(--blue-bg);
    color: var(--blue-primary);
}

.mode-bank {
    background: var(--orange-bg);
    color: var(--orange-primary);
}

.mode-cheque {
    background: rgba(168, 85, 247, 0.12);
    color: #a855f7;
}

.td-remark {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary) !important;
    font-size: 0.82rem !important;
}

/* ===== Empty & Loading States ===== */
.empty-state, .loading-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
}

.empty-state.show, .loading-state.show {
    display: flex;
}

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

.empty-state p {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

.empty-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

.loading-state p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
}

.nav-item:hover { color: var(--text-secondary); }

.nav-item.active { color: var(--accent-secondary); }

.nav-icon { font-size: 24px; transition: transform 0.3s ease; }

.nav-item.active .nav-icon { transform: scale(1.1); }

.nav-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-indicator {
    position: absolute;
    top: 0;
    width: 40px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-item.active .nav-indicator { opacity: 1; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: calc(100% - 32px);
}

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

.toast-icon {
    font-size: 20px;
    color: var(--green-primary);
}

.toast.error .toast-icon { color: var(--red-primary); }

.toast-message {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

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

.modal {
    width: 100%;
    max-width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.modal-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    object-fit: contain;
    background: white;
    padding: 2px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-glow);
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.modal-header p {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.modal-body {
    margin-bottom: 20px;
}

.setup-help {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--blue-bg);
    border-radius: var(--radius-md);
    margin-top: 16px;
}

.setup-help .material-icons-round {
    color: var(--blue-primary);
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.setup-help p {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.5;
}

.modal-actions { display: flex; flex-direction: column; }

/* ===== Responsive ===== */
@media (min-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .summary-card:first-child {
        grid-column: auto;
    }
}

@media (min-width: 768px) {
    .page-container {
        max-width: 720px;
        margin: 0 auto;
    }
}

@media (min-width: 1024px) {
    .page-container {
        max-width: 900px;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

/* ===== Color Scheme for Date Inputs ===== */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

/* ===== Install Prompt ===== */
.install-banner {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 12px);
    left: 16px;
    right: 16px;
    background: var(--bg-card-solid);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 150;
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.install-banner-text {
    flex: 1;
}

.install-banner-text strong {
    font-size: 0.85rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 2px;
}

.install-banner-text span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.install-btn {
    padding: 8px 16px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.install-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* ===== Desktop / Mobile Display Toggles ===== */
.desktop-only {
    display: block;
}
.mobile-only {
    display: none !important;
}

@media (max-width: 600px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: block !important;
    }
    .form-input {
        font-size: 16px !important; /* Prevents auto-zoom on mobile safari */
    }
}

/* ===== PWA App Switcher (Anchor tag styles) ===== */
a.nav-item {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ===== Theme Toggle Header Button ===== */
.theme-btn {
    position: relative;
    overflow: hidden;
}
.theme-btn .material-icons-round {
    transition: transform 0.5s ease, opacity 0.3s ease;
}
.theme-btn:active .material-icons-round {
    transform: rotate(360deg);
}

/* ===== Quick Date Filter Preset Chips ===== */
.date-presets-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
}
.date-presets-bar::-webkit-scrollbar {
    display: none;
}
.preset-chip {
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}
.preset-chip:hover {
    border-color: var(--accent-secondary);
    color: var(--text-primary);
}
.preset-chip.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

/* ===== Mobile Card List View ===== */
.records-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.record-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.record-card:active {
    transform: scale(0.98);
}

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

.card-party {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-amount {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-secondary);
}

.card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border-light);
    padding-bottom: 10px;
}

.card-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-date .material-icons-round {
    font-size: 14px;
}

.card-mode {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
}

.card-remark {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
}

.card-remark .material-icons-round {
    font-size: 14px;
    margin-top: 2px;
    color: var(--text-muted);
}

.remark-text {
    word-break: break-word;
    line-height: 1.4;
}

/* ===== Chart Section ===== */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 8px;
    flex-wrap: wrap;
}

.section-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-icon {
    font-size: 24px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.section-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.chart-highest {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--orange-bg);
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.chart-highest strong {
    color: var(--orange-primary);
}

.chart-area {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) transparent;
    padding-bottom: 4px;
}

.chart-area::-webkit-scrollbar {
    height: 4px;
}

.chart-area::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 2px;
}

.chart-bars-container {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 160px;
    min-width: max-content;
    padding: 0 2px;
}

.chart-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    width: 22px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    min-height: 0;
    border-radius: 4px 4px 1px 1px;
    background: linear-gradient(180deg, var(--accent-secondary), var(--accent-primary));
    transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    cursor: pointer;
}

.chart-bar:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 8px var(--accent-glow);
}

.chart-bar.empty {
    background: var(--border-light);
    min-height: 2px;
    cursor: default;
}

.chart-bar.empty:hover {
    filter: none;
    box-shadow: none;
}

.chart-bar.highest {
    background: linear-gradient(180deg, #fbbf24, #f59e0b, #d97706);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
    animation: highestPulse 2s ease-in-out infinite;
}

@keyframes highestPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.6); }
}

.chart-bar.today {
    border: 2px solid var(--green-primary);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.chart-bar.today.highest {
    border: 2px solid var(--green-primary);
}

.bar-crown {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    line-height: 1;
    animation: crownBounce 1s ease-in-out infinite;
}

@keyframes crownBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-3px); }
}

.chart-bar-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    line-height: 1;
}

/* ===== Day-Wise Breakdown Section ===== */
.daywise-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    margin-bottom: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.daywise-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
    font-family: var(--font-primary);
    text-align: left;
}

.daywise-section-toggle:hover {
    background: rgba(99, 102, 241, 0.05);
}

.daywise-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.daywise-body.expanded {
    max-height: 2000px;
}

.daywise-list {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.daywise-empty {
    text-align: center;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.daywise-empty p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.daywise-card {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.daywise-card:hover {
    border-color: var(--border-color);
}

.daywise-card.daywise-today {
    border-color: var(--green-primary);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.15);
}

.daywise-header {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    gap: 10px;
    transition: background 0.2s ease;
}

.daywise-header:hover {
    background: rgba(99, 102, 241, 0.05);
}

.daywise-date-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.daywise-day-number {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-secondary);
    min-width: 32px;
    text-align: center;
}

.daywise-day-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.daywise-day-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

.today-badge {
    display: inline-block;
    background: var(--green-primary);
    color: white;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
    margin-left: 4px;
}

.daywise-count {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.daywise-amount-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.daywise-total {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.daywise-pct {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}

.daywise-expand-icon {
    color: var(--text-muted);
    font-size: 20px;
    transition: transform 0.3s ease;
}

.daywise-card.expanded .daywise-expand-icon {
    transform: rotate(180deg);
}

.daywise-bar-track {
    height: 3px;
    background: var(--border-light);
    margin: 0 14px;
}

.daywise-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 0;
}

.daywise-entries-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.daywise-card.expanded .daywise-entries-body {
    max-height: 500px;
}

.daywise-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-light);
}

.daywise-entry-party {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.daywise-entry-amount {
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--accent-secondary);
    white-space: nowrap;
}

.daywise-entry-mode {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* ===== Chart Responsive ===== */
@media (max-width: 600px) {
    .chart-bars-container {
        height: 130px;
    }

    .chart-bar-wrap {
        width: 18px;
    }

    .chart-bar-label {
        font-size: 0.5rem;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
    }

    .chart-highest {
        width: 100%;
        justify-content: center;
    }
}

