/* Home, Hồ sơ con, Cài đặt, Quyền riêng tư - builds on app.css */

.page { max-width: 640px; display: flex; flex-direction: column; gap: 16px; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}
.card h2, .card h3 { margin: 0 0 10px; font-size: 1.05rem; color: var(--ink); }
.card p { margin: 0 0 10px; line-height: 1.55; }
.card p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- Child cards (home) ---------- */
.child-card { display: flex; flex-direction: column; gap: 14px; }
.child-head { display: flex; align-items: center; gap: 12px; }
.child-avatar {
    width: 48px; height: 48px; border-radius: 16px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand-700); font-weight: 800; font-size: 1.2rem;
}
.hello .mascot { width: 84px; }
.child-name { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.child-today { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.child-actions { display: flex; gap: 10px; }
.child-actions .btn { flex: 1; justify-content: center; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--card-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.kpi b { display: block; font-size: 1rem; line-height: 1.25; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 0.75rem; color: var(--muted); }

.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }

/* ---------- Rows, toggles, chips (settings) ---------- */
.rows { display: flex; flex-direction: column; }
.row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: none; padding-bottom: 0; }
.row:first-child { padding-top: 0; }
label.row { cursor: pointer; }
.row-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-label { font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.row-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.row-block { flex-direction: column; align-items: stretch; gap: 10px; }

.toggle { position: relative; flex: none; width: 46px; height: 26px; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle .slider {
    position: absolute; inset: 0; border-radius: 999px; background: #cfd5e3;
    transition: background 0.2s; pointer-events: none;
}
.toggle .slider::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
.toggle input:checked + .slider { background: var(--brand); }
.toggle input:checked + .slider::after { transform: translateX(20px); }
.toggle input:focus-visible + .slider { outline: 2px solid var(--brand); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--card-2); color: var(--text); font-size: 0.88rem; font-weight: 500; cursor: pointer;
    text-decoration: none;
}
.chip:hover { border-color: var(--brand); }
.chip.is-on { border-color: var(--brand); background: var(--brand); color: #fff; font-weight: 700; }

.save-status { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 0; min-height: 1.2em; }
.save-status.is-error { color: var(--danger); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.form input[type="text"], .form input[type="number"], .form input[type="password"], .form select, .input {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--card-2); color: var(--text); font-size: 1rem;
}
.form input:focus, .input:focus { outline: 2px solid var(--brand); outline-offset: 1px; background: #fff; }
.form-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-error { color: var(--danger); font-size: 0.85rem; margin: 0; min-height: 1.2em; }

.btn.danger-btn { background: var(--danger-50); color: var(--danger); border-color: transparent; }
.btn.small-btn { padding: 8px 12px; font-size: 0.85rem; }

/* ---------- Child list (Hồ sơ con) ---------- */
.child-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.child-row:last-child { border-bottom: none; }
.child-row .child-info { flex: 1; min-width: 0; }
.child-row .child-info b { display: block; color: var(--ink); }
.child-row .child-info span { font-size: 0.8rem; color: var(--muted); }
.icon-btn {
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2);
    color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.danger { color: var(--danger); }

/* ---------- Sheet (PIN, confirmations) ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 20, 40, 0.5); }
.sheet-card {
    position: relative; width: 100%; max-width: 480px; background: var(--card); color: var(--text);
    border-radius: 24px 24px 0 0; padding: 22px 20px calc(env(safe-area-inset-bottom) + 22px);
    box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 12px;
}
.sheet-card h2 { margin: 0; font-size: 1.15rem; color: var(--ink); }
.sheet-card p { margin: 0; line-height: 1.5; }
@media (min-width: 640px) {
    .sheet { align-items: center; }
    .sheet-card { border-radius: 24px; }
}
.pin-input {
    width: 100%; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--card-2); font-size: 1.6rem; letter-spacing: 0.5em; text-align: center; color: var(--ink);
}

/* ---------- Privacy ---------- */
.prose h2 { margin: 18px 0 8px; font-size: 1.05rem; color: var(--ink); }
.prose h2:first-child { margin-top: 0; }
.prose ul { margin: 0 0 10px; padding-left: 20px; line-height: 1.6; }
.prose p { line-height: 1.6; }
.auth-card .consent { align-items: flex-start; line-height: 1.45; font-weight: 400; }
.auth-card .consent input { margin-top: 3px; flex: none; }

@media (min-width: 1024px) {
    .page { gap: 20px; }
}

/* The quiet button: brand-tinted here (the inherited peach reads as "danger" next to a delete button) */
.btn.secondary-btn { background: var(--brand-50); color: var(--brand-700); border-color: transparent; }
.btn.secondary-btn:hover { background: var(--brand-100); }

.google-row { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.card .flash-list { margin: 0 0 12px; }
.row > .chip { flex: none; white-space: nowrap; }
