/* ===== Lette Penge – app.css ===== */

:root {
    --c-primary:   #4DA3FF;
    --c-secondary: #FFD93D;
    --c-success:   #6BCB77;
    --c-danger:    #FF6B6B;
    --c-info:      #118AB2;
    --c-bg:        #FFF7E6;
    --c-card:      #FFFFFF;
    --c-text:      #1F2A44;
    --c-muted:     #7A8BA8;
    --c-border:    #D8C7FF;
    --nav-h:       64px;
    --header-h:    56px;
    --radius:      14px;
    --shadow:      0 2px 12px rgba(0,0,0,.08);
    --shadow-lg:   0 4px 24px rgba(0,0,0,.14);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    min-height: 100dvh;
    padding-top: var(--header-h);
    padding-bottom: var(--nav-h);
}

/* ── Header ── */
.app-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--header-h);
    background: var(--c-primary);
    display: flex; align-items: center; padding: 0 16px;
    box-shadow: 0 2px 8px rgba(77,163,255,.3);
}
.app-header-logo  { width: 36px; height: 36px; margin-right: 10px; flex-shrink: 0; }
.app-header-title { font-size: 1.2rem; font-weight: 800; color: #fff; letter-spacing: -.5px; flex: 1; }
.app-header-user  {
    font-size: .8rem; color: rgba(255,255,255,.85);
    background: rgba(255,255,255,.2); border-radius: 20px;
    padding: 4px 10px; max-width: 120px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.app-header-user--link {
    text-decoration: none; cursor: pointer;
}
.app-header-user--link:hover { background: rgba(255,255,255,.32); }

/* ── Bottom nav ── */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-h);
    background: #fff;
    border-top: 2px solid var(--c-border);
    display: flex; align-items: stretch;
    box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}
.nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-decoration: none; color: var(--c-muted);
    gap: 3px; transition: color .15s; position: relative;
    font-size: .68rem; font-weight: 600;
}
.nav-item.active { color: var(--c-primary); }
.nav-item.active::after {
    content: ''; position: absolute; top: 0; left: 20%; right: 20%;
    height: 3px; background: var(--c-primary); border-radius: 0 0 3px 3px;
}
.nav-icon { font-size: 1.4rem; line-height: 1; }
.nav-badge {
    position: absolute; top: 6px; right: calc(50% - 16px);
    background: var(--c-danger); color: #fff;
    font-size: .6rem; font-weight: 800; min-width: 16px; height: 16px;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}

/* ── Main content ── */
.app-main { padding: 16px; max-width: 600px; margin: 0 auto; }

/* ── PWA install banner ── */
.pwa-banner {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--c-primary); color: #fff;
    padding: 10px 16px; font-size: .88rem; font-weight: 600;
}
.pwa-banner[hidden] { display: none; }
.pwa-banner__text { flex: 1; }
.pwa-banner__ios-hint { font-size: .82rem; font-weight: 400; }
.pwa-banner__close {
    background: none; border: none; color: #fff; font-size: 1rem;
    cursor: pointer; padding: 4px 8px; margin-left: auto; opacity: .8;
}
.pwa-banner__close:hover { opacity: 1; }
.pwa-hidden { display: none; }

