/* ===== Status badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: capitalize;
    background: var(--color-border);
    color: var(--color-text);
    letter-spacing: 0.01em;
}
.badge::before { font-size: 0.85em; }
.badge-pending::before   { content: "⏳"; }
.badge-submitted::before { content: "📷"; }
.badge-approved::before  { content: "✓"; font-weight: 900; }
.badge-rejected::before  { content: "✗"; font-weight: 900; }
.badge-missed::before    { content: "⚠"; }
.badge-amber::before     { content: "📷"; }

.badge-pending   { background: var(--status-pending-bg);   color: #4b5563; }
.badge-submitted, .badge-amber { background: var(--status-submitted-bg); color: #b45309; }
.badge-approved  { background: var(--status-approved-bg);  color: #15803d; }
.badge-rejected  { background: var(--status-rejected-bg);  color: #b91c1c; }
.badge-missed    { background: var(--status-missed-bg);    color: #b91c1c; }
.badge-muted     { background: rgba(0,0,0,0.05); color: var(--color-text-muted); }
.badge-muted::before { content: ""; }

/* ===== Chore card ===== */
.card-stack { display: flex; flex-direction: column; gap: 0.85rem; }

.chore-card, .chore-row {
    background: color-mix(in srgb, var(--cat-color, #9ca3af) 7%, var(--color-surface));
    border: 1.5px solid color-mix(in srgb, var(--cat-color, #9ca3af) 18%, var(--color-border));
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    box-shadow: var(--shadow-sm);
    --cat-color: #9ca3af;
    transition: transform .15s, box-shadow .15s;
    position: relative;
}
.chore-card:hover, .chore-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.chore-card-stripe, .chore-row-stripe, .approval-stripe {
    width: 8px;
    background: var(--cat-color);
    flex-shrink: 0;
}
.chore-card-body, .chore-row-body {
    padding: 1rem 1.1rem;
    flex: 1;
    min-width: 0;
}
.chore-card-row {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 0.5rem;
}
.chore-card-title { font-size: 1.1rem; font-weight: 700; font-family: var(--font-display); }
.chore-card-meta {
    display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem;
    margin-top: 0.45rem; font-size: 0.85rem;
    align-items: center;
}
.cat-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.18rem 0.65rem; border-radius: 999px;
    font-size: 0.75rem; font-weight: 700;
}
.meta-item { color: var(--color-text-muted); }
.amount {
    font-weight: 800; color: var(--color-text);
    font-size: 1.05rem;
    font-family: var(--font-display);
}
.chore-card-desc { margin-top: 0.5rem; color: var(--color-text-muted); font-size: 0.9rem; }
.chore-card-actions { display: flex; gap: 0.5rem; margin-top: 0.85rem; flex-wrap: wrap; align-items: center; }
.rejection-reason {
    margin-top: 0.5rem; padding: 0.55rem 0.75rem;
    background: rgba(220, 38, 38, 0.08);
    border-left: 3px solid var(--color-rejected);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* Status state strip across top of child card */
.chore-card.status-submitted::before,
.chore-card.status-approved::before,
.chore-card.status-rejected::before,
.chore-card.status-missed::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--strip-color, var(--color-text-muted));
}
.chore-card.status-submitted { --strip-color: var(--color-submitted); }
.chore-card.status-approved  { --strip-color: var(--color-approved);  background: color-mix(in srgb, var(--color-approved) 6%, var(--color-surface)); }
.chore-card.status-rejected  { --strip-color: var(--color-rejected); }
.chore-card.status-missed    { --strip-color: var(--color-missed); opacity: 0.85; }

.chore-row { align-items: stretch; }
.chore-row-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.chore-row.inactive { opacity: 0.55; }
.chore-row-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    padding: 1rem;
    flex-wrap: wrap;
}

/* ===== Photo upload ===== */
.photo-btn {
    cursor: pointer;
    font-size: 1rem;
    padding: 0.85rem 1.5rem;
    min-height: 56px;
    border-radius: var(--radius);
}
.photo-btn-hero {
    width: 100%;
    font-size: 1.1rem;
    padding: 1.1rem 1.5rem;
    min-height: 64px;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--color-accent) 35%, transparent);
}
.photo-btn-hero .camera-emoji {
    display: inline-block;
    animation: camera-bob 2.4s ease-in-out infinite;
    margin-right: 0.5rem;
    font-size: 1.4rem;
}
@keyframes camera-bob {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%      { transform: translateY(-3px) rotate(3deg); }
}
/* Was an <a> — now a <button> that opens the lightbox. Strip the browser
   default button chrome so the contained <img> is the only thing visible. */
