@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========================================
   PIGMIE RECORD MANAGEMENT SYSTEM - STYLES
   ======================================== */

/* === CSS Variables / Design Tokens === */
:root {
    /* Primary Palette */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Neutral Palette */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --gray-950: #020617;

    /* Accent Colors */
    --success-50: #ecfdf5;
    --success-400: #34d399;
    --success-500: #10b981;
    --success-600: #059669;

    --warning-50: #fffbeb;
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    --warning-600: #d97706;

    --danger-50: #fef2f2;
    --danger-400: #f87171;
    --danger-500: #ef4444;
    --danger-600: #dc2626;

    --info-50: #eff6ff;
    --info-400: #60a5fa;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* Surfaces — True Dark (AMOLED-friendly) */
    --bg-body: #000000;
    --bg-card: rgba(28, 28, 30, 0.95);
    --bg-card-hover: rgba(44, 44, 46, 0.95);
    --bg-input: rgba(44, 44, 46, 0.8);
    --bg-modal: rgba(28, 28, 30, 0.98);
    --bg-bottomnav: rgba(18, 18, 18, 0.92);

    /* Borders — Neutral */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.16);

    /* Text */
    --text-primary: #f5f5f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.12);

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --bottomnav-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
}

/* Light Theme Overrides */
[data-theme="light"] {
    --bg-body: #f2f2f7;
    --bg-card: #ffffff;
    --bg-card-hover: #f9f9f9;
    --bg-input: #ffffff;
    --bg-modal: rgba(255, 255, 255, 0.98);
    --bg-bottomnav: rgba(255, 255, 255, 0.92);

    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-hover: rgba(0, 0, 0, 0.15);

    --text-primary: #1c1c1e;
    --text-secondary: #3a3a3c;
    --text-muted: #8e8e93;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

html {
    /* Lock font-size to viewport so Android display-size / font-size
       accessibility settings don't blow up the layout.
       Clamp: min 12px, preferred 3.6vw, max 16px */
    font-size: clamp(12px, 3.6vw, 16px);
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app-ui {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Background — clean, no gradient mesh */;

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-600);
}

/* === Sidebar — REMOVED, replaced by Bottom Nav === */
.sidebar {
    display: none !important;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* === Bottom Navigation Bar === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-height);
    background: var(--bg-bottomnav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    padding: 6px 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
    transition: all var(--transition-fast);
}

.bottom-nav-item.active {
    color: var(--primary-400);
}

.bottom-nav-item.active svg {
    stroke: var(--primary-400);
}

.bottom-nav-item span {
    display: block;
    line-height: 1;
    margin-top: 2px;
}

/* Center Collect FAB */
.bottom-nav-item.collect-btn {
    position: relative;
}

.collect-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transition: all var(--transition-fast);
    margin-top: -20px;
}

.collect-fab svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.bottom-nav-item.collect-btn.active .collect-fab {
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.6);
    transform: scale(1.05);
}

.bottom-nav-item.collect-btn span {
    color: var(--text-muted);
    margin-top: 4px;
}

.bottom-nav-item.collect-btn.active span {
    color: var(--primary-400);
}

/* === Main Content === */
.main-content {
    flex: 1;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding-bottom: calc(var(--bottomnav-height) + 12px);
}

/* === Top Bar === */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-bottomnav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 10px;
}

.menu-toggle {
    display: none !important;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-logo .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.topbar-settings-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-600);
}

/* === Sidebar — REMOVED, replaced by Bottom Nav === */
.sidebar {
    display: none !important;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* === Bottom Navigation Bar === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-height);
    background: var(--bg-bottomnav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    padding: 6px 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
    transition: all var(--transition-fast);
}

.bottom-nav-item.active {
    color: var(--primary-400);
}

.bottom-nav-item.active svg {
    stroke: var(--primary-400);
}

.bottom-nav-item span {
    display: block;
    line-height: 1;
    margin-top: 2px;
}

/* Center Collect FAB */
.bottom-nav-item.collect-btn {
    position: relative;
}

.collect-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transition: all var(--transition-fast);
    margin-top: -20px;
}

.collect-fab svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.bottom-nav-item.collect-btn.active .collect-fab {
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.6);
    transform: scale(1.05);
}

.bottom-nav-item.collect-btn span {
    color: var(--text-muted);
    margin-top: 4px;
}

.bottom-nav-item.collect-btn.active span {
    color: var(--primary-400);
}

/* === Main Content === */
.main-content {
    flex: 1;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding-bottom: calc(var(--bottomnav-height) + 12px);
}

