:root {
    --paper: #fffaf0;
    --ink: #2e2a32;
    --card: #ffffff;
    --line: #e8ddcf;
    --bean: #6c4aa1;
    --leaf: #3e8b61;
    --warm: #f4b860;
    --soft: #f6edf9;
    --danger: #a33a4a;
    font-family: ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--bean); }
.app-header { position: sticky; top: 0; z-index: 10; padding: 14px 18px; background: rgba(255,250,240,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.header-inner { width: min(920px, 100%); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; gap: 8px; align-items: center; text-decoration: none; font-weight: 900; font-size: 1.25rem; color: var(--ink); }
.header-nav { display: flex; align-items: center; gap: 14px; font-size: .92rem; font-weight: 800; }
.header-nav a { text-decoration: none; }
.page-shell { width: min(820px, calc(100% - 28px)); margin: 28px auto 64px; }
.hero { text-align: center; padding: 30px 14px 12px; }
.hero h1 { font-size: clamp(2.1rem, 8vw, 4.3rem); margin: 0; line-height: .95; }
.hero p { font-size: 1.08rem; line-height: 1.55; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: 0 8px 22px rgba(60,40,30,.06); margin: 18px 0; }
.subtle-card { box-shadow: none; background: rgba(255,255,255,.58); }
.parent-hero { background: linear-gradient(135deg, #fff 0%, #fbf4ff 100%); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.btn { display: inline-flex; justify-content: center; align-items: center; min-height: 50px; padding: 12px 18px; border: 0; border-radius: 16px; text-decoration: none; font: inherit; font-weight: 800; cursor: pointer; background: var(--bean); color: #fff; }
.btn.alt { background: var(--leaf); }
.btn.soft { background: var(--soft); color: var(--bean); border: 1px solid #dfccea; }
.btn.compact { min-height: 42px; padding: 9px 13px; white-space: nowrap; }
label { display: block; font-weight: 800; margin: 14px 0 6px; }
input, select, textarea { width: 100%; font: inherit; font-size: 1rem; padding: 13px 14px; border: 1px solid #cfc3b6; border-radius: 14px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(108,74,161,.14); border-color: var(--bean); }
.notice { border-radius: 14px; padding: 12px 14px; margin: 12px 0; background: #fff0f1; color: #7f2636; }
.success-notice { border-radius: 14px; padding: 12px 14px; margin: 12px 0; background: #edf8ef; color: #245d3b; }
.muted { color: #6e6670; }
.small-text { font-size: .86rem; }
.site-footer { text-align: center; padding: 28px 18px 48px; font-size: .88rem; color: #786f77; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; background: #edf7ef; color: #27643f; font-weight: 800; font-size: .82rem; }
.admin-badge { background: #f4ecff; color: #5f3c91; }
.moderation-badge { background: #fff3dc; color: #795116; }

.parent-actions { margin: 18px 0; }
.action-card { min-height: 148px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px; padding: 20px; border-radius: 20px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); box-shadow: 0 7px 18px rgba(60,40,30,.05); }
.action-card:hover { transform: translateY(-1px); }
.action-card strong { font-size: 1.08rem; }
.action-card > span:last-child { color: #6e6670; font-size: .92rem; }
.action-icon { font-size: 2rem; }

.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin-top: 0; }
.empty-state { text-align: center; padding: 24px 10px 12px; }
.empty-icon { font-size: 2.5rem; }
.profile-list { border-top: 1px solid var(--line); margin-top: 14px; }
.profile-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 15px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.profile-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--soft); font-size: 1.35rem; }
.profile-main { display: flex; flex-direction: column; gap: 2px; }
.profile-flags { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.chevron { color: #9a8e98; font-size: 1.8rem; }

.field-help { margin: 6px 0 12px; color: #6e6670; font-size: .88rem; }
.settings-box { margin: 22px 0; padding: 16px; border: 1px solid var(--line); border-radius: 18px; }
.settings-box legend { padding: 0 8px; font-weight: 900; }
.check-row { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: flex-start; margin: 13px 0; font-weight: 400; }
.check-row input[type="checkbox"] { width: 20px; height: 20px; margin: 2px 0 0; padding: 0; accent-color: var(--bean); }
.check-row span { display: flex; flex-direction: column; gap: 3px; }
.check-row small { color: #6e6670; font-size: .87rem; line-height: 1.4; }
.consent-row { padding: 15px; border-radius: 16px; background: #fbf7ff; border: 1px solid #e5d7ef; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.invite-link-box { margin-top: 18px; padding: 16px; border-radius: 16px; background: #fff8e9; border: 1px solid #efd8a7; }
.private-service-note { margin: 18px 0; padding: 16px; border-radius: 16px; background: #f6f0fa; border: 1px solid #e4d5ed; }
.private-service-note p { margin-bottom: 0; }
.simple-list { border-top: 1px solid var(--line); }
.simple-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 13px 2px; border-bottom: 1px solid var(--line); }

@media (max-width: 620px) {
    .app-header { padding: 12px 14px; }
    .header-nav { gap: 9px; font-size: .82rem; }
    .page-shell { width: min(100% - 18px, 820px); margin-top: 14px; }
    .card { padding: 18px; border-radius: 18px; }
    .section-heading { align-items: flex-start; }
    .profile-row { grid-template-columns: auto 1fr auto; }
    .profile-flags { grid-column: 2 / 3; justify-content: flex-start; }
    .chevron { grid-row: 1 / span 2; grid-column: 3; }
    .form-actions .btn { flex: 1 1 150px; }
}

/* ===== Kid messaging ===== */
.eyebrow { display: inline-block; margin-bottom: 5px; color: var(--leaf); font-size: .78rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.kid-hero, .page-title-row, .chat-page-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 12px 0 20px; }
.kid-hero h1, .page-title-row h1, .chat-page-head h1 { margin: 2px 0 6px; }
.kid-hero p, .page-title-row p { margin: 0; }
.new-chat-btn { white-space: nowrap; }
.count-bubble, .unread-badge { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--bean); color: #fff; font-size: .82rem; font-weight: 900; }
.invite-card { border-color: #ead5f4; background: linear-gradient(135deg, #fff 0%, #fff8e8 100%); }
.invite-list, .chat-list, .member-list { border-top: 1px solid var(--line); margin-top: 14px; }
.invite-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 16px 2px; border-bottom: 1px solid var(--line); }
.invite-copy { display: flex; flex-direction: column; gap: 4px; }
.invite-copy > span { color: #6e6670; font-size: .88rem; }
.invite-actions { display: flex; gap: 7px; }
.chat-avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 17px; background: #f6edf9; font-size: 1.45rem; flex: 0 0 auto; }
.chat-list-card { padding-bottom: 8px; }
.chat-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 15px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.chat-row:last-child { border-bottom: 0; }
.chat-row-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.chat-title-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-preview { display: block; overflow: hidden; color: #6e6670; font-size: .9rem; white-space: nowrap; text-overflow: ellipsis; }
.waiting-text { color: #8a5b1a; }
.friend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; }
.friend-card { display: flex; min-height: 175px; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: #fffaf7; text-align: center; }
.friend-avatar { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: var(--soft); font-size: 2rem; }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.mode-tabs a { padding: 12px; border-radius: 13px; color: #6e6670; font-weight: 900; text-align: center; text-decoration: none; }
.mode-tabs a.active { background: var(--soft); color: var(--bean); }
.picker-list { display: grid; gap: 8px; margin: 10px 0 16px; }
.picker-row { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 11px; margin: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; }
.picker-row input { width: 20px; height: 20px; margin: 0; accent-color: var(--bean); }
.picker-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--soft); }
.round-back { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 1px solid var(--line); color: var(--bean); font-size: 2rem; line-height: 1; text-decoration: none; flex: 0 0 auto; }
.chat-heading-copy { min-width: 0; flex: 1; }
.safety-strip { margin: 10px 0 14px; padding: 9px 12px; border-radius: 13px; background: #edf7ef; color: #356647; font-size: .8rem; text-align: center; }
.message-thread { min-height: 280px; padding: 18px 12px 24px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.67); }
.thread-empty { min-height: 230px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; color: #6e6670; text-align: center; }
.thread-empty > div { font-size: 2.5rem; }
.message-wrap { display: flex; flex-direction: column; align-items: flex-start; margin: 12px 0; }
.message-wrap.mine { align-items: flex-end; }
.message-sender { margin: 0 8px 4px; color: #756c77; font-size: .76rem; font-weight: 900; }
.message-bubble { max-width: min(80%, 560px); padding: 11px 14px; border-radius: 19px 19px 19px 6px; background: #fff; border: 1px solid #e6dcd0; overflow-wrap: anywhere; line-height: 1.42; }
.message-wrap.mine .message-bubble { border-radius: 19px 19px 6px 19px; background: #f5ecfb; border-color: #e2d0ee; }
.message-time { margin: 4px 8px 0; color: #958b94; font-size: .7rem; }
.style-big { font-size: 1.45rem; font-weight: 900; line-height: 1.2; }
.style-script { font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; font-size: 1.13rem; }
.style-cheer { font-weight: 900; letter-spacing: .025em; }
.style-quiet { font-size: .88rem; font-style: italic; }
.color-berry { color: #a02f54; }
.color-grape { color: #6c4aa1; }
.color-ocean { color: #26769a; }
.color-leaf { color: #347a54; }
.color-sunset { color: #b75b2a; }
.color-bubblegum { color: #bc4f8a; }
.composer-card { position: sticky; bottom: 8px; z-index: 5; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,250,240,.97); box-shadow: 0 10px 28px rgba(55,35,25,.12); backdrop-filter: blur(10px); }
.composer-card textarea { resize: vertical; min-height: 76px; }
.emoji-bar { display: flex; gap: 5px; margin-bottom: 8px; overflow-x: auto; padding-bottom: 3px; }
.emoji-btn { flex: 0 0 auto; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 1.15rem; cursor: pointer; }
.composer-tools { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 9px; margin-top: 9px; }
.composer-tools label { margin: 0; }
.composer-tools label > span { display: block; margin: 0 0 4px; color: #756c77; font-size: .75rem; font-weight: 900; }
.composer-tools select { padding: 9px 10px; min-height: 46px; }
.send-btn { min-height: 46px; }
.message-preview-row { display: flex; align-items: center; gap: 9px; margin-top: 9px; }
.preview-bubble { max-width: 220px; padding: 6px 10px; }
.waiting-card { text-align: center; }
.member-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.member-name { font-weight: 800; }
.member-status-invited { background: #fff3dc; color: #795116; }
.member-status-declined, .member-status-left { background: #f2eeee; color: #74696b; }
.danger-zone { border-color: #efd1d6; }
.danger-btn { background: var(--danger); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 620px) {
    .kid-hero, .page-title-row { align-items: flex-start; flex-direction: column; }
    .kid-hero .btn, .page-title-row .btn { width: 100%; }
    .invite-row { grid-template-columns: auto 1fr; }
    .invite-actions { grid-column: 1 / -1; }
    .invite-actions .btn { flex: 1; }
    .header-inner { align-items: flex-start; }
    .header-nav { max-width: 70%; justify-content: flex-end; flex-wrap: wrap; line-height: 1.2; }
    .chat-page-head { gap: 9px; }
    .chat-page-head h1 { font-size: 1.35rem; }
    .message-thread { padding: 12px 8px 18px; border-radius: 18px; }
    .message-bubble { max-width: 88%; }
    .composer-card { bottom: 4px; padding: 10px; border-radius: 18px; }
    .composer-tools { grid-template-columns: 1fr 1fr; }
    .send-btn { grid-column: 1 / -1; width: 100%; }
    .message-preview-row { display: none; }
}

/* ===== Parent safety dashboard ===== */
.parent-review-head { align-items: flex-start; }
.review-filter-card { padding: 15px 18px; }
.review-filter-form { display: grid; grid-template-columns: minmax(130px,.8fr) minmax(130px,.8fr) minmax(220px,1.6fr) auto auto; align-items: end; gap: 10px; }
.review-filter-form label, .conversation-search-form label { margin: 0; }
.review-filter-form label > span, .conversation-search-form label > span { display: block; margin-bottom: 4px; color: #756c77; font-size: .76rem; font-weight: 900; }
.review-filter-form select, .review-filter-form input, .conversation-search-form input { min-height: 44px; padding: 9px 11px; }
.parent-safety-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 13px 2px; color: #6e6670; font-size: .9rem; }
.parent-safety-links a { font-weight: 900; }
.parent-chat-list .chat-row { align-items: flex-start; }
.participant-preview { color: #8a7f87; font-size: .79rem; }
.review-date { color: #9a9097; font-size: .72rem; }
.parent-review-notice { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin: 10px 0 14px; padding: 12px 14px; border: 1px solid #d9c5e7; border-radius: 15px; background: #f8f1fb; color: #5f4c69; font-size: .86rem; }
.compact-review-tools { padding: 14px 16px; }
.conversation-search-form { display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 9px; }
.review-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 9px; color: #867b84; font-size: .76rem; }
.parent-message-thread { margin-top: 14px; }
.parent-message .message-sender { display: block; max-width: 88%; }
.parent-message-hidden .message-bubble { border-style: dashed; opacity: .82; }
.parent-message-hidden .message-sender strong { color: #9c5260; }
.review-pagination { display: flex; justify-content: space-between; gap: 12px; margin: 14px 0; }
.child-switcher { padding: 13px 16px; }
.child-switcher form { display: flex; align-items: center; gap: 10px; }
.child-switcher label { margin: 0; font-weight: 900; }
.child-switcher select { width: auto; min-width: 180px; }
.safety-grid { grid-template-columns: minmax(0,1.25fr) minmax(250px,.75fr); }
.safety-explainer { background: linear-gradient(145deg, #fff 0%, #faf3fc 100%); }
.alert-add-form { margin: 18px 0; }
.inline-form-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: center; }
.inline-form-row input { margin: 0; }
.alert-word-list { margin-top: 10px; border-top: 1px solid var(--line); }
.alert-word-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.alert-word-row form { margin: 0; }
.text-button { border: 0; background: transparent; color: #9c4455; font: inherit; font-size: .84rem; font-weight: 900; cursor: pointer; }
.empty-mini { margin-top: 14px; padding: 14px; border-radius: 14px; background: #faf7f4; color: #81767e; text-align: center; }
.compact-empty { padding: 14px 0; }
.safety-alert-list { border-top: 1px solid var(--line); }
.safety-alert-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 11px; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.alert-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: #fff0f1; font-size: 1.2rem; }
.alert-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.alert-main span { color: #6e6670; font-size: .84rem; }
.alert-main time { color: #968b93; font-size: .72rem; }
.email-status-sent { background: #eaf6ed; color: #34704a; }
.email-status-failed { background: #fff0f1; color: #9b4655; }
.email-status-pending { background: #fff3dc; color: #795116; }

@media (max-width: 760px) {
    .review-filter-form { grid-template-columns: 1fr 1fr; }
    .review-search-field { grid-column: 1 / -1; }
    .review-filter-form .btn { width: 100%; }
    .safety-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .parent-review-head { flex-direction: column; }
    .parent-review-head .btn { width: 100%; }
    .parent-safety-links { align-items: flex-start; flex-direction: column; }
    .parent-review-notice { grid-template-columns: 1fr; }
    .conversation-search-form { grid-template-columns: 1fr 1fr; }
    .conversation-search-form .review-search-field { grid-column: 1 / -1; }
    .inline-form-row { grid-template-columns: 1fr; }
    .inline-form-row .btn { width: 100%; }
    .safety-alert-row { grid-template-columns: auto 1fr auto; }
    .safety-alert-row .badge { grid-column: 2 / 3; justify-self: start; }
    .safety-alert-row .chevron { grid-column: 3; grid-row: 1 / span 2; }
    .child-switcher form { align-items: stretch; flex-direction: column; }
    .child-switcher select { width: 100%; }
}

/* BeansTalk photo sharing */
.photo-picker {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin: .8rem 0;
    padding: .8rem 1rem;
    border: 2px dashed rgba(80, 72, 112, .25);
    border-radius: 18px;
    background: rgba(255,255,255,.65);
    cursor: pointer;
}
.photo-picker:hover { background: rgba(255,255,255,.9); }
.photo-picker-icon { font-size: 1.8rem; }
.photo-picker > span:nth-child(2) { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.photo-picker small { color: var(--muted, #6b6878); }
.photo-picker input[type="file"] { max-width: 48%; }

.message-photo-block {
    width: min(420px, 82vw);
    margin: .25rem 0 .35rem;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255,255,255,.76);
    border: 1px solid rgba(70,60,90,.12);
    box-shadow: 0 5px 18px rgba(60,50,80,.08);
}
.message-wrap.mine .message-photo-block { margin-left: auto; }
.chat-photo {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    background: #f3f0f7;
}
.photo-status {
    padding: .55rem .75rem;
    font-size: .82rem;
    line-height: 1.35;
    color: #625d6d;
    background: rgba(255,255,255,.88);
}
.photo-placeholder {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: 1.4rem;
    text-align: center;
    color: #686271;
    background: repeating-linear-gradient(135deg, #f5f1f8, #f5f1f8 12px, #eee9f2 12px, #eee9f2 24px);
}
.photo-placeholder span { font-size: 2.2rem; }
.message-photo-block.pending { border-style: dashed; }
.message-photo-block.rejected { opacity: .85; }
.parent-photo-block { width: min(520px, 88vw); }

.inline-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    height: 1.6em;
    padding: 0 .42em;
    margin-left: .25rem;
    border-radius: 999px;
    background: #e74d76;
    color: #fff;
    font-size: .78em;
}
.approval-section { margin-bottom: 1rem; }
.approval-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.approval-card {
    overflow: hidden;
    border: 1px solid rgba(70,60,90,.12);
    border-radius: 20px;
    background: rgba(255,255,255,.75);
}
.approval-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #f1edf4;
}
.approval-copy {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: .85rem .9rem .4rem;
}
.approval-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem;
    padding: .6rem .9rem .9rem;
}
.approval-actions .btn { width: 100%; }
.compact-empty { padding: 1.2rem; }

@media (max-width: 640px) {
    .photo-picker { align-items: flex-start; flex-wrap: wrap; }
    .photo-picker input[type="file"] { max-width: 100%; width: 100%; }
    .approval-actions { grid-template-columns: 1fr; }
    .message-photo-block, .parent-photo-block { width: min(86vw, 420px); }
}

/* ===== BeansTalk administration ===== */
.wide-shell { width: min(1160px, calc(100% - 28px)); }
.admin-nav-link { padding: 6px 9px; border-radius: 10px; background: #f4ecff; color: #5f3c91 !important; }
.admin-page .eyebrow { color: #6c4aa1; }
.admin-action-card { background: linear-gradient(145deg, #fff 0%, #f7f0ff 100%); border-color: #ddcaea; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.admin-stat-card { display: flex; min-height: 132px; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: #fff; color: var(--ink); text-decoration: none; box-shadow: 0 7px 18px rgba(60,40,30,.05); }
.admin-stat-card > span { color: #746a74; font-size: .82rem; font-weight: 900; text-transform: uppercase; letter-spacing: .045em; }
.admin-stat-card > strong { font-size: 2rem; line-height: 1; }
.admin-stat-card > small { margin-top: auto; color: #766d75; line-height: 1.4; }
.admin-action-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.admin-filter-card { padding: 14px 16px; }
.admin-filter-form { display: grid; grid-template-columns: minmax(220px,1.5fr) minmax(170px,.8fr) auto auto; gap: 9px; align-items: end; }
.admin-filter-form label { margin: 0; }
.admin-filter-form label > span { display: block; margin: 0 0 4px; color: #756c77; font-size: .76rem; font-weight: 900; }
.admin-filter-form input, .admin-filter-form select { min-height: 44px; padding: 9px 11px; }
.admin-table-card { overflow: hidden; }
.admin-family-list { margin-top: 12px; border-top: 1px solid var(--line); }
.admin-family-row { display: grid; grid-template-columns: auto minmax(220px,1.4fr) auto minmax(125px,.6fr) auto; align-items: center; gap: 13px; padding: 15px 3px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.admin-family-main { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.admin-name-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.admin-family-stats { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 1px 5px; min-width: 92px; }
.admin-family-stats strong { font-size: 1.05rem; }
.admin-family-stats small { color: #857b83; }
.admin-last-seen { display: flex; flex-direction: column; gap: 3px; }
.admin-last-seen small { color: #92878f; }
.admin-last-seen strong { font-size: .82rem; }
.status-active { background: #eaf6ed; color: #34704a; }
.status-suspended, .status-paused { background: #fff3dc; color: #795116; }
.status-banned { background: #fff0f1; color: #9b4655; }
.admin-detail-grid { display: grid; grid-template-columns: minmax(300px,.85fr) minmax(420px,1.15fr); gap: 16px; align-items: start; }
.admin-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.admin-facts > div { padding: 11px 12px; border-radius: 14px; background: #faf7f4; }
.admin-facts dt { color: #847981; font-size: .76rem; font-weight: 900; }
.admin-facts dd { margin: 4px 0 0; font-weight: 800; }
.admin-control-box { margin-top: 18px; padding: 15px; border: 1px solid #ead9dc; border-radius: 17px; background: #fffafa; }
.admin-control-box .btn { margin-top: 13px; }
.admin-child-list { display: grid; gap: 12px; }
.admin-child-card { padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: #fffdf9; }
.admin-child-heading { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.admin-child-metrics { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; color: #746b73; font-size: .82rem; }
.admin-child-controls { display: grid; grid-template-columns: minmax(115px,.55fr) minmax(180px,1fr) auto; gap: 8px; align-items: center; }
.admin-child-controls select, .admin-child-controls input { margin: 0; min-height: 43px; padding: 9px 10px; }
.admin-log-row { align-items: flex-start; }
.admin-log-row time { white-space: nowrap; }
.admin-reason { margin-top: 5px; color: #514a51; font-size: .86rem; }
.invite-admin-grid { grid-template-columns: minmax(380px,1.1fr) minmax(280px,.9fr); }
.admin-rule-list { padding-left: 20px; color: #625b63; line-height: 1.55; }
.admin-rule-list li + li { margin-top: 7px; }
.admin-invite-list { border-top: 1px solid var(--line); }
.admin-invite-row { display: grid; grid-template-columns: minmax(220px,1fr) auto auto; gap: 12px; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.admin-inline-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.admin-inline-actions form { margin: 0; }
.invite-state-pending { background: #fff3dc; color: #795116; }
.invite-state-joined { background: #eaf6ed; color: #34704a; }
.invite-state-expired, .invite-state-revoked { background: #f2eeee; color: #74696b; }
.admin-ban-notice { margin-top: 6px; }
.audit-list .admin-log-row { padding-top: 11px; padding-bottom: 11px; }

@media (max-width: 900px) {
    .admin-stat-grid { grid-template-columns: 1fr 1fr; }
    .admin-action-grid { grid-template-columns: 1fr; }
    .admin-detail-grid, .invite-admin-grid { grid-template-columns: 1fr; }
    .admin-family-row { grid-template-columns: auto 1fr auto; }
    .admin-family-stats, .admin-last-seen { grid-column: 2 / 3; }
    .admin-family-stats { display: flex; gap: 5px; }
    .admin-family-stats small { margin-right: 8px; }
    .admin-family-row .chevron { grid-column: 3; grid-row: 1 / span 3; }
}

@media (max-width: 660px) {
    .wide-shell { width: min(100% - 18px, 1160px); }
    .admin-stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .admin-stat-card { min-height: 122px; padding: 14px; }
    .admin-stat-card > strong { font-size: 1.65rem; }
    .admin-filter-form { grid-template-columns: 1fr 1fr; }
    .admin-filter-form label:first-child { grid-column: 1 / -1; }
    .admin-filter-form .btn { width: 100%; }
    .admin-facts { grid-template-columns: 1fr; }
    .admin-child-controls { grid-template-columns: 1fr; }
    .admin-child-controls .btn { width: 100%; }
    .admin-invite-row { grid-template-columns: 1fr auto; align-items: start; }
    .admin-inline-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .admin-log-row { flex-direction: column; align-items: flex-start; }
}

/* ===== BeansTalk reporting & moderation ===== */
.nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.45em;
    height: 1.45em;
    padding: 0 .36em;
    border-radius: 999px;
    background: #b83f58;
    color: #fff;
    font-size: .78em;
    line-height: 1;
}
.message-report-actions {
    display: flex;
    gap: .65rem;
    margin-top: .18rem;
    font-size: .72rem;
}
.message-wrap.mine .message-report-actions { justify-content: flex-end; }
.message-report-actions a {
    color: #8a6670;
    text-decoration: none;
    border-bottom: 1px dotted rgba(138,102,112,.5);
}
.message-report-actions a:hover { color: #9b3f58; }
.parent-report-actions { margin-top: .28rem; }
.report-layout {
    display: grid;
    grid-template-columns: minmax(280px,.9fr) minmax(340px,1.1fr);
    gap: 16px;
    align-items: start;
}
.report-preview-card { overflow: hidden; }
.report-preview-card h2 { margin-bottom: 12px; }
.report-preview-image {
    display: block;
    width: 100%;
    max-height: 560px;
    object-fit: contain;
    margin: 10px 0 12px;
    border-radius: 16px;
    background: #f2eef4;
}
.report-message-preview {
    margin: 12px 0;
    padding: 16px;
    border-radius: 17px;
    background: #f8f4fb;
    border: 1px solid #e9dff0;
    white-space: normal;
    overflow-wrap: anywhere;
}
.compact-message-preview { padding: 11px 13px; font-size: .9rem; }
.report-help-note {
    padding: 11px 13px;
    border-radius: 14px;
    background: #fff7e7;
    color: #6f5428;
    font-size: .88rem;
    line-height: 1.45;
}
.warning-btn { background: #b97822; color: #fff; }
.warning-btn:hover { filter: brightness(.96); }
.report-count-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 8px;
    margin: 14px 0;
}
.report-count-strip span {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
    color: #776c76;
    text-align: center;
}
.report-count-strip strong { display: block; color: var(--ink); font-size: 1.2rem; }
.admin-report-filter-form {
    display: grid;
    grid-template-columns: minmax(200px,1.3fr) repeat(3,minmax(145px,.7fr)) auto auto;
    gap: 8px;
    align-items: end;
}
.admin-report-filter-form label { margin: 0; }
.admin-report-filter-form label > span {
    display: block;
    margin: 0 0 4px;
    color: #756c77;
    font-size: .76rem;
    font-weight: 900;
}
.admin-report-filter-form input,
.admin-report-filter-form select { min-height: 44px; padding: 9px 10px; }
.admin-report-list { border-top: 1px solid var(--line); }
.admin-report-row {
    display: grid;
    grid-template-columns: auto minmax(230px,1fr) minmax(130px,auto) auto;
    gap: 12px;
    align-items: center;
    padding: 15px 2px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
}
.report-type-icon { font-size: 1.5rem; }
.admin-report-main { min-width: 0; }
.report-status-open { background: #fff0f1; color: #9b4655; }
.report-status-reviewing { background: #fff3dc; color: #795116; }
.report-status-resolved { background: #eaf6ed; color: #34704a; }
.report-status-dismissed { background: #f1eeee; color: #74696b; }
.report-stat-card { background: linear-gradient(145deg,#fff 0%,#fff5f6 100%); }
.report-action-card { background: linear-gradient(145deg,#fff 0%,#fff4f5 100%); }
.admin-report-detail-grid {
    display: grid;
    grid-template-columns: minmax(360px,1.05fr) minmax(340px,.95fr);
    gap: 16px;
    align-items: start;
}
.admin-report-image { max-height: 620px; }
.admin-content-removed-note {
    margin: 9px 0;
    padding: 10px 12px;
    border-radius: 13px;
    background: #fff0f1;
    color: #8f4150;
    font-weight: 800;
}
.report-detail-note {
    margin-top: 13px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #faf7f4;
}
.report-detail-note p { margin: 6px 0 0; line-height: 1.5; }
.admin-review-history { background: #f7f3fb; }
.moderation-actions-card { margin-top: 16px; }
.moderation-action-form { display: grid; gap: 13px; }
.moderation-note-field textarea { width: 100%; }
.moderation-button-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.moderation-button-grid .btn { margin: 0; }
.admin-stat-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

@media (max-width: 900px) {
    .report-layout, .admin-report-detail-grid { grid-template-columns: 1fr; }
    .admin-report-filter-form { grid-template-columns: 1fr 1fr; }
    .admin-report-filter-form label:first-child { grid-column: 1 / -1; }
    .admin-report-filter-form .btn { width: 100%; }
}

@media (max-width: 640px) {
    .report-count-strip { grid-template-columns: 1fr 1fr; }
    .admin-report-row { grid-template-columns: auto 1fr auto; align-items: start; }
    .admin-report-row .admin-last-seen { grid-column: 2 / 3; }
    .admin-report-row .chevron { grid-column: 3; grid-row: 1 / span 2; }
    .moderation-button-grid { display: grid; grid-template-columns: 1fr; }
    .moderation-button-grid .btn { width: 100%; }
    .message-report-actions { font-size: .76rem; }
}
.admin-action-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ===== BeansTalk PWA + phone experience (0.2.0) ===== */
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
.connection-banner { position: fixed; inset: 0 0 auto; z-index: 1000; padding: 8px 14px; background: #563f6e; color: #fff; text-align: center; font-size: .82rem; font-weight: 800; }
.connection-banner:not([hidden]) + .app-header { margin-top: 34px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #edf7ef; }
.child-bottom-nav { display: none; }
.kid-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ios-install-tip { margin: -8px 0 14px; padding: 10px 12px; border: 1px solid #e3d6eb; border-radius: 14px; background: #fbf6ff; color: #665c6b; font-size: .84rem; }
.chat-preview-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-preview-line .chat-preview { flex: 1; min-width: 0; }
.chat-row-time { flex: 0 0 auto; color: #938a92; font-size: .72rem; font-weight: 700; }
.chat-row.has-unread .chat-title-line strong { font-weight: 950; }
.chat-row.has-unread .chat-preview { color: #3d3740; font-weight: 750; }
.chat-date-separator { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; color: #8d838b; font-size: .72rem; font-weight: 850; text-align: center; }
.chat-date-separator::before, .chat-date-separator::after { content: ''; height: 1px; flex: 1; background: #e9e0d7; }
.chat-date-separator span { padding: 3px 8px; border-radius: 999px; background: rgba(255,250,240,.92); white-space: nowrap; }
.kid-chat-screen .message-bubble { white-space: pre-wrap; }
.new-message-jump { position: fixed; bottom: 110px; left: 50%; z-index: 4; transform: translateX(-50%); border: 0; border-radius: 999px; padding: 8px 13px; background: #6c4aa1; color: #fff; box-shadow: 0 5px 16px rgba(57,39,78,.2); font: inherit; font-size: .78rem; font-weight: 900; cursor: pointer; }
.composer-primary { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: end; gap: 8px; }
.composer-primary textarea { min-height: 46px; max-height: 120px; margin: 0; resize: none; padding: 11px 13px; line-height: 1.35; }
.composer-photo-button { display: grid; place-items: center; width: 46px; height: 46px; margin: 0; border: 1px solid #dfccea; border-radius: 15px; background: #f6edf9; cursor: pointer; font-size: 1.25rem; }
.composer-photo-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.composer-primary .send-btn { width: 48px; min-width: 48px; min-height: 46px; padding: 0; border-radius: 15px; font-size: 1.3rem; }
.composer-primary .send-btn:disabled { opacity: .6; }
.selected-photo-name { margin: 7px 4px 0; overflow: hidden; color: #6f6670; font-size: .78rem; white-space: nowrap; text-overflow: ellipsis; }
.composer-extras { margin-top: 7px; }
.composer-extras > summary { width: max-content; padding: 6px 8px; border-radius: 10px; color: #6c4aa1; cursor: pointer; font-size: .78rem; font-weight: 900; list-style: none; }
.composer-extras > summary::-webkit-details-marker { display: none; }
.composer-extras[open] > summary { background: #f6edf9; }
.composer-extras .emoji-bar { margin: 7px 0 4px; }
.composer-extras .composer-tools { grid-template-columns: 1fr 1fr; }
.composer-extras .message-preview-row { grid-column: 1 / -1; margin-top: 0; }

@media (max-width: 700px) {
    body.child-session { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
    .child-session .app-header { padding: calc(9px + env(safe-area-inset-top)) 13px 9px; }
    .child-session .header-inner { justify-content: center; }
    .child-session .brand { font-size: 1.12rem; }
    .child-session .header-nav { display: none; }
    .child-session .page-shell { width: min(100% - 14px, 820px); margin-top: 8px; margin-bottom: 18px; }
    .child-session .site-footer { display: none; }
    .child-bottom-nav { position: fixed; inset: auto 0 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); min-height: calc(64px + env(safe-area-inset-bottom)); padding: 5px 6px calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid #e4d9cd; background: rgba(255,250,240,.97); box-shadow: 0 -6px 20px rgba(55,35,25,.08); backdrop-filter: blur(14px); }
    .child-bottom-nav a { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px 2px; border-radius: 12px; color: #756b75; text-decoration: none; }
    .child-bottom-nav a > span { font-size: 1.25rem; line-height: 1.2; }
    .child-bottom-nav a small { font-size: .68rem; font-weight: 850; }
    .child-bottom-nav a.active { background: #f3eaf8; color: #5f3c91; }
    .kid-hero { margin: 8px 0 12px; gap: 10px; }
    .kid-hero h1 { font-size: 1.65rem; }
    .kid-hero p { font-size: .88rem; }
    .kid-hero-actions { width: 100%; display: grid; grid-template-columns: auto 1fr; }
    .kid-hero-actions .new-chat-btn { width: 100%; }
    .chat-list-card { margin-top: 10px; padding: 12px 13px 4px; }
    .chat-list-card .section-heading { align-items: center; }
    .chat-list-card .section-heading .eyebrow { display: none; }
    .chat-list-card .section-heading h2 { margin: 0; font-size: 1.12rem; }
    .chat-list { margin-top: 8px; }
    .chat-row { grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; padding: 12px 1px; }
    .chat-avatar { width: 46px; height: 46px; border-radius: 16px; }
    .chat-title-line strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .chat-preview { font-size: .84rem; }
    .unread-badge { min-width: 22px; height: 22px; padding: 0 6px; font-size: .72rem; }
    .invite-card { padding: 14px; }
    .invite-row { padding: 12px 0; }

    .parent-session .header-inner { align-items: stretch; flex-direction: column; gap: 8px; }
    .parent-session .header-nav { width: 100%; max-width: none; justify-content: flex-start; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
    .parent-session .header-nav::-webkit-scrollbar { display: none; }
    .parent-session .header-nav a { flex: 0 0 auto; padding: 7px 8px; border-radius: 10px; background: rgba(255,255,255,.68); }
}

@media (max-width: 700px) {
    body.kid-chat-screen { height: 100dvh; padding-bottom: 0; overflow: hidden; display: flex; flex-direction: column; }
    .kid-chat-screen .app-header { flex: 0 0 auto; }
    .kid-chat-screen .page-shell { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; width: 100%; margin: 0; padding: 0 7px; overflow: hidden; }
    .kid-chat-screen .child-bottom-nav { position: relative; flex: 0 0 auto; inset: auto; }
    .kid-chat-screen .chat-page-head { flex: 0 0 auto; margin: 5px 0 4px; padding: 2px 2px; }
    .kid-chat-screen .chat-page-head .eyebrow { display: none; }
    .kid-chat-screen .chat-page-head h1 { margin: 0; font-size: 1.08rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .kid-chat-screen .chat-page-head .small-text { font-size: .7rem; }
    .kid-chat-screen .round-back { width: 38px; height: 38px; font-size: 1.7rem; }
    .kid-chat-screen .chat-page-head .btn { min-height: 38px; padding: 7px 10px; font-size: .78rem; }
    .kid-chat-screen .notice, .kid-chat-screen .success-notice { flex: 0 0 auto; margin: 3px 0; padding: 7px 9px; font-size: .78rem; }
    .kid-chat-screen .safety-strip { flex: 0 0 auto; margin: 2px 0 5px; padding: 5px 8px; font-size: .67rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .kid-chat-screen .message-thread { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; margin: 0; padding: 8px 6px 12px; border-radius: 17px; scroll-behavior: smooth; }
    .kid-chat-screen .message-wrap { margin: 8px 0; }
    .kid-chat-screen .message-sender { margin-bottom: 2px; font-size: .69rem; }
    .kid-chat-screen .message-bubble { max-width: 86%; padding: 9px 12px; border-radius: 17px 17px 17px 5px; font-size: .94rem; line-height: 1.35; }
    .kid-chat-screen .message-wrap.mine .message-bubble { border-radius: 17px 17px 5px 17px; }
    .kid-chat-screen .style-big { font-size: 1.3rem; }
    .kid-chat-screen .message-time { margin-top: 2px; font-size: .62rem; }
    .kid-chat-screen .message-report-actions { margin-top: 1px; font-size: .63rem; }
    .kid-chat-screen .message-photo-block { width: min(78vw, 360px); border-radius: 17px; }
    .kid-chat-screen .new-message-jump { bottom: calc(142px + env(safe-area-inset-bottom)); }
    .kid-chat-screen .chat-photo { max-height: 42vh; }
    .kid-chat-screen .chat-date-separator { margin: 12px 0 6px; }
    .kid-chat-screen .composer-card { position: relative; flex: 0 0 auto; bottom: auto; z-index: 6; margin: 5px 0 4px; padding: 7px; border-radius: 17px; box-shadow: 0 5px 16px rgba(55,35,25,.1); }
    .kid-chat-screen .composer-tools { grid-template-columns: 1fr 1fr; gap: 6px; }
    .kid-chat-screen .composer-tools select { min-height: 40px; padding: 7px 8px; font-size: .85rem; }
    .kid-chat-screen .composer-tools label > span { font-size: .68rem; }
    .kid-chat-screen .emoji-btn { width: 36px; height: 36px; }
    .kid-chat-screen .message-preview-row { display: flex; }
}