.thumb-link {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}
.thumb-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
.thumb {
    max-width: 220px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
}
.submit-form { display: inline-block; }

/* ===== Photo preview overlay (modal) ===== */
.photo-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 32, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}
.photo-preview-modal.is-open { display: flex; animation: fade-in .2s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.photo-preview-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
.photo-preview-card h3 { margin-bottom: 0.75rem; }
.photo-preview-card img {
    width: 100%; max-height: 400px; object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.photo-preview-card .actions { display: flex; gap: 0.5rem; }
.photo-preview-card .actions .btn { flex: 1; }

/* ===== Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem;
    text-align: center;
    box-shadow: var(--shadow-xs);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-num { font-size: 2.25rem; font-weight: 800; font-family: var(--font-display); line-height: 1; }
.stat-label { color: var(--color-text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.4rem; font-weight: 700; }
.stat-pending .stat-num   { color: var(--color-pending); }
.stat-submitted .stat-num { color: var(--color-submitted); }
.stat-approved .stat-num  { color: var(--color-approved); }
.stat-missed .stat-num    { color: var(--color-missed); }

/* ===== Wallet ===== */
.wallet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
}
.wallet-tile {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem;
    text-decoration: none;
    color: var(--color-text);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    box-shadow: var(--shadow-xs);
}
.wallet-tile:hover {
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent);
}
.wallet-name { font-weight: 700; font-family: var(--font-display); }
.wallet-amount { font-size: 1.7rem; font-weight: 800; margin: 0.4rem 0; font-family: var(--font-display); }
.wallet-sub { font-size: 0.8rem; }
.wallet-mini { margin-top: 0.5rem; font-size: 1.05rem; }