/* === Top Bar === */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-bottomnav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 10px;
}

.menu-toggle {
    display: none !important;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-logo .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

.topbar-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.topbar-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.mode-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mode-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mode-info h4 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
    font-size: 16px;
}

.mode-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.topbar-settings-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.topbar-settings-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

/* === Language Toggle === */
.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--primary-400);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'Inter', 'Noto Sans Kannada', 'Noto Sans Devanagari', sans-serif;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    -webkit-appearance: none;
}

.lang-toggle:hover {
    border-color: var(--primary-500);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

/* Kannada font override */
body.lang-kn {
    font-family: 'Noto Sans Kannada', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Hindi font override */
body.lang-hi {
    font-family: 'Noto Sans Devanagari', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-400), var(--primary-500));
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

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

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

.btn-success {
    background: linear-gradient(135deg, var(--success-500), var(--success-600));
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-500), var(--danger-600));
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* === Views === */
.view {
    display: none;
    padding: 28px 32px;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

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

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-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(10px);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

.stat-card-primary::before {
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
}

.stat-card-success::before {
    background: linear-gradient(90deg, var(--success-500), var(--success-400));
}

.stat-card-warning::before {
    background: linear-gradient(90deg, var(--warning-500), var(--warning-400));
}

.stat-card-info::before {
    background: linear-gradient(90deg, var(--info-500), var(--info-400));
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--border-color-hover);
}

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

.stat-card-primary .stat-icon {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-400);
}

.stat-card-success .stat-icon {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-400);
}

.stat-card-warning .stat-icon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-400);
}

.stat-card-info .stat-icon {
    background: rgba(59, 130, 246, 0.12);
    color: var(--info-400);
}

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

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Analytics & Insights === */
.analytics-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
    border-color: rgba(99, 102, 241, 0.2);
}

.efficiency-stats {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.efficiency-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.eff-expected {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.eff-actual {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.eff-percentage {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-400);
    letter-spacing: -1px;
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: var(--bg-body);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.attention-needed .card-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}
.attention-needed .card-header h3::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--danger-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--danger-color);
}

.attention-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.attention-info h4 {
    font-size: 1rem;
    margin-bottom: 2px;
}

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

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px 24px;
    max-height: 400px;
    overflow-y: auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* === Empty State === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    gap: 12px;
}

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

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

/* === Search Bar === */
.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 16px;
    margin-bottom: 20px;
    transition: all var(--transition-fast);
}

.search-bar:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-bar svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    padding: 14px 0;
}

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

.search-bar.compact {
    margin-bottom: 0;
}

/* === Customer Filter Bar === */
.customer-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-btn {
    padding: 7px 18px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    border-color: var(--primary-500);
    color: var(--primary-400);
    background: rgba(99, 102, 241, 0.06);
}

.filter-btn.active {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary-500);
    color: var(--primary-400);
}

/* === Status Badges === */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-400);
}

.status-badge.closed {
    background: rgba(100, 116, 139, 0.15);
    color: var(--gray-400);
}

/* === Customer Cards === */
.customers-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

/* Closed customer card */
.customer-card.closed {
    opacity: 0.6;
    border-color: rgba(100, 116, 139, 0.2);
}

.customer-card.closed:hover {
    opacity: 0.8;
}

/* Interest info row */
.interest-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--warning-400);
    font-weight: 500;
    margin-top: 2px;
}

/* Edit payment button */
.record-edit-btn {
    background: none;
    border: none;
    color: var(--info-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.record-edit-btn:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.1);
}

/* Payment action buttons container */
.payment-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Loan action buttons in detail modal */
.detail-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* Edit payment inline form */
.edit-payment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 260;
    animation: fadeIn 0.15s ease;
}

.edit-payment-dialog {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 360px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.2s ease;
}

.edit-payment-dialog h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.edit-payment-dialog .form-group {
    margin-bottom: 16px;
}

.edit-payment-dialog .form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}

.edit-payment-dialog .form-group input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.edit-payment-dialog .form-group input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.edit-payment-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.customer-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.customer-card:hover {
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

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

.customer-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.customer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.customer-name {
    font-size: 1rem;
    font-weight: 600;
}

.customer-phone {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.customer-type-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-400);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.customer-type-badge.saving {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-400);
}

.customer-actions {
    display: flex;
    gap: 6px;
}

.customer-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 600;
}

.detail-value.amount {
    color: var(--primary-400);
}

.detail-value.deadline {
    color: var(--warning-400);
}

.detail-value.collected {
    color: var(--success-400);
}

.detail-value.pending {
    color: var(--danger-400);
}

