/* Вътрешен компас — Пастелна, топла тема */
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #d4a0a0;
    --primary-dark: #b87d7d;
    --primary-light: #f0d5d5;
    --primary-deeper: #9a6464;
    --sage: #8fb19a;
    --sage-dark: #5b8775;
    --sage-light: #e6efe2;
    --sage-deeper: #466b5e;
    --secondary: #f5e6ca;
    --secondary-dark: #d4c4a8;
    --accent: #c9b99a;
    --accent-dark: #a89872;
    --bg: #faf7f2;
    --bg-card: #ffffff;
    --bg-input: #fefcf8;
    --text: #4a3f35;
    --text-light: #7a6f63;
    --text-muted: #a99e92;
    --border: #e8e0d4;
    --success: #8fbc8f;
    --success-bg: #e8f5e8;
    --warning: #daa520;
    --warning-bg: #fdf5e6;
    --danger: #cd5c5c;
    --danger-bg: #fde8e8;
    --info: #87ceeb;
    --info-bg: #e8f4f8;
    --shadow: 0 2px 8px rgba(74, 63, 53, 0.08);
    --shadow-lg: 0 4px 16px rgba(74, 63, 53, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
    --nav-height: 60px;
    --bottom-nav-height: 80px;
}

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

body {
    font-family: 'Comfortaa', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
}

/* Typography */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
h2 { font-size: 1.25rem; font-weight: 600; color: var(--text); }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); }
p { margin-bottom: 0.5rem; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top Header */
.top-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    height: var(--nav-height);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow);
}
.top-header .logo { font-size: 1.1rem; font-weight: 700; color: var(--primary-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top-header .user-menu { display: flex; gap: 12px; align-items: center; }
.top-header .user-menu a { color: var(--text-light); font-size: 0.9rem; }
.top-header .user-menu .profile-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--primary-light); color: var(--primary-dark);
    padding: 4px 12px; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
    text-decoration: none; transition: background 0.2s; white-space: nowrap; flex-shrink: 0;
}
.top-header .user-menu .profile-chip:hover { background: var(--primary); color: #fff; }

/* Bottom Navigation */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    height: var(--bottom-nav-height);
    display: flex; align-items: center; justify-content: space-around;
    padding: 0; padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 8px rgba(74, 63, 53, 0.06);
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center;
    font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
    text-decoration: none; padding: 4px 4px;
    transition: color var(--transition);
    gap: 2px; min-width: 0; flex: 1;
}
.bottom-nav a.active { color: var(--primary-dark); }
.bottom-nav a .nav-icon { font-size: 1.3rem; }
.bottom-nav a .nav-label { white-space: nowrap; font-size: 0.8rem; font-weight: 700; }