.wallet-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.wallet-card {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem;
    text-align: center;
}
.wallet-label { color: var(--color-text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.wallet-big { font-size: 1.7rem; font-weight: 800; margin-top: 0.35rem; font-family: var(--font-display); }

/* Wallet hero (child wallet + per-child page) */
.wallet-hero {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 30px rgba(34, 197, 94, 0.25);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.wallet-hero::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
    border-radius: 50%;
}
.wallet-hero-label {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    opacity: 0.9;
    font-weight: 700;
}
.wallet-hero-amount {
    font-size: 3.25rem;
    font-weight: 800;
    margin-top: 0.5rem;
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    line-height: 1.1;
    animation: count-up .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes count-up {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
.wallet-hero-sub { opacity: 0.92; font-size: 0.95rem; margin-top: 0.4rem; }
.wallet-sparkline { margin-top: 1rem; opacity: 0.95; }

/* Wallet zero state */
.wallet-hero.zero {
    background: linear-gradient(135deg, var(--color-accent-2), var(--color-accent));
    box-shadow: 0 12px 30px color-mix(in srgb, var(--color-accent) 30%, transparent);
}

.activity-table, .payments-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.92rem;
    box-shadow: var(--shadow-xs);
}
.activity-table th, .activity-table td, .payments-table th, .payments-table td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}
.activity-table th, .payments-table th {
    background: var(--color-surface-2);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    letter-spacing: 0.04em;
    font-weight: 700;
}
.activity-table tr:last-child td, .payments-table tr:last-child td { border-bottom: none; }
.activity-table tr:hover, .payments-table tbody tr:hover { background: var(--color-surface-2); }

.payments-footer {
    position: sticky; bottom: 0;
    margin-top: 1rem;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.95rem 1.1rem;
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap;
    box-shadow: var(--shadow-md);
    font-weight: 600;
}

/* ===== Approvals ===== */
.approval-card, .approval-row {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    box-shadow: var(--shadow-sm);
    --cat-color: #9ca3af;
    transition: transform .15s, box-shadow .15s;
}
.approval-card:hover, .approval-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.approval-card.urgent {
    border-color: var(--color-submitted);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-submitted) 25%, transparent), var(--shadow-md);
}
.approval-card.very-urgent {
    border-color: var(--color-rejected);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-rejected) 25%, transparent), var(--shadow-md);
}
.approval-card-body { padding: 1.1rem; flex: 1; min-width: 0; }
.approval-header { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
/* Lightbox trigger on the approvals queue. Same button reset as .thumb-link. */
.approval-photo-link {
    display: block;
    margin: 0.85rem 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}
.approval-photo-link:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
/* Dashboard preview thumbnail — small button-wrapped img. */
.approval-thumb-btn {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    line-height: 0;        /* kill the inline-block descender gap under the img */
}
.approval-thumb-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
.approval-photo {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius);
    border: 1.5px solid var(--color-border);
    object-fit: cover;
}
.approval-actions {
    display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap;
}
.urgency-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--status-submitted-bg);
    color: #b45309;
    margin-left: 0.5rem;
}
.urgency-badge.very-urgent { background: var(--status-rejected-bg); color: #b91c1c; }

.reject-details summary { list-style: none; }
.reject-details summary::-webkit-details-marker { display: none; }
.reject-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.reject-form input { flex: 1; min-width: 180px; }

/* Edit (repayments only) — a full-width inline panel when open. */
.edit-details summary { list-style: none; }
.edit-details summary::-webkit-details-marker { display: none; }
.edit-details[open] { flex-basis: 100%; }
.edit-form {
    display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.6rem;
    padding: 0.75rem; background: var(--color-surface-2);
    border-radius: var(--radius-sm);
}
.edit-field { display: flex; flex-direction: column; gap: 0.2rem; }
.edit-field > span { font-weight: 600; font-size: 0.85rem; }
.edit-field input {
    padding: 0.55rem 0.7rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    min-height: 40px;
}
.edit-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.approval-row { align-items: center; }
.approval-row .approval-body {
    display: flex; gap: 0.75rem; align-items: center; padding: 0.85rem 1rem; flex: 1; flex-wrap: wrap;
}
.approval-thumb { width: 60px; height: 60px; border-radius: var(--radius-sm); object-fit: cover; }
.approval-meta { flex: 1; min-width: 140px; }
.approval-actions { padding: 0 0.5rem; }

/* ===== Children ===== */
.child-tile {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem;
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap;
    box-shadow: var(--shadow-xs);
}
.child-stats { display: flex; gap: 1.5rem; align-items: center; text-align: center; }
.child-name-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius-sm);
    padding: 0.1rem 0.2rem;
    margin: -0.1rem -0.2rem;
}
.child-name-link:hover { color: var(--color-primary); }
.child-name-link:hover .child-name-arrow { transform: translateX(2px); }
.child-name-link:focus-visible {
    outline: 2px solid var(--color-primary); outline-offset: 2px;
}
.child-name-arrow {
    color: var(--muted);
    font-weight: 700;
    transition: transform 0.15s ease-out;
}

/* ===== Child history page (parent.child_history) ===== */
.history-summary {
    display: flex; gap: 1.5rem; flex-wrap: wrap;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.history-summary-stat {
    display: flex; flex-direction: column; align-items: flex-start;
}
.history-summary-stat strong { font-size: 1.4rem; line-height: 1.2; }

.history-month-heading {
    margin: 1.75rem 0 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
}
.history-month-heading .muted { font-weight: 400; }

.history-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.7rem 1rem 0.7rem 1.25rem;
    box-shadow: var(--shadow-xs);
}
.history-row-stripe {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--cat-color, var(--color-border));
    border-radius: var(--radius) 0 0 var(--radius);
}
.history-thumb-btn {
    padding: 0; border: 0; background: transparent;
    cursor: zoom-in;
    line-height: 0;
    flex-shrink: 0;
}
.history-thumb-btn:focus-visible {
    outline: 2px solid var(--color-primary); outline-offset: 2px;
    border-radius: var(--radius-sm);
}
.history-thumb {
    width: 56px; height: 56px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}