/* Progress Bar */
.progress-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.progress-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.progress-percent {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-400);
}

.progress-bar {
    height: 6px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
    border-radius: 3px;
    transition: width 0.6s ease;
}

.progress-fill.complete {
    background: linear-gradient(90deg, var(--success-500), var(--success-400));
}

.progress-fill.overdue {
    background: linear-gradient(90deg, var(--danger-500), var(--danger-400));
}

/* === Daily Entry === */
.daily-entry-header {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 24px;
}

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

.date-picker-group label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-picker-group input[type="date"] {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 10px 16px;
    outline: none;
    transition: all var(--transition-fast);
}

.date-picker-group input[type="date"]:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.daily-entry-header .search-bar {
    flex: 1;
}

.daily-entry-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.daily-entry-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: all var(--transition-fast);
}

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

.daily-entry-card.entered {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.04);
}

.entry-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
}

.entry-customer-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.entry-customer-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

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

.entry-customer-details .customer-type-badge {
    color: var(--primary-400);
    font-size: 0.64rem;
}

.entry-customer-details .customer-type-badge.saving {
    color: var(--success-400);
}

.entry-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.entry-expand-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.daily-entry-card:hover .entry-expand-toggle,
.entry-expand-toggle.open {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.entry-expand-toggle svg {
    transition: transform var(--transition-fast);
}

.entry-expand-toggle.open svg {
    transform: rotate(180deg);
}

.entry-card-body {
    display: none;
    padding-top: 16px;
}

.entry-card-body.open {
    display: block;
}

.entry-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entry-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-400);
}

.entry-status.done {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-400);
}

.amount-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.amount-chip {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.amount-chip:hover {
    border-color: var(--primary-500);
    color: var(--primary-400);
    background: rgba(99, 102, 241, 0.08);
}

.amount-chip.selected {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-500);
    color: var(--primary-400);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

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

.manual-amount-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 16px;
    transition: all var(--transition-fast);
}

.manual-amount-input:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.manual-amount-input span {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1rem;
}

.manual-amount-input input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    padding: 10px 0;
}

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

/* === Records === */
.records-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.records-controls .search-bar {
    flex: 1;
    margin-bottom: 0;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}

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

.record-card-header {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.record-card-header:hover {
    background: rgba(99, 102, 241, 0.04);
}

.record-summary {
    display: flex;
    align-items: center;
    gap: 14px;
}

.record-summary-stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.record-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

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

.record-stat-value {
    font-size: 0.9rem;
    font-weight: 700;
}

.record-toggle {
    color: var(--text-muted);
    transition: transform var(--transition-base);
}

.record-toggle.open {
    transform: rotate(180deg);
}

.record-card-body {
    padding: 0 24px 20px;
    display: none;
}

.record-card-body.open {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

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

.record-table {
    width: 100%;
    border-collapse: collapse;
}

.record-table th,
.record-table td {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.record-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
}

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

.record-table tr:hover td {
    background: rgba(99, 102, 241, 0.04);
}

.record-delete-btn {
    background: none;
    border: none;
    color: var(--danger-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
}

.record-delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease;
}

.modal-lg {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

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

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

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* === Forms === */
form {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

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

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

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

.form-group input,
.form-group select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.form-group select {
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 8px;
}

/* === Toast Notifications === */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.success {
    border-left: 3px solid var(--success-500);
}

.toast.error {
    border-left: 3px solid var(--danger-500);
}

.toast.info {
    border-left: 3px solid var(--info-500);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

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

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* === Payment item in recent === */
.payment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

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

.payment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.payment-name {
    font-size: 0.88rem;
    font-weight: 600;
}

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

.payment-amount {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--success-400);
}

/* === Deadline item === */
.deadline-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.deadline-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.deadline-name {
    font-size: 0.88rem;
    font-weight: 600;
}

.deadline-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.deadline-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.deadline-badge.urgent {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-400);
}

.deadline-badge.soon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-400);
}

.deadline-badge.safe {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-400);
}

.deadline-badge.overdue {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-400);
}

/* === Detail Modal Styles === */
.detail-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.detail-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.detail-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.detail-phone-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.detail-stat-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.detail-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.detail-stat-value {
    font-size: 1.15rem;
    font-weight: 800;
    margin-top: 6px;
}

.detail-payments-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.detail-payment-list {
    max-height: 300px;
    overflow-y: auto;
}

/* === Confirm Dialog === */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
    animation: fadeIn 0.15s ease;
}

.confirm-dialog {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.2s ease;
}