/* ── Flash messages ── */
.flash-container { padding: 8px 16px 0; max-width: 600px; margin: 0 auto; }
.flash {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 8px;
    font-size: .9rem; font-weight: 600;
}
.flash--success { background: #DFF5E3; color: #1A6B2A; }
.flash--warning { background: #FFF3D4; color: #8A5A00; }
.flash--error, .flash--danger { background: #FFE5E5; color: #8A1A1A; }

/* ── Auth pages (login / register) ── */
.page-auth { padding: 0; }
.page-auth .app-header      { display: none; }
.page-auth .bottom-nav      { display: none; }
.page-auth .flash-container { display: none; }
.page-auth .app-main        { padding: 0; max-width: none; }

.auth-page {
    min-height: 100dvh;
    background: linear-gradient(160deg, #4DA3FF 0%, #FFD93D 100%);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 24px 16px 40px;
}
.auth-card {
    background: #fff; border-radius: 24px; padding: 32px 24px;
    width: 100%; max-width: 420px;
    box-shadow: 0 8px 40px rgba(0,0,0,.15);
}
.auth-logo     { display: block; width: 80px; height: 80px; margin: 0 auto 8px; }
.auth-title    { font-size: 1.8rem; font-weight: 900; text-align: center; color: var(--c-primary); margin-bottom: 4px; }
.auth-subtitle { font-size: .9rem; color: var(--c-muted); text-align: center; margin-bottom: 24px; }
.auth-footer   { text-align: center; font-size: .88rem; color: var(--c-muted); margin-top: 16px; }
.auth-footer a { color: var(--c-primary); font-weight: 700; text-decoration: none; }

/* ── Cards ── */
.card {
    background: var(--c-card); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card--alert   { border-left: 4px solid var(--c-danger); }
.card--warning { border-left: 4px solid var(--c-secondary); }
.card--success { border-left: 4px solid var(--c-success); }
.card--center  { text-align: center; }
.card-title {
    font-size: 1rem; font-weight: 700; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.card-hint { font-size: .85rem; color: var(--c-muted); margin-bottom: 12px; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 20px; border-radius: 50px; font-size: .95rem; font-weight: 700;
    border: none; cursor: pointer; text-decoration: none; transition: all .15s;
    min-height: 48px;
}
.btn:active { transform: scale(.96); }
.btn-primary   { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #3d8fe0; }
.btn-success   { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #5ab866; }
.btn-danger    { background: var(--c-danger);  color: #fff; }
.btn-danger:hover  { background: #e55a5a; }
.btn-secondary { background: var(--c-border); color: var(--c-text); }
.btn-secondary:hover { background: #c4b0f5; }
.btn-outline   { background: transparent; color: var(--c-primary); border: 2px solid var(--c-primary); }
.btn-sm        { padding: 8px 14px; font-size: .82rem; min-height: 36px; }
.btn-block     { width: 100%; }
.btn--mt            { margin-top: 8px; }
.dashboard-btn-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.btn-group     { display: flex; gap: 8px; }
.btn-group .btn { flex: 1; }
.btn-group form { flex: 1; display: contents; }

/* ── Forms ── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 13px 14px; border: 2px solid var(--c-border);
    border-radius: var(--radius); font-size: 1rem; background: #fff;
    color: var(--c-text); transition: border-color .15s;
    appearance: none; -webkit-appearance: none;
}
.form-control:focus { outline: none; border-color: var(--c-primary); }
select.form-control { cursor: pointer; }
.form-hint  { font-size: .78rem; color: var(--c-muted); margin-top: 4px; }
.form-error {
    background: #FFE5E5; color: #8A1A1A; padding: 12px 14px;
    border-radius: var(--radius); font-size: .88rem; margin-bottom: 14px; font-weight: 600;
}
.form-control--code {
    text-transform: uppercase; letter-spacing: .25em;
    font-size: 1.3rem; text-align: center; font-weight: 700;
}
.form-control--reward { font-size: 1.2rem; font-weight: 700; }

/* ── Reward badge ── */
.reward-badge {
    display: inline-flex; align-items: center; gap: 3px;
    background: var(--c-secondary); color: #6A4800;
    font-weight: 800; font-size: .85rem;
    padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}

/* ── Status pill ── */
.status-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 700;
}
.status-claimed  { background: #E0EEFF; color: #1A5BB5; }
.status-pending  { background: #FFF8DC; color: #8A5A00; }
.status-approved { background: #DFF5E3; color: #1A6B2A; }
.status-rejected { background: #FFE5E5; color: #8A1A1A; }

/* ── Section heading ── */
.section-title {
    font-size: .75rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .08em; color: var(--c-muted); margin: 20px 0 10px;
}
.section-title-sub { font-weight: 600; text-transform: none; letter-spacing: 0; opacity: .7; }

/* ── Avatar – background set via --avatar-color CSS var from template ── */
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--avatar-color, var(--c-primary));
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 800; color: #fff; flex-shrink: 0;
}
.avatar--lg { width: 56px; height: 56px; font-size: 1.4rem; }

/* ── Hero box ── */
.hero-box {
    background: linear-gradient(135deg, var(--c-primary) 0%, #7ec1ff 100%);
    border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.hero-greeting  { font-size: .85rem; color: rgba(255,255,255,.8); margin-bottom: 4px; }
.hero-username  { font-size: 1.4rem; font-weight: 900; color: #fff; }
.hero-family-name { font-size: .85rem; color: rgba(255,255,255,.8); margin-top: 4px; }

.hero-child-layout { display: flex; align-items: center; gap: 16px; }
.hero-child-text   { flex: 1; min-width: 0; }
.hero-earned       { font-size: 1.8rem; font-weight: 900; color: #fff; line-height: 1; margin-top: 4px; }
.hero-earned-label { font-size: .8rem; color: rgba(255,255,255,.8); }

/* ── Task card ── */
.task-card {
    background: #fff; border-radius: var(--radius); padding: 14px 16px;
    box-shadow: var(--shadow); margin-bottom: 12px;
    display: flex; gap: 12px; align-items: flex-start;
}
.task-card--inactive { opacity: .55; }
.task-card--flat     { box-shadow: none; padding: 0; margin-bottom: 14px; }
.task-card--claimed  { border-left: 4px solid var(--c-primary); }
.task-icon  { font-size: 2rem; flex-shrink: 0; }
.task-body  { flex: 1; min-width: 0; }
.task-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.task-desc  { font-size: .84rem; color: var(--c-muted); margin-bottom: 8px; }
.task-meta  { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task-claim-form { margin-top: 10px; }

/* ── Weekday / generic chips ── */
.weekday-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip          { padding: 2px 8px; border-radius: 20px; font-size: .74rem; font-weight: 700; background: var(--c-border); color: var(--c-muted); }
.chip--active  { background: var(--c-info); color: #fff; }
.chip--limit    { background: var(--c-secondary); color: #6A4800; }
.chip--cooldown { background: #E8D5FF; color: #5C2D91; }

/* ── Child stat card ── */
.child-stat-card {
    background: #fff; border-radius: var(--radius); padding: 14px 16px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
    margin-bottom: 10px; text-decoration: none; color: inherit;
}
.child-stat-info   { flex: 1; min-width: 0; }
.child-stat-name   { font-weight: 700; font-size: 1rem; }
.child-stat-sub    { font-size: .85rem; color: var(--c-muted); margin-top: 2px; }
.child-stat-amount { font-size: 1.2rem; font-weight: 900; color: var(--c-primary); white-space: nowrap; }

/* ── Leaderboard ── */
.leaderboard-item {
    background: #fff; border-radius: var(--radius); padding: 12px 16px;
    box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
    margin-bottom: 10px;
}
.leaderboard-item--me {
    border: 2px solid var(--c-primary); background: #F0F6FF;
}
.leaderboard-rank {
    font-size: 1.1rem; font-weight: 900; color: var(--c-muted);
    width: 24px; text-align: center; flex-shrink: 0;
}
.leaderboard-item:nth-child(1) .leaderboard-rank { color: #C89B00; }
.leaderboard-item:nth-child(2) .leaderboard-rank { color: #888; }
.leaderboard-item:nth-child(3) .leaderboard-rank { color: #A0522D; }
.leaderboard-me-tag {
    font-size: .75rem; font-weight: 600; color: var(--c-primary);
    background: #D6E8FF; border-radius: 20px; padding: 1px 8px;
    vertical-align: middle; margin-left: 4px;
}

/* ── Family code card ── */
.family-code-card    { text-align: center; }
.family-code-hint    { font-size: .85rem; color: var(--c-muted); margin-bottom: 8px; }
.family-code-display { font-size: 2.2rem; font-weight: 900; letter-spacing: .3em; color: var(--c-primary); margin: 8px 0; }
.family-code-note    { font-size: .78rem; color: var(--c-muted); }

/* ── Pending count ── */
.pending-message { font-size: .9rem; color: var(--c-muted); margin-bottom: 12px; }

/* ── Rejection note ── */
.rejection-note { font-size: .8rem; color: var(--c-danger); margin-top: 6px; font-style: italic; }

/* ── File upload drop zone ── */
.file-drop {
    display: block;
    border: 2px dashed var(--c-primary); border-radius: var(--radius);
    padding: 28px; text-align: center; cursor: pointer;
    transition: border-color .2s, background .2s; position: relative;
    background: #F8FBFF;
}
.file-drop:hover, .file-drop.dragover { border-color: #3d8fe0; background: #EBF4FF; }
.file-drop input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.file-drop-icon    { font-size: 2.5rem; margin-bottom: 8px; }
.file-drop-text    { font-size: .9rem; color: var(--c-muted); }
.file-drop-preview {
    max-width: 100%; border-radius: 10px; max-height: 220px;
    object-fit: cover; display: none; margin: 12px auto 0;
}

/* ── Review card (pending approval) ── */
.review-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
.review-card__photo { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.review-card__body  { padding: 14px 16px; }
.review-card__title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.review-card__meta  { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.review-card__who   { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.review-card__who-name { font-weight: 700; font-size: .9rem; }
.review-card__who-date { font-size: .78rem; color: var(--c-muted); }
.review-card__actions  { display: flex; gap: 10px; }

/* ── Reject modal ── */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: none; align-items: flex-end; justify-content: center;
    background: rgba(0,0,0,.5);
}
.modal.is-open { display: flex; }
.modal-sheet {
    background: #fff; border-radius: 24px 24px 0 0;
    padding: 24px; width: 100%; max-width: 600px;
}
.modal-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 16px; }

/* ── Checkbox pills ── */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-label {
    display: flex; align-items: center; gap: 6px;
    background: var(--c-border); border-radius: 50px;
    padding: 7px 14px; cursor: pointer; font-size: .9rem; font-weight: 600;
    transition: all .15s; user-select: none;
}
.checkbox-label input { display: none; }
.checkbox-label.checked { background: var(--c-info); color: #fff; }

/* ── Radio pills ── */
.radio-group { display: flex; gap: 10px; }
.radio-label {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: var(--c-border); border-radius: var(--radius);
    padding: 12px; cursor: pointer; font-size: .88rem; font-weight: 700;
    transition: all .15s; text-align: center; border: 2px solid transparent; user-select: none;
}
.radio-label input { display: none; }
.radio-label.checked { background: #F0F5FF; border-color: var(--c-primary); color: var(--c-primary); }
.radio-icon { font-size: 1.8rem; }

/* ── Weekdays toggle section ── */
.weekdays-section[hidden] { display: none; }

/* ── Progress page ── */
.progress-hero        { text-align: center; padding: 24px 0 16px; }
.progress-total       { font-size: 3.5rem; font-weight: 900; color: var(--c-primary); line-height: 1; }
.progress-total-label { font-size: .9rem; color: var(--c-muted); margin-top: 6px; }
.chart-wrapper        { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.chart-title          { font-size: .85rem; font-weight: 700; color: var(--c-muted); margin-bottom: 12px; }

/* ── History page ── */
.history-date-header {
    font-size: .92rem; font-weight: 700; color: var(--c-text);
    margin: 20px 0 6px; padding-bottom: 6px;
    border-bottom: 2px solid var(--c-border);
}
.avatar--sm { width: 28px; height: 28px; font-size: .72rem; flex-shrink: 0; }
.completion-item--link {
    display: flex; text-decoration: none; color: inherit;
    align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--c-border);
}
.completion-item--link:last-child { border-bottom: none; }
.completion-item--link:active { background: var(--c-bg); }
.review-card__child-note--rejected { color: var(--c-danger); font-style: normal; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--c-primary); font-weight: 600; text-decoration: none; font-size: .9rem; }

/* ── Completion history list ── */
.completion-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--c-border);
}
.completion-item:last-child { border-bottom: none; }
.completion-icon   { font-size: 1.4rem; flex-shrink: 0; }
.completion-info   { flex: 1; min-width: 0; }
.completion-title  { font-weight: 700; font-size: .9rem; }
.completion-date   { font-size: .78rem; color: var(--c-muted); margin-top: 2px; }
.completion-right  { text-align: right; flex-shrink: 0; }
.completion-amount { font-weight: 800; color: var(--c-success); font-size: .9rem; }

/* ── Empty state ── */
.empty-state      { text-align: center; padding: 40px 20px; color: var(--c-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-text { font-size: .95rem; margin-bottom: 16px; }

/* ── Progress summary (paid / owed) ── */
.progress-summary {
    display: flex; align-items: center;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    margin: 0 0 16px; overflow: hidden;
}
.progress-summary__item {
    flex: 1; text-align: center; padding: 14px 10px;
}
.progress-summary__divider {
    width: 1px; background: var(--c-border); align-self: stretch;
}
.progress-summary__amount {
    font-size: 1.3rem; font-weight: 900; line-height: 1;
}
.progress-summary__amount--paid  { color: var(--c-success); }
.progress-summary__amount--owed  { color: var(--c-primary); }
.progress-summary__label { font-size: .75rem; color: var(--c-muted); margin-top: 4px; }

/* ── Status: paid ── */
.status-paid { background: #DFF5E3; color: #1A6B2A; }

/* ── Review card child note ── */
.review-card__child-note {
    font-size: .85rem; color: var(--c-muted); font-style: italic;
    background: var(--c-bg); border-radius: 8px;
    padding: 8px 12px; margin-bottom: 10px;
}

/* ── Payment page ── */
.payment-group { margin-bottom: 4px; }
.payment-group__header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0 10px;
}
.payment-group__info   { flex: 1; }
.payment-group__name   { font-weight: 700; font-size: 1rem; }
.payment-group__total  { font-size: .85rem; color: var(--c-danger); font-weight: 700; margin-top: 2px; }

.payment-item {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border-radius: var(--radius);
    padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 10px;
    cursor: default;
}
.payment-item--selectable { cursor: pointer; transition: opacity .15s; }
.payment-item--selectable:has(.payment-checkbox:not(:checked)) { opacity: .5; }
.payment-checkbox { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--c-success); cursor: pointer; }
.payment-item__info   { flex: 1; min-width: 0; }
.payment-item__title  { font-weight: 700; font-size: .9rem; }
.payment-item__date   { font-size: .75rem; color: var(--c-muted); margin-top: 2px; }
.payment-item__note   { font-size: .78rem; color: var(--c-muted); font-style: italic; margin-top: 4px; }
.payment-item__right  { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.payment-group__footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 2px 14px;
}
.payment-group__footer-total { font-size: .9rem; color: var(--c-text); }

/* ── Button row (pair of buttons side by side) ── */
.btn-row { display: flex; gap: 10px; }

/* ── Divider ── */
.divider { border: none; border-top: 2px solid var(--c-border); margin: 16px 0; }

/* ── Responsive ── */
@media (min-width: 600px) {
    .app-main { padding: 20px; }
}