.history-thumb-placeholder {
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1.4rem;
    color: var(--muted);
    flex-shrink: 0;
}
.history-row-body { flex: 1; min-width: 0; }
.history-row-head {
    display: flex; align-items: center; gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.15rem;
}
.history-row-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
    flex-shrink: 0;
}
.history-row-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}
.history-revert-form { margin: 0; }
.history-revert-btn {
    font-size: 0.78rem;
    padding: 0.25rem 0.55rem;
    line-height: 1.15;
    color: var(--muted);
    border-radius: 999px;
}
.history-revert-btn:hover {
    color: var(--color-danger, #dc2626);
    background: rgba(220, 38, 38, 0.08);
}
@media (max-width: 480px) {
    .history-summary { gap: 1rem; padding: 0.85rem 1rem; }
    .history-summary-stat strong { font-size: 1.2rem; }
    .history-row { padding: 0.6rem 0.85rem 0.6rem 1rem; gap: 0.6rem; }
    .history-thumb, .history-thumb-placeholder { width: 48px; height: 48px; }
}

.history-load-more-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    margin: 1.5rem 0 0.75rem;
}
#history-load-more {
    min-width: 220px;
    padding: 0.7rem 1.5rem;
    font-weight: 600;
}
#history-load-more.is-loading {
    opacity: 0.7;
    cursor: progress;
}
.history-load-progress { color: var(--muted); }

/* ===== Categories ===== */
.cat-row {
    display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
    background: var(--color-surface);
    padding: 0.7rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.cat-row input[type="text"] { flex: 1; min-width: 120px; }
.cat-swatch {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--cat-color); border: 2px solid var(--color-border);
    flex-shrink: 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* ===== Notification bell + panel ===== */
.notif-bell { position: relative; }
.notif-bell summary {
    list-style: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    position: relative;
    min-width: var(--tap);
    min-height: var(--tap);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.notif-bell summary::-webkit-details-marker { display: none; }
.notif-bell summary:hover { background: var(--color-accent-soft); }
.bell-icon { font-size: 1.3rem; }
.bell-badge {
    position: absolute;
    top: 4px; right: 4px;
    background: var(--color-rejected);
    color: white;
    border-radius: 999px;
    padding: 0 5px;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    text-align: center;
    line-height: 16px;
    border: 2px solid var(--color-surface);
    animation: badge-pulse 2.4s ease-in-out infinite;
}
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    50%      { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.notif-panel {
    position: absolute;
    top: 110%;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 1rem);
    max-height: 60vh;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 60;
}
.notif-loading { padding: 1.25rem; text-align: center; color: var(--color-text-muted); }
.notif-item {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border);
    display: block;
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
}
.notif-item:hover { background: var(--color-surface-2); text-decoration: none; }
.notif-item.unread { background: var(--color-accent-soft); }
.notif-item:last-child { border-bottom: none; }
.notif-msg { font-size: 0.92rem; line-height: 1.4; }
.notif-time { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.25rem; }

.success-text { color: var(--color-approved); font-weight: 700; display: inline-flex; align-items: center; gap: 0.3rem; }
.link-more { font-size: 0.85rem; font-weight: 600; }

/* ===== Child today: greeting + streak ===== */
.child-greeting { margin-bottom: 1.5rem; }
.child-greeting h1 {
    font-size: 1.85rem;
    background: linear-gradient(135deg, var(--color-accent), var(--color-warm));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.streak-card {
    background: linear-gradient(135deg, var(--color-warm), #fb923c);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 22px rgba(249, 115, 22, 0.25);
    display: flex; align-items: center; gap: 1rem;
    position: relative;
    overflow: hidden;
}
.streak-card::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(255,255,255,0.2), transparent 70%);
    border-radius: 50%;
}
.streak-emoji { font-size: 2.4rem; }
.streak-text { flex: 1; position: relative; }
.streak-progress-text { font-weight: 800; font-size: 1.15rem; font-family: var(--font-display); }
.streak-progress-bar {
    background: rgba(255,255,255,0.25);
    border-radius: 999px;
    height: 8px;
    margin-top: 0.5rem;
    overflow: hidden;
    position: relative;
}
.streak-progress-fill {
    background: white;
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(.2,.8,.2,1);
}

/* Card "approved" celebration */
@keyframes approve-pop {
    0%   { transform: scale(0.9); opacity: 0; }
    60%  { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.chore-card.status-approved { animation: approve-pop .4s cubic-bezier(.2,.8,.2,1); }

/* ===== Dropdown positioning when bell + user-menu live in the sidebar =====
   The default panel position (top:110%; right:0) works in the topbar where
   the trigger sits at the top-right of the viewport. In the sidebar foot
   the trigger is at the BOTTOM-LEFT, so:
     - top:110%  → panel falls below the viewport
     - right:0   → panel extends LEFT off-screen
   Open them upward and to the right instead. */
.sidebar .user-menu-panel,
.sidebar .notif-panel {
    top: auto;
    bottom: calc(100% + 6px);
    right: auto;
    left: 0;
}

/* ===== Impersonation (parent acting as child) =====
   Persistent banner + amber edge-border so the parent never forgets which
   identity they're acting under. */
.impersonation-banner {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #1a1a2e;
    padding: 0.6rem 1rem;
    text-align: center;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 70;          /* above topbar (50) and notif panel (60) */
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}
.impersonation-icon { font-size: 1.2rem; }
.impersonation-banner .muted { color: rgba(26, 26, 46, 0.7); }
.impersonation-banner .btn {
    background: #1a1a2e;
    color: #fbbf24;
    border-color: transparent;
    font-weight: 700;
}
.impersonation-banner .btn:hover { filter: brightness(1.15); background: #1a1a2e; }

/* Solid amber edge bands around the viewport while impersonating. */
body.is-impersonating::before,
body.is-impersonating::after {
    content: '';
    position: fixed;
    left: 0; right: 0;
    height: 4px;
    background: #f59e0b;
    z-index: 80;
    pointer-events: none;
}
body.is-impersonating::before { top: 0; }
body.is-impersonating::after  { bottom: 0; }

/* "via parent" badge on approval cards */
.badge.via-parent {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    font-weight: 700;
}
.badge.via-parent::before { content: "👤 "; }

/* Settings page */
.settings-form { max-width: 720px; }
.settings-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-xs);
}
.settings-section h2 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--color-accent);
}
.settings-master {
    padding: 0.85rem 1rem;
    background: var(--color-accent-soft);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.settings-event-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--color-surface-2);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
