:root {
    --primary: #2563eb; /* Bright Blue */
    --primary-dark: #1e40af;
    --bg: #f3f4f6;
    --surface: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }

body { background-color: var(--bg); color: var(--text); padding-bottom: 80px; /* Space for sticky footer */ }

/* App Header */
.app-header { background: var(--primary); color: white; padding: 15px 20px; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.app-header h1 { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }

/* Container */
.container { max-width: 900px; margin: 0 auto; padding: 15px; }

/* Navigation */
.nav-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 20px; background: white; padding: 8px; border-radius: var(--radius); box-shadow: var(--shadow); }
.tab-btn { background: none; border: none; padding: 8px 2px; border-radius: 8px; color: var(--text-light); font-size: 0.7rem; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; transition: all 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-btn i { font-size: 1.1rem; }
.tab-btn.active { background: #eff6ff; color: var(--primary); font-weight: 600; }

/* Sections */
.tab-content { display: none; animation: fadeIn 0.2s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.card-title { font-weight: 700; color: var(--text); font-size: 1rem; }
.badge { font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; background: #e0e7ff; color: var(--primary-dark); font-weight: 600; }

/* Date Navigation */
.date-nav { display: flex; align-items: center; justify-content: space-between; background: white; padding: 10px; border-radius: var(--radius); margin-bottom: 16px; box-shadow: var(--shadow); }
.date-btn { background: #f3f4f6; border: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text); cursor: pointer; font-size: 1.1rem; }
.date-display { text-align: center; }
.date-display .day { font-size: 0.8rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 1px; }
.date-display .date { font-size: 1.1rem; font-weight: 700; color: var(--primary); }

/* Stepper Inputs */
.input-group { margin-bottom: 16px; }
.input-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
.stepper-container { display: flex; align-items: center; gap: 10px; }
.stepper-btn { width: 48px; height: 48px; border-radius: 12px; border: none; background: #eff6ff; color: var(--primary); font-size: 1.5rem; display: flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; }
.stepper-btn:active { background: var(--primary); color: white; }
.stepper-input { flex: 1; text-align: center; font-size: 1.2rem; font-weight: 700; border: 2px solid var(--border); border-radius: 12px; padding: 10px; -moz-appearance: textfield; }

/* Summary Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.stat-box { background: #f8fafc; padding: 12px; border-radius: 8px; text-align: center; border: 1px solid var(--border); }
.stat-label { font-size: 0.75rem; color: var(--text-light); margin-bottom: 4px; }
.stat-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.stat-value.money { color: var(--success); }

/* Progress Bars */
.progress-wrapper { margin-top: 15px; }
.progress-header { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 5px; color: var(--text-light); }
.progress-track { height: 10px; background: #e5e7eb; border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); transition: width 0.3s ease; }

/* Sticky Footer */
.sticky-footer { position: fixed; bottom: 0; left: 0; width: 100%; background: white; padding: 12px 15px; border-top: 1px solid var(--border); box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.05); display: flex; gap: 10px; z-index: 100; }
.btn-main { flex: 1; background: var(--primary); color: white; border: none; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-main:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-secondary { background: #f3f4f6; color: var(--text); border: 1px solid var(--border); }

/* Calendar & Tables */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { aspect-ratio: 1; background: white; border: 1px solid var(--border); border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.8rem; position: relative; }
.cal-day.has-data { border-color: var(--primary); background: #eff6ff; font-weight: bold; }
.cal-dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; margin-top: 4px; display: none; }
.cal-day.has-data .cal-dot { display: block; }

.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 800px; font-size: 0.75rem; }
th, td { padding: 8px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f9fafb; font-weight: 600; white-space: nowrap; }
.unit-col { color: var(--text-light); background: #fcfcfc; text-align: center; }

/* Guide Specifics */
.guide-section h3 { color: var(--primary); font-size: 1rem; margin-bottom: 8px; }
.guide-section ul { padding-left: 20px; margin-bottom: 10px; font-size: 0.9rem; color: var(--text); }
.guide-section li { margin-bottom: 6px; }
.guide-note { background: #fffbeb; border-left: 4px solid var(--warning); padding: 10px; font-size: 0.85rem; color: #92400e; margin: 10px 0; border-radius: 4px; }

/* Alerts */
.alert { padding: 12px; border-radius: 8px; margin-bottom: 10px; font-size: 0.9rem; display: none; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

/* Copyright Footer Style */
.copyright-text { text-align: center; color: #9ca3af; font-size: 0.75rem; margin-top: 20px; padding-bottom: 10px; }

/* Export Controls */
.export-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 15px; }
.btn-export { padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: white; color: var(--text); font-size: 0.8rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.btn-export:active { background: #f9fafb; }
.btn-export i { font-size: 1.2rem; color: var(--primary); }

/* Utility */
.hidden { display: none !important; }
.text-sm { font-size: 0.85rem; line-height: 1.4; color: var(--text-light); }

/* Print / PDF Output Settings */
@media print {
    .sticky-footer, .nav-tabs, .date-nav, .stepper-btn, .export-grid, .card-header button, .copyright-text { display: none !important; }
    #calendarMonthCard { display: none !important; } /* Hides the calendar grid */
    body { padding-bottom: 0; background: white; }
    .container { max-width: 100%; padding: 0; }
    .card { border: none; box-shadow: none; margin: 0; padding: 0; }
    #calendar { display: block !important; }
    .table-wrapper { overflow: visible; }
    table { min-width: 100%; font-size: 9pt; }
    td, th { padding: 4px; }
}