@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg-main: #0c111d;
    --card-bg: rgba(23, 29, 45, 0.7);
    --accent-blue: #4f46e5;
    --accent-indigo: #6366f1;
    --accent-cyan: #22d3ee;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-dim: #64748b;
    --glass-border: rgba(255, 255, 255, 0.08);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-dim: #94a3b8;
    --glass-border: rgba(0, 0, 0, 0.08);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-main) !important;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Gradients */
body::before {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(79, 70, 229, 0.08) 0%, transparent 50%);
    z-index: -2;
    pointer-events: none;
}

/* Classroom Scene */
.academic-background {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none;
}

.bg-scene {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('classroom_graphics_bg_1773429551495.png');
    background-size: cover; background-position: center;
    opacity: 0.12; mix-blend-mode: overlay;
    filter: brightness(0.4) contrast(1.1);
    animation: slowZoom 80s infinite alternate linear;
}

[data-theme="light"] .bg-scene { opacity: 0.08; mix-blend-mode: multiply; filter: none; }

@keyframes slowZoom {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

.floating-elements { position: absolute; width: 100%; height: 100%; overflow: hidden; }
.floating-item { position: absolute; opacity: 0.25; animation: float 25s infinite linear; color: var(--accent-cyan); }

@keyframes float {
    from { transform: translate(0, 0) rotate(0deg); }
    to { transform: translate(140px, -140px) rotate(360deg); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
    width: 100%;
}

/* Header - Aligned Centered Branding */
.dashboard-header { 
    display: flex;
    flex-direction: column;
    align-items: center; 
    text-align: center;
    margin-bottom: 3.5rem;
    gap: 1.5rem;
    width: 100%;
}
.header-branding {
    margin-bottom: 0.25rem;
    width: 100%;
}
.logo-text {
    font-size: clamp(2.2rem, 6vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    line-height: 1.15;
}
.logo-text span { color: var(--accent-cyan); }
.tagline { 
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    font-weight: 600;
    color: var(--accent-emerald); 
    margin: 0.5rem 0 0.8rem;
    opacity: 0.95;
    line-height: 1.4;
}
.header-date {
    color: var(--text-secondary);
    font-size: clamp(0.85rem, 2vw, 1.05rem);
    font-weight: 500;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

/* Stats Row - Perfect Grid Alignment */
.stats-overview {
    margin-bottom: 3.5rem;
    width: 100%;
}
.stats-row { 
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    width: 100%;
}

.glass-card {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    transition: var(--transition);
}

.stat-card {
    padding: 1.75rem 1.25rem;
    display: flex;
    flex-direction: column; 
    align-items: center;
    text-align: center;
    justify-content: center;
    gap: 0.6rem;
    height: 100%;
    min-width: 0;
}
.stat-card:hover { transform: translateY(-5px); border-color: var(--accent-blue); }

.stat-lbl {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: normal;
    word-break: break-word;
}
.stat-val {
    font-size: clamp(2rem, 4.5vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.1;
    word-break: break-word;
}
.stat-val.highlight { color: var(--accent-cyan); }
.stat-sub {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.highlight-card { border-color: var(--accent-indigo) !important; box-shadow: 0 10px 40px rgba(99, 102, 241, 0.12); }

.mini-progress-track { width: 100%; height: 6px; background: rgba(0,0,0,0.2); border-radius: 10px; margin-top: 0.5rem; overflow: hidden; }
[data-theme="dark"] .mini-progress-track { background: rgba(255,255,255,0.05); }
.mini-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); border-radius: 10px; transition: width 1s ease; }

/* Subjects Grid */
.section-title {
    font-size: clamp(1.4rem, 3.5vw, 1.8rem);
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
}
.subject-grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.subject-card {
    padding: 1.75rem;
    min-width: 0;
}
.subject-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    word-break: break-word;
}

/* Vivid Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    color: white; padding: 0.9rem 2.2rem;
    border-radius: 16px; font-weight: 800; border: none; cursor: pointer;
    transition: var(--transition); display: flex; align-items: center; gap: 0.8rem;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
    position: relative; overflow: hidden;
}

.btn-vivid {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
    animation: pulseGlow 3s infinite;
}

.btn-vivid::after {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg); transition: 0.8s;
}

.btn-vivid:hover::after { left: 100%; top: 100%; }

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.btn-primary:active { transform: scale(0.95); }
.btn-glow:hover { box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5); transform: translateY(-3px); }

.icon-btn-bordered {
    width: 50px; height: 50px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04); border: 1px solid var(--glass-border);
    color: var(--text-secondary); cursor: pointer; transition: var(--transition);
}
.icon-btn-bordered:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); border-color: var(--text-primary); }

/* Optimized Theme Settings */
.theme-section-optimized { display: flex; flex-direction: column !important; align-items: stretch !important; margin-bottom: 2rem; }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.5rem; }
.theme-card { 
    display: flex; flex-direction: column; align-items: center; gap: 0.8rem; padding: 1.5rem 0.5rem;
    background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border); border-radius: 20px;
    cursor: pointer; transition: var(--transition); color: var(--text-secondary);
}
.theme-card i { width: 22px; height: 22px; pointer-events: none; }
.theme-card span { font-size: 0.85rem; font-weight: 700; pointer-events: none; }
.theme-card:hover { background: rgba(255,255,255,0.08); transform: translateY(-3px); }
.theme-card.active { 
    background: var(--accent-blue); color: white; border-color: var(--accent-blue);
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
}
[data-theme="light"] .theme-card { background: rgba(0,0,0,0.03); }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(2, 6, 23, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.modal-overlay.active {
    display: flex;
    animation: modalIn 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
}

body.modal-open {
    overflow: hidden !important;
}

.modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 2.5rem 2rem;
    border-radius: 28px;
    border: 1px solid var(--glass-border);
    max-width: 650px;
    width: 100%;
    position: relative;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    margin: auto; /* Vital for flexbox: allows clean scrolling when taller than viewport */
    max-height: calc(100dvh - 2.5rem);
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.history-modal-content { max-height: calc(100dvh - 2.5rem); }

@keyframes modalIn { from { opacity: 0; transform: translateY(30px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    position: sticky;
    top: -2.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
    background: transparent;
    z-index: 10;
}
.modal-title { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1.2; }

.close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.close-btn:hover, .close-btn:active {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-rose);
    border-color: var(--accent-rose);
    transform: scale(1.08);
}

/* Secondary and Utility Buttons */
.btn-secondary-outline {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.8rem 1.6rem;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-secondary-outline:hover, .btn-secondary-outline:active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #ffffff !important;
    border: none !important;
}
.btn-success:hover {
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #f43f5e, #e11d48) !important;
    color: #ffffff !important;
    border: none !important;
}
.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
    transform: translateY(-2px);
}

.btn:disabled, .btn-success:disabled, .btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Form Layout Optimized */
.form-row { display: flex; gap: 1.5rem; width: 100%; margin-bottom: 1.8rem; }
.form-row .form-group { flex: 1; margin-bottom: 0; }
.form-group { text-align: left; margin-bottom: 1.8rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.form-input {
    width: 100%; padding: 1rem 1.25rem; border-radius: 14px;
    background: rgba(0,0,0,0.2); border: 1px solid var(--glass-border);
    color: var(--text-primary); font-size: 0.95rem; font-weight: 500;
    transition: var(--transition);
}
[data-theme="light"] .form-input { background: rgba(0,0,0,0.03); }
.form-input:focus { 
    outline: none; border-color: var(--accent-blue); 
    background: rgba(0,0,0,0.3); 
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); 
}

.days-selector { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; }
.day-checkbox { 
    display: flex; align-items: center; gap: 0.5rem; 
    padding: 0.6rem 1rem; border-radius: 10px;
    background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border);
    cursor: pointer; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
    transition: var(--transition);
}
.day-checkbox:hover { background: rgba(255,255,255,0.08); }
.day-checkbox input { accent-color: var(--accent-cyan); cursor: pointer; }
.day-checkbox:has(input:checked) { 
    background: rgba(34, 211, 238, 0.1); 
    border-color: var(--accent-cyan); 
    color: var(--text-primary); 
}

/* Coffee Support Button & Feature */
.btn-coffee {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    color: #ffffff;
    padding: 0.9rem 1.8rem;
    border-radius: 16px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.35);
    position: relative;
    overflow: hidden;
}