.confirm-dialog p {
    font-size: 0.95rem;
    margin-bottom: 20px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* === Responsive === */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .daily-entry-header {
        flex-direction: column;
        align-items: stretch;
    }

    .customers-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 16px;
    }

    .view {
        padding: 20px 16px;
    }

    .record-summary-stats {
        display: none;
    }

    .customer-details {
        grid-template-columns: 1fr;
    }

    .entry-card-top,
    .entry-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .entry-card-actions {
        justify-content: space-between;
    }

    .daily-entry-card, .customer-card, .record-card {
        padding: 12px 16px;
    }

    .customer-checkbox {
        margin-right: 8px;
    }

    .entry-customer-info {
        gap: 8px;
    }

    .chart-section, .card-body, .stat-card {
        padding: 12px;
    }

    .report-summary-cards .stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }

    .report-summary-cards .stat-icon {
        width: 36px;
        height: 36px;
    }

    .report-summary-cards .stat-icon svg {
        width: 18px;
        height: 18px;
    }

    .report-summary-cards .stat-label {
        font-size: 0.6rem;
        white-space: normal;
        line-height: 1.2;
    }

    .report-summary-cards .stat-value {
        font-size: 1.1rem;
    }

    .chart-container {
        height: 200px;
    }

    .reports-grid {
        gap: 12px;
    }

    .topbar-actions .btn span {
        display: none;
    }
}

/* ========================================
   LOCK SCREEN
   ======================================== */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lock-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.lock-screen.active {
    display: flex;
}

.lock-screen-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    max-width: 320px;
    width: 100%;
    padding: 20px;
}

.lock-logo {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.lock-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
    margin-bottom: 8px;
}

.lock-logo h2 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-300), var(--primary-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lock-logo p {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* PIN Display Dots */
.pin-display {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.pin-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--gray-600);
    background: transparent;
    transition: all 0.2s ease;
}

.pin-dot.filled {
    background: var(--primary-400);
    border-color: var(--primary-400);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
    transform: scale(1.1);
}

.pin-dot.error {
    border-color: var(--danger-400);
    background: var(--danger-400);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.pin-error {
    font-size: 0.85rem;
    color: var(--danger-400);
    min-height: 24px;
    text-align: center;
    font-weight: 500;
}

/* PIN Keypad */
.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 280px;
}

.pin-key {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(30, 30, 50, 0.5);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    backdrop-filter: blur(8px);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.pin-key:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary-500);
    transform: scale(1.05);
}

.pin-key:active {
    transform: scale(0.95);
    background: rgba(99, 102, 241, 0.2);
}

.pin-key-empty {
    visibility: hidden;
}

.pin-key-delete {
    color: var(--text-muted);
    font-size: 1rem;
}

.pin-key-delete:hover {
    color: var(--danger-400);
    border-color: var(--danger-400);
    background: rgba(239, 68, 68, 0.08);
}

/* Shake animation for wrong PIN */
@keyframes pinShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-8px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(8px);
    }
}

.pin-display.shake {
    animation: pinShake 0.5s ease;
}

/* PIN Setup Modal Body */
.pin-setup-body {
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.pin-setup-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

/* ========================================
   SETTINGS PAGE
   ======================================== */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 680px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.settings-section-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-section-header svg {
    color: var(--primary-400);
    flex-shrink: 0;
}

.settings-section-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.settings-section-body {
    padding: 8px 0;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    gap: 16px;
    transition: background var(--transition-fast);
}

.settings-item:hover {
    background: rgba(99, 102, 241, 0.04);
}

.settings-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.settings-item-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-item-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.settings-item-action {
    flex-shrink: 0;
}

/* Settings Inputs */
.settings-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
    width: 200px;
}

.settings-input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.settings-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.settings-select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-700);
    border-radius: 26px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary-500);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

/* Settings Action Buttons */
.settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.settings-btn-primary {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary-400);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.settings-btn-primary:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-500);
}

.settings-btn-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-400);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.settings-btn-success:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success-500);
}

.settings-btn-info {
    background: rgba(59, 130, 246, 0.12);
    color: var(--info-400);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.settings-btn-info:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--info-500);
}

.settings-btn-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning-400);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.settings-btn-warning:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--warning-500);
}

/* Danger Zone */
.settings-section.danger-zone {
    border-color: rgba(239, 68, 68, 0.2);
}

.settings-section.danger-zone .settings-section-header {
    border-bottom-color: rgba(239, 68, 68, 0.15);
}

.settings-section.danger-zone .settings-section-header svg {
    color: var(--danger-400);
}

.settings-section.danger-zone .settings-section-header h3 {
    color: var(--danger-400);
}

