:root {
    --primary: #6366f1;
    --primary-grad: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow: 0 4px 12px -2px rgba(0,0,0,0.05), 0 2px 6px -1px rgba(0,0,0,0.03);
}

html, body {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Readex Pro', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    user-select: none;
}

.app-shell {
    max-width: 450px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg);
}

/* App Bar */
.app-bar {
    height: 64px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-bar h1 {
    font-size: 1.1rem;
    font-weight: 700;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--surface);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
}

/* Screens */
.screens-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 100px;
}

.screen {
    display: none;
    animation: slideUp 0.3s ease-out;
}

.screen.active {
    display: block;
}

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

/* Hero Card - Steps */
.hero-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.progress-container {
    position: relative;
    width: 220px;
    height: 220px;
    margin-bottom: 32px;
}

.progress-svg {
    transform: rotate(-90deg);
}

.track {
    fill: none;
    stroke: #f1f5f9;
    stroke-width: 8;
}

.fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.counter-value {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.counter-label {
    font-size: 0.9rem;
    color: var(--muted);
    margin-top: 4px;
}

.quick-stats {
    width: 100%;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
}

.stat-box {
    text-align: center;
    flex: 1;
}

.stat-box .val {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-box .lab {
    font-size: 0.75rem;
    color: var(--muted);
}

.stat-divider {
    width: 1px;
    height: 24px;
    background: #e2e8f0;
}

/* Buttons */
.app-btn-primary {
    width: 100%;
    height: 56px;
    background: var(--primary-grad);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 8px 16px -4px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s;
}

.app-btn-primary:active { transform: scale(0.97); }

.app-btn-danger {
    width: 100%;
    height: 52px;
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fee2e2;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Cards & Lists */
.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.chart-wrapper {
    height: 180px;
}

.list-item {
    background: var(--surface);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.item-title { font-weight: 600; font-size: 0.9rem; display: block; }
.item-sub { font-size: 0.8rem; color: var(--muted); }

.item-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--muted);
}

.item-badge.success { background: #d1fae5; color: var(--success); }

/* Settings Components */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.setting-info { display: flex; flex-direction: column; gap: 2px; }
.setting-label { font-size: 0.9rem; font-weight: 600; }
.setting-desc { font-size: 0.75rem; color: var(--muted); }

.stepper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    padding: 4px;
    border-radius: 12px;
}

.step-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: white;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.step-value { font-weight: 700; font-size: 0.9rem; min-width: 50px; text-align: center; }

/* Toggle */
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; inset: 0;
    background-color: #e2e8f0; transition: .3s; border-radius: 24px;
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }

/* Bottom Tabs */
.bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 450px;
    height: 72px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    padding: 0 10px;
    border-top: 1px solid #f1f5f9;
    z-index: 100;
}

.tab-item {
    flex: 1;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--muted);
    transition: 0.2s;
}

.tab-item span { font-size: 0.7rem; font-weight: 600; }
.tab-item.active { color: var(--primary); }

/* Toast & Dialog */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 1000;
    transition: 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast-content {
    background: var(--text);
    color: white;
    padding: 12px 20px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2000;
}

.dialog {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.dialog-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.dialog-text { font-size: 0.9rem; color: var(--muted); margin-bottom: 24px; }
.dialog-actions { display: flex; gap: 12px; }
.dialog-actions button { flex: 1; height: 44px; border-radius: 12px; border: none; font-weight: 600; }
.btn-ghost { background: #f1f5f9; color: var(--text); }
.btn-danger-solid { background: var(--danger); color: white; }

.hidden { display: none !important; }
.empty-msg { text-align: center; padding: 20px; color: var(--muted); font-size: 0.85rem; }