/* The first checkbox label (event name) takes the lion's share of the row;
   the recipients <select> and the trailing "Also email child" checkbox are
   sized to their content. */
.settings-event-row > label.checkbox:first-child { flex: 1; min-width: 200px; }
.settings-event-row > label.checkbox:not(:first-child) {
    flex: 0 0 auto;
    min-width: 0;
    white-space: nowrap;
    font-size: 0.88rem;
}
.recipients-select {
    width: auto;
    min-width: 160px;
    max-width: 220px;
    padding: 0.4rem 0.6rem;
    min-height: 36px;
    font-size: 0.88rem;
}
@media (max-width: 600px) {
    /* On narrow viewports, stack the row and let each control take its own line. */
    .settings-event-row { flex-direction: column; align-items: stretch; }
    .settings-event-row > label.checkbox:first-child { flex: none; }
    .recipients-select { max-width: none; }
}
.settings-test {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--color-surface-2);
    border-radius: var(--radius);
    border: 1px dashed var(--color-border-strong);
    align-items: flex-start;
}

/* Chores list filter bar (Child + Category dropdowns) */
.chores-filter-bar {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 150px;
    flex: 1 1 150px;
}
.filter-field span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 700;
}
.filter-clear { align-self: stretch; }
.filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* ===== Photo freshness badge (parent-only) =====
   Shows the EXIF DateTimeOriginal vs. submission time so parents can spot
   stale uploads. Never rendered on child-facing pages. */
.freshness-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0.5rem 0 0;
    cursor: help;
    line-height: 1.2;
}
.freshness-badge.freshness-inline {
    margin: 0.3rem 0 0;
    font-size: 0.72rem;
}
.freshness-ok {
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
}
.freshness-warn {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}
.freshness-danger {
    background: rgba(220, 38, 38, 0.14);
    color: #b91c1c;
}
.freshness-unknown {
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-text-muted);
}

/* Don't let the impersonate button text wrap to two lines on narrow rows. */
.impersonate-btn { white-space: nowrap; }