/* Dashboard hero — Моята програма (dual: rose ring + sage CTA) */
.program-hero {
    display: block;
    color: var(--text);
    text-decoration: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(74, 63, 53, 0.12);
    margin-bottom: 14px;
    background: var(--bg-card);
}
.program-hero .program-hero-band {
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    background:
        radial-gradient(circle at 100% 0%, rgba(255,225,220,0.45), transparent 55%),
        radial-gradient(circle at 0% 100%, rgba(225,239,228,0.55), transparent 55%),
        linear-gradient(135deg, #fff, #faf2ec);
}
.program-hero .program-hero-ring {
    width: 70px; height: 70px;
    flex-shrink: 0;
    position: relative;
}
.program-hero .program-hero-ring svg {
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.program-hero .ph-ring-bg {
    fill: none;
    stroke: rgba(184,125,125,0.18);
    stroke-width: 6;
}
.program-hero .ph-ring-fg {
    fill: none;
    stroke: var(--primary-dark);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s ease;
}
.program-hero .program-hero-ring-text {
    position: absolute;
    inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    line-height: 1;
}
.program-hero .program-hero-ring-num {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}
.program-hero .program-hero-ring-of {
    font-size: 0.65rem;
    color: var(--text-light);
    margin-top: 2px;
}
.program-hero .program-hero-ring-icon {
    color: var(--primary-dark);
}
.program-hero .program-hero-ring-icon svg {
    width: 26px; height: 26px;
}
.program-hero .program-hero-text {
    flex: 1; min-width: 0;
}
.program-hero .program-hero-eyebrow {
    font-size: 0.66rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--primary-dark);
    font-weight: 700;
    margin-bottom: 4px;
}
.program-hero .program-hero-title {
    font-weight: 700;
    font-size: 1.04rem;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: 6px;
}
.program-hero .program-hero-sub {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.4;
}
.program-hero .program-hero-foot {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}
.program-hero .program-hero-meta {
    font-size: 0.78rem;
    color: var(--text-light);
}
.program-hero .program-hero-meta strong {
    color: var(--text);
    font-weight: 700;
}
.program-hero .program-hero-cta {
    background: var(--sage-dark);
    color: #fff;
    padding: 9px 16px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease;
}
.program-hero:hover .program-hero-cta {
    background: var(--sage-deeper);
}
.program-hero.is-free .program-hero-eyebrow,
.program-hero.is-free .ph-ring-fg {
    /* Free state — ring изгасен, акцент остава rose */
}
.program-hero.is-free .program-hero-cta {
    background: linear-gradient(135deg, var(--primary-dark), var(--sage-dark));
}
@media (max-width: 480px) {
    .program-hero .program-hero-band { padding: 18px; gap: 14px; }
    .program-hero .program-hero-ring { width: 60px; height: 60px; }
    .program-hero .program-hero-ring-num { font-size: 1.2rem; }
    .program-hero .program-hero-title { font-size: 0.98rem; }
}

/* Sage action button — за practices/program завършване и старт */
.btn-action {
    background: var(--sage-dark);
    color: #fff !important;
}
.btn-action:hover {
    background: var(--sage-deeper);
    color: #fff !important;
    text-decoration: none;
}

/* User avatar with optional premium ring + crown (dashboard greeting) */
.user-avatar-wrap {
    position: relative;
    display: inline-block;
    margin: 0 auto 12px;
}
.user-avatar {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.6rem;
    box-shadow: var(--shadow);
}
.user-avatar-wrap.is-premium .user-avatar {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #d4a000, var(--shadow);
}
.user-avatar-crown {
    position: absolute;
    top: -4px; right: -6px;
    background: linear-gradient(135deg, #f6c83a, #d4a000);
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.user-avatar-crown svg { width: 13px; height: 13px; color: #fff; }

/* Main Content */
.main-content {
    margin-top: calc(var(--nav-height) + 8px);
    padding: 16px;
    max-width: 600px;
    margin-left: auto; margin-right: auto;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.card-header { margin-bottom: 12px; }
.card-title { font-size: 1rem; font-weight: 600; }
.card-subtitle { font-size: 0.85rem; color: var(--text-light); margin-top: 2px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: var(--radius-sm);
    font-size: 0.95rem; font-weight: 500; cursor: pointer;
    transition: all var(--transition); text-decoration: none;
    font-family: inherit;
}
.btn-primary, a.btn-primary { background: var(--primary-dark); color: #fff !important; font-weight: 600; }
.btn-primary:hover, a.btn-primary:hover { background: #a06868; text-decoration: none; color: #fff !important; }
.btn-secondary { background: var(--secondary); color: var(--text); }
.btn-secondary:hover { background: var(--secondary-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary-dark); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b94a4a; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { padding: 8px; border-radius: 50%; background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text-light); }
.btn-cta {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; padding: 12px 24px; border-radius: var(--radius);
    font-weight: 600; box-shadow: var(--shadow);
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-light); margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 0.95rem;
    background: var(--bg-input); color: var(--text);
    font-family: inherit; transition: border-color var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none; border-color: var(--primary);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; }
.form-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }

/* Checkbox */
.checkbox-group { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.checkbox-group input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: var(--primary-dark); margin-top: 2px; flex-shrink: 0;
}
.checkbox-group label { font-size: 0.85rem; color: var(--text-light); cursor: pointer; }

/* Emotion Picker */
.emotion-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px; margin: 12px 0;
}
.emotion-btn {
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 4px; border: 2px solid var(--border);
    border-radius: var(--radius); cursor: pointer;
    background: var(--bg-card); transition: all var(--transition);
    font-size: 0.8rem; color: var(--text-light); text-align: center;
    gap: 4px; min-width: 0; overflow: hidden;
}
.emotion-btn .emoji { font-size: 1.5rem; }
.emotion-btn span:not(.emoji) { word-break: break-word; line-height: 1.2; }
.emotion-btn:hover { border-color: var(--primary); }
.emotion-btn.selected { border-color: var(--primary-dark); background: var(--primary-light); color: var(--text); }

/* Nuance chips */
.nuance-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.nuance-chip {
    padding: 5px 12px; border-radius: 20px; font-size: 0.8rem;
    background: var(--bg); border: 1.5px solid var(--border);
    cursor: pointer; transition: all var(--transition); color: var(--text-light);
}
.nuance-chip:hover { border-color: var(--primary); }
.nuance-chip.selected { background: var(--primary-light); border-color: var(--primary-dark); color: var(--text); }

/* Intensity slider */
.intensity-slider { margin: 12px 0; }
.intensity-slider input[type="range"] {
    width: 100%; height: 8px; -webkit-appearance: none; appearance: none;
    background: linear-gradient(to right, var(--success), var(--warning), var(--danger));
    border-radius: 4px; outline: none;
}
.intensity-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 24px; height: 24px;
    background: var(--bg-card); border: 2px solid var(--primary-dark);
    border-radius: 50%; cursor: pointer; box-shadow: var(--shadow);
}
.intensity-value {
    text-align: center; font-size: 1.8rem; font-weight: 700;
    color: var(--primary-dark); margin: 8px 0;
}

/* Alerts / Banners */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    margin-bottom: 12px; font-size: 0.9rem;
}
.alert-crisis {
    background: var(--danger-bg); border: 1px solid var(--danger);
    color: #8b3535;
}
.alert-crisis a { color: #8b3535; font-weight: 600; text-decoration: underline; }
.alert-info { background: var(--info-bg); border: 1px solid var(--info); color: #2c6e8a; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); color: #3d6b3d; }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning); color: #8a6e1e; }
.alert-premium {
    background: linear-gradient(135deg, #f5e6ca, #faf0e0);
    border: 1px solid var(--accent); color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.alert-premium .premium-icon { font-size: 1.3rem; }

/* Lists */
.entry-list { list-style: none; }
.entry-item {
    padding: 12px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
    cursor: pointer; transition: background var(--transition);
}
.entry-item:hover { background: var(--bg); }
.entry-item:last-child { border-bottom: none; }
.entry-emoji { font-size: 1.5rem; }
.entry-info { flex: 1; }
.entry-emotion { font-weight: 500; }
.entry-date { font-size: 0.8rem; color: var(--text-muted); }
.entry-intensity {
    font-size: 0.75rem; padding: 2px 8px;
    border-radius: 12px; background: var(--primary-light); color: var(--primary-dark);
}

/* Tabs */
.tabs {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 6px; margin-bottom: 16px; border-bottom: none;
}
.tab {
    padding: 6px 14px; font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
    cursor: pointer; white-space: nowrap; border-radius: 20px;
    border: 1.5px solid var(--border); background: transparent;
    transition: all var(--transition);
}
.tab:hover { color: var(--text); border-color: var(--primary); }
.tab.active { color: var(--primary-dark); border-color: var(--primary-dark); background: var(--primary-light, #f9eded); font-weight: 600; }
@media (max-width: 420px) {
    .tabs { gap: 4px; }
    .tab { padding: 5px 10px; font-size: 0.78rem; }
}

/* Practice cards */
.practice-card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.practice-icon { font-size: 2rem; flex-shrink: 0; }
.practice-info { flex: 1; }
.practice-title { font-weight: 600; font-size: 0.95rem; }
.practice-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.practice-locked { opacity: 0.6; }
.practice-locked::after {
    content: ''; display: none;
}

/* Audio player */
.audio-player {
    background: var(--primary-light); border-radius: var(--radius);
    padding: 14px 16px;
    margin: 12px 0;
}
.audio-row {
    display: flex; align-items: center; gap: 12px; margin-top: 4px;
}
.audio-player .play-btn {
    flex-shrink: 0;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--primary-dark); color: #fff; border: none;
    font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    padding: 0;
}
.audio-player .play-btn:hover:not(:disabled) { transform: scale(1.05); box-shadow: var(--shadow-lg); }
.audio-player .play-btn:disabled { opacity: 0.55; cursor: wait; box-shadow: none; }
.audio-progress {
    flex: 1; height: 6px; background: rgba(0,0,0,0.12); border-radius: 3px;
    cursor: pointer; position: relative;
}
.audio-progress-fill {
    height: 100%; background: var(--primary-dark); border-radius: 3px;
    transition: width 0.1s; pointer-events: none;
}
.audio-controls {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; margin-top: 12px;
}
.audio-skip-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 12px; border-radius: 999px;
    background: rgba(255,255,255,0.5);
    color: var(--primary-dark);
    border: 1px solid rgba(0,0,0,0.06);
    font-family: inherit; font-size: 0.78rem; font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}
.audio-skip-btn:hover { background: rgba(255,255,255,0.85); transform: translateY(-1px); }
.audio-skip-icon { font-size: 0.95rem; line-height: 1; }
.audio-skip-num { letter-spacing: -0.02em; }

/* Timer */
.timer-display { font-size: 2.5rem; font-weight: 300; color: var(--primary-dark); text-align: center; margin: 16px 0; font-variant-numeric: tabular-nums; }

/* Charts placeholder */
.chart-container { width: 100%; height: 250px; margin: 12px 0; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.stat-card {
    background: var(--bg); border-radius: var(--radius-sm);
    padding: 12px; text-align: center;
}
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* Test UI */
.test-question { margin-bottom: 20px; }
.test-question-text { font-weight: 500; margin-bottom: 10px; font-size: 0.95rem; }
.test-options { display: flex; flex-direction: column; gap: 6px; }
.test-option {
    padding: 10px 14px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    transition: all var(--transition); font-size: 0.9rem;
}
.test-option:hover { border-color: var(--primary); background: var(--bg); }
.test-option.selected { border-color: var(--primary-dark); background: var(--primary-light); }

/* Onboarding */
.onboarding-container {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 80vh;
    text-align: center; padding: 24px;
}
.onboarding-step { display: none; animation: fadeIn 0.4s ease; }
.onboarding-step.active { display: flex; flex-direction: column; align-items: center; }
.onboarding-icon { font-size: 4rem; margin-bottom: 16px; }
.onboarding-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 8px; }
.onboarding-text { color: var(--text-light); font-size: 0.95rem; max-width: 320px; margin-bottom: 24px; }
.onboarding-steps { display: flex; gap: 8px; margin: 16px 0; }
.onboarding-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border); transition: background var(--transition);
}
.onboarding-dot.active { background: var(--primary-dark); width: 24px; border-radius: 4px; }

/* CTA banner */
.cta-banner {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    border-radius: var(--radius); padding: 16px; margin: 16px 0;
    text-align: center; border: 1px solid var(--primary);
}
.cta-banner p { color: var(--text); font-size: 0.9rem; margin-bottom: 12px; }

/* Premium badge */
.premium-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 12px;
    background: var(--secondary); color: var(--accent-dark);
    font-size: 0.7rem; font-weight: 600;
}

/* Badge chips */
.badge-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 16px;
    background: var(--secondary); color: var(--text);
    font-size: 0.75rem; font-weight: 500;
    white-space: nowrap;
}

/* Loading */
.loading { text-align: center; padding: 32px; color: var(--text-muted); }
.spinner {
    width: 32px; height: 32px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 8px;
}

/* Empty state */
.empty-state {
    text-align: center; padding: 48px 16px; color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 24px; max-width: 400px; width: 100%;
    box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

/* Update banner */
.update-banner {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 350;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    animation: slideUp 0.35s ease-out;
}
.update-banner__inner {
    max-width: 720px; margin: 0 auto;
    padding: 14px 20px;
    display: flex; align-items: center; gap: 16px;
    flex-wrap: wrap;
}
.update-banner__text { flex: 1; min-width: 200px; line-height: 1.45; }
.update-banner__text strong { font-size: 0.95rem; }
.update-banner__notes {
    display: block; font-size: 0.85rem;
    color: var(--text-muted); margin-top: 2px;
}
.update-banner__actions { display: flex; gap: 8px; }
.update-banner__btn {
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-size: 0.88rem; font-weight: 500;
    border: 1px solid transparent; cursor: pointer;
    transition: opacity 0.15s ease;
}
.update-banner__btn:hover { opacity: 0.85; }
.update-banner__btn--primary {
    background: var(--primary); color: #fff;
}
.update-banner__btn--ghost {
    background: transparent; color: var(--text-muted);
    border-color: var(--border);
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Toast */
.toast-container {
    position: fixed; top: calc(var(--nav-height) + 8px);
    left: 50%; transform: translateX(-50%);
    z-index: 300; max-width: 360px; width: calc(100% - 32px);
}
.toast {
    padding: 12px 16px; border-radius: var(--radius-sm);
    margin-bottom: 8px; font-size: 0.9rem;
    animation: slideDown 0.3s ease;
    box-shadow: var(--shadow-lg);
}

/* Auth pages */
.auth-container {
    max-width: 400px; margin: 0 auto;
    min-height: 100vh; display: flex;
    flex-direction: column; justify-content: center; padding: 24px;
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .logo-icon { font-size: 3.5rem; display: inline-block; animation: compass-sway 5s ease-in-out infinite; transform-origin: center center; }
@keyframes compass-sway {
    0%   { transform: rotate(0deg); }
    20%  { transform: rotate(15deg); }
    50%  { transform: rotate(-10deg); }
    70%  { transform: rotate(6deg); }
    85%  { transform: rotate(-3deg); }
    100% { transform: rotate(0deg); }
}
.auth-logo h1 { font-size: 1.8rem; color: var(--primary-dark); margin-top: 8px; }
.auth-logo p { color: var(--text-light); font-size: 1rem; }
.auth-container .form-label { font-size: 0.95rem; color: var(--text); }
.auth-container .form-input { font-size: 1.05rem; padding: 12px 14px; border-color: var(--primary); }
.auth-container .btn-lg { font-size: 1.1rem; padding: 14px 28px; }
.auth-container .text-muted { color: var(--text-light); }
.auth-footer { text-align: center; margin-top: 16px; font-size: 0.95rem; color: var(--text); }
.auth-footer a { color: var(--primary-dark); font-weight: 500; }

/* Admin */
.admin-grid { display: grid; gap: 16px; }
.admin-section { background: var(--bg-card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.admin-section h3 { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th, .admin-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { font-weight: 600; color: var(--text-light); }

/* Report */
.report-section { margin-bottom: 24px; }
.report-section h3 { margin-bottom: 8px; }

/* Legal pages */
.legal-content { max-width: 600px; margin: 0 auto; }
.legal-content h1 { margin-bottom: 16px; font-size: 1.6rem; }
.legal-content h2 { margin: 24px 0 8px; font-size: 1.2rem; }
.legal-content p, .legal-content li { font-size: 1rem; color: var(--text-light); line-height: 1.7; }
.legal-content ul { padding-left: 20px; margin-bottom: 12px; }

/* Branded name */
.brand-name { font-weight: 700; color: var(--primary-dark); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 480px) {
    .emotion-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .emotion-btn { padding: 10px 4px; font-size: 0.75rem; }
    .emotion-btn .emoji { font-size: 1.4rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 10px; }
    .stat-value { font-size: 1.1rem; word-break: break-word; }
    .stat-label { font-size: 0.7rem; }
    .main-content { padding: 12px; }
}
@media (max-width: 360px) {
    .emotion-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
}
@media (min-width: 768px) {
    .bottom-nav { max-width: 600px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
    .bottom-nav a { font-size: 1.1rem; }
    .bottom-nav a .nav-icon { font-size: 1.8rem; }
    .bottom-nav a .nav-label { font-size: 1.05rem; font-weight: 700; }
    /* Keep header controls (back arrow, Profile) close to the 600px content
       column instead of pinned to screen edges, so desktop users don't have to
       drag the cursor across the full window. Background stays full-width. */
    .top-header { padding-left: max(16px, calc((100% - 600px) / 2)); padding-right: max(16px, calc((100% - 600px) / 2)); }
}

/* Lucide icon defaults */
[data-lucide] { display: inline-block; vertical-align: middle; }
.nav-icon svg { width: 22px; height: 22px; }
.emotion-icon svg, .emotion-btn .emoji svg { width: 28px; height: 28px; }
.practice-icon svg { width: 32px; height: 32px; }
.onboarding-icon svg { width: 64px; height: 64px; stroke-width: 1.5; }
.empty-icon svg { width: 48px; height: 48px; }
.premium-badge svg, .premium-icon svg { width: 14px; height: 14px; }
.profile-chip svg { width: 16px; height: 16px; }
.entry-emoji svg { width: 24px; height: 24px; }
.badge-chip svg { width: 14px; height: 14px; }

/* Practice completion overlay */
.completion-overlay {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-align: center;
    padding: 48px 24px; min-height: 300px;
    animation: fadeIn 0.4s ease;
}
.completion-check {
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--success-bg); color: var(--success);
    font-size: 2.5rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    animation: completionPop 0.5s ease;
}
@keyframes completionPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.completion-badges {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.completion-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px;
    background: var(--secondary); color: var(--text);
    font-size: 0.85rem; font-weight: 600;
    animation: fadeIn 0.6s ease;
}
.completion-badge svg { width: 18px; height: 18px; }
.completion-weekly {
    width: 100%; max-width: 280px;
}

/* Weekly progress bar */
.weekly-progress-bar {
    width: 100%; height: 6px; background: var(--border);
    border-radius: 3px; overflow: hidden;
}
.weekly-progress-fill {
    height: 100%; background: var(--success);
    border-radius: 3px; transition: width 0.4s ease;
}
.weekly-goal-card { margin-bottom: 12px; }

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.gap-1 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* Language toggle (BG/EN) — pill-shape segmented control */
.lang-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    box-shadow: var(--shadow);
    user-select: none;
}
.lang-toggle__btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform var(--transition);
    line-height: 1;
}
.lang-toggle__btn:hover { color: var(--text); transform: translateY(-1px); }
.lang-toggle__btn.is-active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 3px rgba(74, 63, 53, 0.15);
}
.lang-toggle__btn.is-active:hover { transform: none; color: #fff; }
.lang-toggle__btn:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

.lang-toggle--floating {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
}
@media (max-width: 480px) {
    .lang-toggle--floating { top: 12px; right: 12px; }
    .lang-toggle__btn { font-size: 0.7rem; padding: 5px 10px; }
}

/* PWA install — bottom toast + iOS modal */
.install-toast {
    position: fixed;
    left: 12px; right: 12px;
    bottom: 80px;
    max-width: 540px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(74, 63, 53, 0.18);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1100;
    transform: translateY(20px);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.install-toast.is-visible { transform: translateY(0); opacity: 1; }
.install-toast-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.install-toast-icon svg { width: 20px; height: 20px; }
.install-toast-body { flex: 1; min-width: 0; }
.install-toast-title { font-weight: 700; font-size: 0.88rem; line-height: 1.3; margin-bottom: 2px; color: var(--text); }
.install-toast-sub { font-size: 0.74rem; color: var(--text-light); line-height: 1.35; }
.install-toast-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.install-toast-btn {
    background: var(--primary-dark);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.78rem;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}
.install-toast-btn:hover { background: var(--primary-deeper, #9a6464); }
.install-toast-close {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border-radius: 6px;
}
.install-toast-close:hover { background: var(--bg); color: var(--text); }
.install-toast-close svg { width: 16px; height: 16px; }
@media (max-width: 480px) {
    .install-toast { bottom: 70px; padding: 12px; gap: 10px; }
    .install-toast-sub { display: none; }
    .install-toast-icon { width: 36px; height: 36px; }
    .install-toast-icon svg { width: 18px; height: 18px; }
}

.install-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(74, 63, 53, 0.45);
    z-index: 1200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    animation: install-fade-in 0.2s ease;
}
@keyframes install-fade-in { from { opacity: 0; } to { opacity: 1; } }
.install-modal {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 14px 50px rgba(74, 63, 53, 0.32);
    animation: install-slide-up 0.25s ease;
}
@keyframes install-slide-up { from { transform: translateY(20px); } to { transform: translateY(0); } }
.install-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.install-modal-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.install-modal-icon svg { width: 22px; height: 22px; }
.install-modal-title { font-weight: 700; font-size: 1.02rem; line-height: 1.3; color: var(--text); }
.install-modal-sub { font-size: 0.84rem; color: var(--text-light); line-height: 1.5; margin-bottom: 14px; }
.install-modal-steps {
    background: var(--bg);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.install-modal-step {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.86rem;
    padding: 6px 0;
    color: var(--text);
}
.install-modal-step-num {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--primary-dark);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    flex-shrink: 0;
}
.install-modal-step svg { width: 16px; height: 16px; color: var(--primary-dark); flex-shrink: 0; }
.install-modal-close {
    width: 100%;
    background: var(--primary-dark);
    color: #fff;
    padding: 11px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}
.install-modal-close:hover { background: var(--primary-deeper, #9a6464); }