.settings-btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-400);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.settings-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger-500);
}

/* Settings divider */
.settings-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0 24px;
}

/* App version / about */
.settings-about {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.settings-about .app-version {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* === Reports View === */
.reports-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 16px;
}

.report-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.chart-section h3,
.defaulters-section h3 {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

.defaulters-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.defaulters-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.defaulter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--danger-500);
    transition: all var(--transition-fast);
}

.defaulter-item:hover {
    background: rgba(239, 68, 68, 0.05);
}

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

.defaulter-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.defaulter-details h4 {
    margin-bottom: 4px;
    color: var(--text-primary);
}

.defaulter-details p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

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

.defaulter-status .days {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--danger-500);
}

.defaulter-status .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* === Phase 4: Bulk Entry & Areas === */
.bulk-action-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease;
}

#bulkSelectedCount {
    font-weight: 600;
    color: var(--primary-400);
}

.daily-entry-controls {
    display: flex;
    gap: 12px;
}

.daily-entry-controls select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
}

.customer-checkbox {
    margin-right: 16px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-500);
}

.daily-entry-item-header {
    display: flex;
    align-items: center;
}

/* WhatsApp Reminder Button */
.btn-whatsapp {
    background: rgba(37, 211, 102, 0.15);
    color: #25D366;
    border: 1px solid rgba(37, 211, 102, 0.3);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-whatsapp:hover {
    background: rgba(37, 211, 102, 0.25);
    transform: translateY(-1px);
}

/* === Phase 5: Receipts === */
.receipt-card {
    background: #ffffff;
    color: #111827;
    padding: 24px;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
    font-family: 'Inter', sans-serif;
    margin: 10px 0;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.receipt-header h2 {
    margin: 0 0 4px 0;
    font-size: 1.25rem;
    color: #111827;
}

.receipt-header p {
    margin: 0;
    color: #6b7280;
    font-size: 0.85rem;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.receipt-row span {
    color: #4b5563;
}

.receipt-amount {
    font-size: 1.1rem;
    color: #059669;
}

.receipt-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px dashed #e5e7eb;
    font-size: 0.85rem;
    color: #6b7280;
}

/* === Phase 6: Photos & IDs === */
.photo-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.photo-upload-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.photo-upload-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.photo-upload-wrapper:hover {
    border-color: var(--primary-400);
}

.photo-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.photo-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background-size: cover;
    background-position: center;
}

.id-upload-wrapper {
    position: relative;
    width: 100%;
    height: 120px;
    background: var(--bg-input);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
}

.id-upload-wrapper:hover {
    border-color: var(--primary-400);
}

.id-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.id-upload-text {
    color: var(--text-muted);
    font-weight: 500;
}

.id-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.customer-avatar.has-photo {
    background: none;
    color: transparent;
}

.detail-avatar.has-photo {
    background: none;
    color: transparent;
    border: 2px solid var(--primary-400);
}

/* Settings responsive */
@media (max-width: 600px) {
    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .settings-input {
        width: 100%;
    }

    .pin-key {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
    }

    .pin-keypad {
        gap: 8px;
    }

    .settings-item-action {
        align-self: flex-end;
    }
}
/* === Export Reports Card === */
.export-reports-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.export-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 8px;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.export-option:hover {
    background: var(--bg-input);
}

.export-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-500);
}

.export-button-group {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}
/* ========================================
   LOGIN GATE UI
   ======================================== */
.app-ui {
    display: none;
    width: 100%;
    height: 100%;
    flex: 1;
}

.app-ui.active {
    display: flex;
    flex-direction: column;
}

#loginUI,
#onboardingUI,
#pendingApprovalUI,
#joinOrgUI,
#createOrgUI {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body);
    z-index: 1000;
    overflow-y: auto;
}

#loginUI.active {
    display: flex;
}

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
    transition: background 0.2s;
}
.google-btn:hover {
    background: #f8f9fa;
}

#loginUI input:disabled,
#loginUI button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* === Splash / Syncing Overlay === */
#syncSplash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-body, #000);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
#syncSplash.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
#syncSplash .splash-logo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-500, #6366f1), var(--primary-700, #4338ca));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 24px;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}
#syncSplash .splash-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--primary-400, #818cf8);
    border-radius: 50%;
    animation: splashSpin 0.8s linear infinite;
    margin-bottom: 16px;
}
#syncSplash .splash-text {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.02em;
}
@keyframes splashSpin {
    to { transform: rotate(360deg); }
}
/* Also provide the spin keyframe used by the org.js inline overlay */
@keyframes spin {
    to { transform: rotate(360deg); }
}