.btn-coffee:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
}

.btn-coffee:active {
    transform: scale(0.96);
}

.btn-coffee i {
    width: 20px;
    height: 20px;
}

.btn-sm {
    padding: 0.5rem 1rem !important;
    font-size: 0.82rem !important;
    border-radius: 10px !important;
}

/* Dashboard Footer */
.dashboard-footer {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-credit {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.heart-icon {
    width: 16px;
    height: 16px;
    color: var(--accent-rose);
    fill: var(--accent-rose);
    animation: heartBeat 1.8s infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Coffee Modal Styling */
.coffee-modal-content {
    max-width: 720px;
}

.modal-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.modal-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.coffee-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--accent-amber);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.coffee-modal-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* QR Code Card */
.qr-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.9rem;
}

[data-theme="light"] .qr-card {
    background: rgba(0, 0, 0, 0.03);
}

.qr-card-header {
    width: 100%;
    display: flex;
    justify-content: center;
}

.payee-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.shield-icon {
    width: 14px;
    height: 14px;
    color: var(--accent-emerald);
}

.qr-frame {
    background: #ffffff;
    padding: 0.85rem;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-image {
    width: 180px;
    height: 180px;
    display: block;
    border-radius: 4px;
}

.qr-instruction {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
}

.qr-target-id {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.qr-id-label {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.qr-id-value {
    color: var(--accent-cyan);
    font-weight: 700;
    font-family: monospace;
}

.upi-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-amber);
}

.upi-badge i {
    width: 14px;
    height: 14px;
}

.upi-apps-icons {
    font-size: 0.68rem;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* UPI Details Card */
.upi-details-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.upi-copy-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 0.35rem 0.4rem 0.35rem 0.8rem;
    gap: 0.5rem;
    transition: var(--transition);
}

[data-theme="light"] .upi-copy-box {
    background: rgba(0, 0, 0, 0.03);
}

.upi-copy-box:focus-within {
    border-color: var(--accent-amber);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.upi-id-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    color: var(--accent-amber);
}

.upi-id-badge i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.upi-id-text {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    width: 100%;
    font-family: 'Plus Jakarta Sans', monospace;
}

.btn-copy {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
    color: #ffffff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-copy:hover {
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
    transform: translateY(-1px);
}

.btn-copy:active {
    transform: scale(0.95);
}

.btn-copy i {
    width: 14px;
    height: 14px;
}

/* Preset Amount Chips */
.amount-presets {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.amount-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

[data-theme="light"] .amount-chip {
    background: rgba(0, 0, 0, 0.03);
}

.amount-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--accent-amber);
    transform: translateY(-2px);
}

.amount-chip.active {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--accent-amber);
    color: var(--accent-amber);
    font-weight: 800;
}

