/* The family hub is shared by the parent dashboard and the separate Kids home screen. */
.rh {
  --rh-tint: #ece9ff;
  --rh-accent: #5740cb;
  --rh-track: #e6e2fa;
  --rh-hero: linear-gradient(111deg, #1767eb 0%, #5046e4 52%, #8227d9 100%);
  min-width: 0;
}
.rh *, .kids-body * { box-sizing: border-box; }
.rh [hidden] { display: none !important; }
.rh .rh-area { display: grid; align-content: start; gap: 14px; min-width: 0; }
.rh .rh-section, .rh .rh-editor, .rh-pair, .kids-join {
  margin: 0; min-width: 0; padding: clamp(16px, 2.5vw, 25px); background: var(--surface); border: 1px solid var(--line); border-radius: 19px;
}
.rh .rh-heading { font-size: 1.2rem; line-height: 1.25; letter-spacing: -.025em; margin: 0 0 14px; color: var(--ink); }
.rh .rh-section > .rh-editor { padding: 0; border: 0; background: none; }
.rh .rh-section > .rh-editor[open] { padding-bottom: 18px; border-bottom: 1px solid var(--line); border-radius: 0; }
.rh .rh-section > .rh-editor > summary { color: var(--rh-accent); }
.rh .rh-editor { box-shadow: none; }
.rh summary { font-weight: 700; cursor: pointer; color: var(--ink); min-height: 44px; align-content: center; overflow-wrap: anywhere; }
.rh .rh-editor > :not(summary) { margin-block: 12px 0; }
.rh .rh-editor > .rh-editor { border-radius: 13px; padding: 6px 13px; }
.rh .rh-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rh .rh-field { min-width: 0; gap: 5px; color: var(--ink); font-size: .9rem; }
.rh .rh-field input, .rh .rh-field select, .rh .rh-field textarea { width: 100%; min-width: 0; }
.rh .rh-field textarea { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 11px; font: inherit; resize: vertical; }
.rh .rh-field :focus-visible, .rh .rh-toggle input:focus-visible, .rh summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.rh .rh-form { display: grid; gap: 12px; }
.rh .rh-form > button[type="submit"] { justify-self: start; }
.rh .rh-toggle { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 12px; font-size: 1rem; color: var(--ink); }
.rh .rh-toggle input { width: 2.65rem; height: 1.5rem; appearance: none; flex: none; border-radius: 30px; background: var(--line); border: 2px solid var(--muted); position: relative; cursor: pointer; }
.rh .rh-toggle input::after { content: ''; position: absolute; inset-inline-start: 3px; top: 2px; width: 16px; height: 16px; background: var(--surface); border-radius: 50%; }
.rh .rh-toggle input:checked { background: var(--rh-accent); border-color: var(--rh-accent); }
.rh .rh-toggle input:checked::after { inset-inline-start: auto; inset-inline-end: 3px; background: white; }
.rh .rh-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: clamp(19px, 3.1vw, 33px); border-radius: 22px; color: #fff; background: var(--rh-hero); }
.rh .rh-score { display: grid; gap: 5px; }
.rh .rh-hero strong { color: #fff; display: block; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.07; letter-spacing: -.045em; overflow-wrap: anywhere; }
.rh .rh-hero small, .rh .rh-hero label { color: #fff; }
.rh .rh-profile-switch { min-width: min(185px, 100%); }
.rh .rh-profile-switch select { color: #211c3b; background-color: #fff; }
.rh .rh-pair { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.rh .rh-pair p { flex: 1 1 240px; }
.rh .rh-tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: stretch; width: fit-content; max-width: 100%; background: var(--rh-tint); border-radius: 14px; padding: 4px; }
.rh .rh-tabs button { min-height: 42px; background: transparent; border: 1px solid transparent; color: var(--rh-accent); border-radius: 10px; padding: 7px 14px; }
.rh .rh-tabs button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 5px #20154420; font-weight: 700; }
.rh .rh-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.rh .rh-line { padding: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.rh .rh-row-head, .rh .rh-meta, .rh .rh-row-actions, .rh .rh-channel { display: flex; align-items: center; gap: 8px; }
.rh .rh-row-head { gap: 11px; align-items: flex-start; }
.rh .rh-row-text { flex: 1; min-width: 0; }
.rh .rh-row-text h3 { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-line; }
.rh .rh-meta { margin-top: 4px; flex-wrap: wrap; gap: 5px 9px; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.rh .rh-meta small { font-size: inherit; }
.rh .rh-icon { flex: none; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; background: var(--rh-tint); color: var(--rh-accent); }
.rh svg { height: 20px; width: 20px; }
.rh .rh-badge { color: var(--muted); }
.rh .rh-badge[data-status="submitted"], .rh .rh-badge[data-status="pending"], .rh .rh-badge[data-status="scheduled"] { color: #805018; }
.rh .rh-badge[data-status="approved"], .rh .rh-badge[data-status="read"] { color: #1f6957; }
.rh .rh-row-actions { flex-wrap: wrap; margin-top: 8px; }
.rh .rh-line .rh-row-actions button { padding: 7px 13px; min-height: 42px; }
.rh .rh-receipts { margin-top: 8px; padding-inline-start: 46px; display: grid; gap: 3px; }
.rh .rh-channel { justify-content: space-between; color: var(--muted); font-size: .875rem; flex-wrap: wrap; }
.rh .rh-time { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 12px; margin-block: 9px; }
.rh .rh-time strong { overflow-wrap: anywhere; }
.rh .rh-time progress, .rh .rh-time small { grid-column: 1 / -1; }
.rh .rh-progress { display: block; width: 100%; height: 6px; padding: 0; border: 0; border-radius: 5px; color: var(--rh-accent); background: var(--rh-track); accent-color: var(--rh-accent); appearance: none; overflow: hidden; }
.rh .rh-progress::-webkit-progress-bar { background: var(--rh-track); border-radius: 5px; }
.rh .rh-progress::-webkit-progress-value { background: var(--rh-accent); border-radius: 5px; }
.rh .rh-progress::-moz-progress-bar { background: var(--rh-accent); border-radius: 5px; }
.rh .rh-hero .rh-progress { --rh-track: #ffffff57; --rh-accent: #fff; }
.rh .rh-line > progress { margin-top: 12px; }
.rh .rh-templates { display: flex; flex-wrap: wrap; gap: 6px; }
.rh .rh-templates > span { width:100%; color: var(--muted); font-size: .86rem; }
.rh .rh-templates button { min-height: 40px; font-size: .875rem; padding: 6px 9px; }
.rh .rh-help, .rh .rh-empty, .rh .rh-notice { color: var(--muted); font-size: .95rem; line-height: 1.5; }
.rh .rh-empty, .rh .rh-help { margin-block: 8px; }
.rh .rh-invite { display: grid; gap: 8px; padding: 13px; border-radius: 12px; background: var(--soft); }
.rh .rh-code { font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .04em; overflow-wrap: anywhere; }
.rh .rh-notice:not(:empty) { border-inline-start: 3px solid var(--rh-accent); background: var(--surface); padding: 8px 11px; margin-bottom: 12px; color: var(--ink); }
.rh .rh-notice.rh-error { border-color: var(--danger); }
.rh .rh-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.kids-body { --paper: #f7f7fc; background: var(--paper); }
.kids-frame { max-width: 650px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left)); }
.kids-frame > .kids-header { background: transparent; color: var(--ink); border: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 75px; padding: 13px 1px; }
.kids-brand { display: inline-flex; align-items: center; gap: 9px; font-size: clamp(1.22rem, 4vw, 1.7rem); font-weight: 700; letter-spacing: -.045em; white-space: nowrap; }
.kids-brand img { display: block; width: 36px; height: 36px; }
.kids-header select { min-height: 40px; font-size: .87rem; padding: 5px 10px; color: var(--ink); }
.kids-frame > main { padding: 0 0 98px; }
.kids-join { max-width: 480px; margin: clamp(24px, 9vh, 85px) auto 0; }
.kids-join h1 { margin: 0 0 12px; color: var(--ink); background: none; -webkit-text-fill-color: currentColor; font-size: clamp(1.8rem, 6vw, 2.4rem); }
.kids-join form, .kids-join > button { margin-top: 18px; }
.rh .kids-hero { display: grid; align-items: start; justify-content: stretch; gap: 7px; }
.rh .kids-hero strong { font-size: clamp(2rem, 8vw, 3.1rem); }
.rh .rh-hero-label { font-size: .95rem; }
.rh .kids-hero .rh-progress { margin-top: 8px; }
.rh .rh-hero-note { font-size: .9rem; }
.rh-kids .rh-section { background: transparent; border: 0; box-shadow: none; padding: 0; }
.rh-kids .rh-heading { font-size: 1.13rem; margin: 4px 0 9px; }
.rh-kids .rh-line { border-color: transparent; box-shadow: 0 1px 4px #2016440c; }
.rh-kids .rh-section > .rh-empty { padding: 15px; border-radius: 13px; background: var(--surface); }
.rh-kids .rh-line:has(.rh-row-actions) { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; }
.rh-kids .rh-row-actions { margin: 0; }
.rh-kids .rh-row-actions button { color: var(--rh-accent); font-size: .87rem; }
.rh-kids .rh-line > progress { grid-column: 1/-1; }
.rh .kids-tabs { width: min(650px, 100%); max-width: 100%; position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 3; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 0; border-radius: 16px 16px 0 0; border: 1px solid var(--line); border-bottom: 0; padding: 5px 3px max(7px, env(safe-area-inset-bottom)); background: var(--surface); }
.rh .kids-tabs button { position: relative; min-width: 0; min-height: 52px; display: flex; flex-direction: column; justify-content: flex-start; align-items:center; padding: 5px 1px; line-height: 1.2; gap: 3px; color: var(--muted); font-size: .76rem; font-weight: 400; border-radius: 9px; hyphens: auto; }
.rh .kids-tabs button[aria-pressed="true"] { color: var(--rh-accent); background: var(--rh-tint); box-shadow: none; }
.rh .kids-tabs button svg { height: 18px; width: 18px; flex-shrink:0; }
.kids-count { position: absolute; top: 0; inset-inline-start: 56%; display: grid; place-items: center; min-width: 15px; height: 15px; padding-inline: 2px; font-size: .67rem; border-radius: 20px; background: var(--rh-accent); color: #fff; }
@media (max-width: 500px) {
  .rh .rh-grid2 { grid-template-columns: 1fr; }
  .rh .rh-area { gap: 11px; }
  .rh-parent .rh-tabs { width: 100%; }
  .rh-parent .rh-tabs button { flex: 1 1 auto; padding-inline: 6px; }
  .rh .rh-profile-switch { min-width: 0; }
}
@media (max-width: 365px) {
  .rh-kids .rh-line:has(.rh-row-actions) { display: block; }
  .rh-kids .rh-row-actions { margin-top: 6px; padding-inline-start: 45px; }
  .kids-frame { padding-inline: 12px; }
}
@media (prefers-color-scheme: dark) {
  .rh { --rh-tint: #342e57; --rh-accent: #c0b2ff; --rh-track: #494363; }
  .kids-body { --paper: #101023; }
  .rh .rh-badge[data-status="submitted"], .rh .rh-badge[data-status="pending"], .rh .rh-badge[data-status="scheduled"] { color: #f7c58b; }
  .rh .rh-badge[data-status="approved"], .rh .rh-badge[data-status="read"] { color: #8fddc1; }
}
@media (forced-colors: active) {
  .rh .rh-hero, .rh .rh-hero small, .rh .rh-hero label, .rh .rh-hero strong { color: CanvasText; }
  .rh .rh-toggle input { appearance: auto; }
  .rh .rh-toggle input::after { display: none; }
  .rh .rh-tabs button[aria-pressed="true"] { outline: 2px solid Highlight; }
}

.rh .rh-qr { display:block; width: 160px; height: 160px; max-width: 100%; background: #fff; }
.kids-brand small { display: block; color: var(--muted); font-weight: 400; font-size: .76rem; letter-spacing: 0; line-height:1.3; }
.rh .kids-inbox { display:flex; gap:9px; align-items:center; justify-self:start; }
.rh .rh-family-grid { display:flex; flex-wrap:wrap; gap:12px; margin:10px 0 0; }
.rh .rh-family-stat { flex:1 1 85px; padding:12px; background:var(--surface); border:1px solid var(--line); border-radius:12px; display:grid; gap:4px; }
.rh .rh-family-stat span { font-size:.85rem; color:var(--muted); }
.rh .rh-family-stat b { font-size:1.4rem; color:var(--rh-accent); }

.kids-join .kids-exit { display:block; border:0; background:transparent; color:var(--muted); padding-inline:0; }

.rh .kids-hero .rh-field { color:#fff; }
.rh .kids-hero .rh-field select { color:#211c3b; background-color:#fff; }

@media (min-width: 370px) { .rh .kids-tabs button[data-hub-tab="community"]:lang(ru) { font-size: .72rem; white-space: nowrap; } }

.rh .rh-section > .rh-compose > summary {
  display:flex; align-items:center; justify-content:center; gap:9px;
  width:100%; min-height:50px; padding:10px 16px; box-sizing:border-box;
  background:var(--om-primary,var(--rh-hero)); color:#fff;
  border:1px solid transparent; border-radius:14px; list-style:none;
}
.rh .rh-compose > summary::-webkit-details-marker { display:none; }
.rh .rh-compose > summary svg { width:22px; height:22px; flex:none; }
.rh .rh-section > .rh-compose[open] > summary { background:var(--surface); color:var(--ink); border-color:var(--line); }
.rh .rh-compose[open] > summary svg { transform:rotate(45deg); }

.rh-mail .rh-icon {align-self:flex-start}
.rh-mail.outgoing .rh-icon {background:#e6f2ef;color:#176351}
.rh-direction {display:block;margin-bottom:.24rem;font-size:.76rem;font-weight:700;color:var(--muted,#565b73)}
.rh-mail .rh-meta {column-gap:.65rem;row-gap:.3rem}
.rh-clear,.rh-remove {font-size:.9em}
.rh-dialog {box-sizing:border-box;width:min(92vw,28rem);border:1px solid #d9dbea;border-radius:18px;padding:1.25rem;color:inherit;background:var(--card,Canvas)}
.rh-dialog::backdrop {background:rgb(18 18 40 / .48)}
.rh-dialog h2 {margin:0 0 .6rem;font-size:1.25rem}
.rh-dialog p {margin:0 0 1rem}
