* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding-bottom: 80px;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

header {
    background: var(--primary);
    color: white;
    padding: 16px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.date-display {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 4px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .icon {
    font-size: 1.25rem;
}

/* Meals */
.meal {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.meal:last-child {
    border-bottom: none;
}

.meal-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 4px;
}

.meal-description {
    font-size: 0.9375rem;
}

.meal-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.meal-checkbox input {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.meal-checkbox.completed .meal-description {
    text-decoration: line-through;
    color: var(--text-light);
}

.meal-content {
    flex: 1;
}

.meal-description {
    position: relative;
    cursor: pointer;
}

.meal-description .edit-icon {
    font-size: 0.75rem;
    margin-left: 6px;
    opacity: 0.5;
}

.meal-description:hover .edit-icon {
    opacity: 1;
}

.meal-description.variance {
    color: var(--primary);
    font-weight: 500;
}

.meal-planned {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 4px;
}

.meal-description.editable:hover {
    background: var(--bg);
    border-radius: 4px;
    margin: -4px;
    padding: 4px;
}

/* Water tracker */
.water-tracker {
    text-align: center;
}

.water-count {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
}

.water-label {
    color: var(--text-light);
    margin-bottom: 12px;
}

.water-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.water-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.water-btn:hover {
    background: var(--primary-dark);
}

.water-btn-minus {
    background: var(--danger);
}

.water-btn-minus:hover {
    background: #dc2626;
}

/* Walk tracker */
.walk-status {
    text-align: center;
    padding: 12px 0;
}

.walk-time {
    font-size: 1.25rem;
    font-weight: 600;
}

.walk-duration {
    color: var(--success);
    font-weight: 600;
}

.walk-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 12px;
}

.btn {
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.metric-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
}

/* Input groups */
.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-row .input-group {
    flex: 1;
}

/* Alcohol tracker */
.alcohol-today {
    text-align: center;
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.alcohol-today span {
    font-weight: 700;
    font-size: 1.5rem;
}

.alcohol-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.drink-btn {
    padding: 12px 8px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.drink-btn:hover {
    border-color: var(--warning);
    background: #fef3c7;
}

.alcohol-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.alcohol-toggle button {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.alcohol-toggle button.active-no {
    border-color: var(--success);
    background: #dcfce7;
    color: var(--success);
}

.alcohol-toggle button.active-yes {
    border-color: var(--warning);
    background: #fef3c7;
    color: var(--warning);
}

.alcohol-minus {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: white !important;
}

.streak-badge {
    display: inline-block;
    background: var(--success);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Coffee tracker */
.coffee-tracker {
    text-align: center;
}

.coffee-count {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.coffee-count span {
    font-weight: 700;
    font-size: 1.5rem;
}

.coffee-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Off Plan */
.card-offplan {
    border-left: 4px solid var(--danger);
}

.offplan-input {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.offplan-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.offplan-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.offplan-quick button {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.offplan-quick button:hover {
    border-color: var(--danger);
    background: #fef2f2;
}

.offplan-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.offplan-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--danger);
}

.offplan-item .remove {
    cursor: pointer;
    opacity: 0.6;
}

.offplan-item .remove:hover {
    opacity: 1;
}

/* Snacks */
.snacks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.snack-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-light);
    margin-top: 8px;
}

.snack-item {
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.9375rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.snack-item:hover {
    background: #e2e8f0;
}

.snack-item:active {
    background: #cbd5e1;
}

.snack-count {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Bottom nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.75rem;
    cursor: pointer;
    border: none;
    background: none;
}

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

.nav-item .icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* History charts placeholder */
.chart-container {
    height: 200px;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9375rem;
    z-index: 1000;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

/* BP colors */
.bp-normal { color: var(--success); }
.bp-elevated { color: var(--warning); }
.bp-high { color: var(--danger); }

/* History list */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 6px;
}

.history-date {
    color: var(--text-light);
    font-size: 0.875rem;
}

.history-value {
    font-weight: 600;
}

/* Install prompt */
.install-prompt {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.install-prompt button {
    background: white;
    color: var(--primary);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* Report */
.report-container {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.report-loading {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

.report-error {
    color: var(--danger);
    padding: 12px;
    background: #fef2f2;
    border-radius: 8px;
}