/* Quick UPI App Selector Grid */
.upi-apps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

.upi-app-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.6rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

[data-theme="light"] .upi-app-btn {
    background: rgba(0, 0, 0, 0.03);
}

.upi-app-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--accent-cyan);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.15);
}

.upi-app-btn:active {
    transform: scale(0.95);
}

.app-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gpay-icon {
    background: linear-gradient(135deg, #4285F4, #34A853);
}

.phonepe-icon {
    background: linear-gradient(135deg, #5f259f, #8c3eed);
}

.paytm-icon {
    background: linear-gradient(135deg, #00b9f5, #002970);
    font-size: 0.62rem;
}

.bhim-icon {
    background: linear-gradient(135deg, #00875a, #f59e0b);
    font-size: 0.58rem;
}

.app-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.upi-app-btn:hover .app-name {
    color: var(--text-primary);
}

/* Pay via UPI App button */
.btn-pay-upi {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    padding: 0.9rem 1.5rem;
    border-radius: 14px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
    margin-top: 0.5rem;
}

.btn-pay-upi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
    color: #ffffff;
}

.btn-pay-upi:active {
    transform: scale(0.97);
}

.btn-pay-upi i {
    width: 18px;
    height: 18px;
}

.direct-pay-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 0.5rem;
}

.upi-security-notice {
    margin-top: 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.2);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-secondary);
    text-align: left;
}

[data-theme="light"] .upi-security-notice {
    background: rgba(34, 211, 238, 0.05);
    border-color: rgba(34, 211, 238, 0.3);
}

.upi-security-notice i {
    width: 16px;
    height: 16px;
    color: var(--accent-cyan);
    flex-shrink: 0;
    margin-top: 2px;
}

.upi-security-notice strong {
    color: var(--text-primary);
}