/* Avoid the topbar disappearing behind the sticky banner during scroll —
   while impersonating, let the topbar scroll away naturally. The amber edge
   bands + sticky banner still give a constant visual reminder. */
body.is-impersonating .topbar { position: relative; top: auto; }

/* When .photo-btn-hero is also .btn-success, the success colour wins.
   Without this, both Mark done + Mark done + approve render the indigo
   gradient because .photo-btn-hero defines its own background. */
.btn.photo-btn-hero.btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
}
.btn.photo-btn-hero.btn-success:hover {
    background: linear-gradient(135deg, #15803d, #16a34a);
}

/* Photo modal action buttons: stack vertically on narrow viewports so
   "Submit + approve" doesn't wrap to 3 lines and stay tappable. */
.photo-preview-card .actions { gap: 0.5rem; flex-wrap: wrap; }
.photo-preview-card .actions .btn { white-space: nowrap; }
@media (max-width: 480px) {
    .photo-preview-card .actions { flex-direction: column; }
    .photo-preview-card .actions .btn { width: 100%; }
}

/* ============================================================
   Request Repayment card (child Today page)
   ============================================================ */
.repayment-section { margin-top: 1.5rem; }
.repayment-card {
    background: var(--color-surface);
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.repayment-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.repayment-summary::-webkit-details-marker { display: none; }
.repayment-summary-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.repayment-emoji { font-size: 1.5rem; }
.repayment-chevron {
    color: var(--muted);
    font-weight: 700;
    font-size: 1.3rem;
    transition: transform 0.15s ease-out;
}
.repayment-card[open] .repayment-chevron { transform: rotate(90deg); }
.repayment-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0 1.1rem 1.1rem;
}
.repayment-field { display: flex; flex-direction: column; gap: 0.3rem; }
.repayment-field > span { font-weight: 600; font-size: 0.9rem; }
.repayment-field input {
    padding: 0.7rem 0.8rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    min-height: 44px;
}
.repayment-preview {
    max-width: 180px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
    align-self: flex-start;
}
/* The global `img { display: block }` reset (base.css) overrides the bare
   [hidden] UA rule, so the preview would show empty until a photo is picked.
   Re-assert hidden with class+attr specificity. */
.repayment-preview[hidden] { display: none; }
.repayment-photo-row {
    display: flex;
    gap: 0.6rem;
}
.repayment-photo-row > .repayment-photo-label {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
}
/* "Upload Photo" — a lighter companion to the filled-purple Take Photo button. */
.repayment-upload-label {
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
    color: var(--color-accent);
    border: 1.5px solid color-mix(in srgb, var(--color-accent) 35%, transparent);
}
.repayment-upload-label:hover {
    background: color-mix(in srgb, var(--color-accent) 20%, transparent);
}
.repayment-submit { width: 100%; }
/* Very narrow phones: stack the two photo buttons so labels never clip. */
@media (max-width: 360px) {
    .repayment-photo-row { flex-direction: column; }
}

/* ============================================================
   Photo lightbox — fullscreen modal for proof-photo viewing
   ============================================================ */

/* When open, lock the underlying page scroll. */
body.photo-lightbox-open { overflow: hidden; }

/* Reset native <dialog> centering so we can fill the viewport ourselves. */
.photo-lightbox {
    border: 0;
    padding: 0;
    margin: 0;
    width: 100vw;
    height: 100vh;
    /* Use dvh on browsers that support it so the iOS URL bar doesn't crop the image. */
    height: 100dvh;
    max-width: none;
    max-height: none;
    background: rgba(0, 0, 0, 0.92);
    color: #fff;
    overflow: hidden;
}
.photo-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.92);
}
.photo-lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* Allow native pinch-to-zoom on the image itself. */
    touch-action: pinch-zoom;
    transition: transform 0.18s ease-out;
    user-select: none;
    -webkit-user-select: none;
}

.photo-lightbox-close {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 0.6rem);
    right: calc(env(safe-area-inset-right, 0px) + 0.8rem);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.9rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.photo-lightbox-close:hover,
.photo-lightbox-close:focus-visible {
    background: rgba(0, 0, 0, 0.78);
    outline: none;
}