.coffee-modal-footer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Responsive Rules & Mobile Optimization */
@media (max-width: 1200px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .container { padding: 1.5rem 1rem; }
    .dashboard-header { margin-bottom: 2.5rem; gap: 1rem; }
    .logo-text { font-size: 2.3rem; }
    .tagline { font-size: 0.95rem; margin: 0.35rem 0 0.6rem; }
    
    .stats-overview { margin-bottom: 2.5rem; }
    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
    .stat-card { padding: 1.35rem 0.85rem; border-radius: 20px; }
    .stat-val { font-size: 2.1rem; }
    
    .subject-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .subject-card { padding: 1.4rem 1.1rem; border-radius: 20px; }
    
    /* Header Action Buttons on Mobile */
    .header-actions {
        gap: 0.65rem;
        width: 100%;
        justify-content: center;
    }
    .btn-coffee, .btn-primary {
        padding: 0.75rem 1.15rem;
        font-size: 0.85rem;
    }
    .icon-btn-bordered {
        width: 44px;
        height: 44px;
    }
    
    /* Mobile Modal & Form Fixes */
    .modal-overlay {
        padding: 1rem 0.75rem;
        align-items: flex-start; /* Prevents vertical centering clipping */
    }
    .modal-content {
        padding: 1.5rem 1.15rem;
        width: 100%;
        border-radius: 22px;
        margin: auto 0;
        max-height: calc(100dvh - 2rem);
        max-height: calc(100vh - 2rem);
    }
    .modal-header {
        margin-bottom: 1.25rem;
        top: -1.5rem;
        padding-top: 0.25rem;
        padding-bottom: 0.5rem;
    }
    .modal-title {
        font-size: 1.35rem;
    }
    .close-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 1.4rem;
    }
    
    .form-row { flex-direction: column; gap: 1.2rem; margin-bottom: 1.2rem; }
    .form-group { margin-bottom: 1.2rem; }
    .days-selector { justify-content: center; gap: 0.4rem; }
    .day-checkbox { flex: 1 1 calc(25% - 0.4rem); min-width: 65px; justify-content: center; padding: 0.5rem 0.4rem; font-size: 0.75rem; }

    /* Mobile Coffee Modal Fixes */
    .coffee-modal-content {
        max-width: 100%;
    }
    .coffee-modal-body {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    .qr-card {
        padding: 1rem 0.75rem;
        border-radius: 18px;
        gap: 0.75rem;
    }
    .qr-frame {
        padding: 0.6rem;
        border-radius: 14px;
    }
    .qr-image {
        width: 140px;
        height: 140px;
    }
    .qr-target-id {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }
    .upi-apps-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.45rem;
    }
    .upi-app-btn {
        padding: 0.5rem 0.2rem;
        border-radius: 10px;
    }
    .app-icon-circle {
        width: 28px;
        height: 28px;
        font-size: 0.65rem;
    }
    .app-name {
        font-size: 0.68rem;
    }
    .amount-presets {
        gap: 0.4rem;
    }
    .amount-chip {
        padding: 0.45rem 0.65rem;
        font-size: 0.78rem;
        flex: 1;
        text-align: center;
    }
    .btn-pay-upi {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .dashboard-footer {
        flex-direction: column;
        text-align: center;
        margin-top: 3rem;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container { padding: 1.25rem 0.75rem; }
    .logo-text { font-size: 2rem; }
    
    .header-actions {
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        gap: 0.5rem;
    }
    .header-actions .btn-coffee,
    .header-actions .btn-primary {
        padding: 0.7rem 0.5rem;
        font-size: 0.8rem;
        justify-content: center;
        border-radius: 12px;
    }
    .header-actions .btn-coffee i,
    .header-actions .btn-primary i {
        width: 16px;
        height: 16px;
    }
    .header-actions .icon-btn-bordered {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }
    
    .stats-row {
        gap: 0.6rem;
    }
    .stat-card {
        padding: 1.1rem 0.6rem;
    }
    .stat-lbl {
        font-size: 0.65rem;
    }
    .stat-val {
        font-size: 1.75rem;
    }
    .stat-sub {
        font-size: 0.68rem;
    }
    
    /* Subject Card Controls in 2x2 Grid on narrow screens */
    .subject-controls {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.5rem !important;
    }
    .subject-controls .btn-sm {
        height: 38px !important;
        font-size: 0.76rem !important;
    }
    .subject-controls .icon-btn-bordered {
        width: 100% !important;
        height: 38px !important;
        border-radius: 10px !important;
    }
    
    .upi-id-text {
        font-size: 0.88rem;
    }
}

/* Toast & Utilities */
#toast {
    position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
    background: var(--accent-blue); color: white; padding: 1rem 1.8rem;
    border-radius: 16px; font-weight: 700; font-size: 0.88rem; z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    max-width: 90vw;
    text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 10px; }