.page-actions { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
@media (max-width: 480px) { .pagehead { flex-wrap: wrap; } }
.messages-open { display: inline-flex; align-items: center; gap: 6px; }
.messages-open[hidden] { display: none; }
.chat-badge { display: inline-block; border-radius: 999px; padding: 1px 8px; background: #f3e9c6; color: #58471e; font-size: .85rem; font-weight: 700; }
.child-chat-body { display: grid; gap: 14px; min-width: 0; }
.child-chat-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.my-day .child-chat-tile { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 104px; text-align: left; background: #fff; border-color: #cad5ca; color: #18312b; }
.child-chat-tile .letter { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 14px; background: #e2eee5; font-size: 2rem; }
.child-chat-tile strong { font-size: 1.4rem; overflow-wrap: anywhere; }
.child-chat-back { justify-self: start; }
.child-chat-conv, .chat-conv { display: grid; gap: 10px; min-width: 0; }
.chat-head { display: grid; gap: 4px; }
.chat-title { margin: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.chat-hint { margin: 0; color: #4c5f55; }
.chat-hint[hidden], .chat-note[hidden], .chat-older[hidden], .chat-compose[hidden] { display: none; }
.chat-note { margin: 0; font-weight: 700; }
.chat-note[data-error="true"] { color: #8a2420; }
.chat-list { list-style: none; margin: 0; padding: 4px; display: grid; gap: 10px; max-height: min(60vh, 560px); overflow-y: auto; overflow-x: hidden; border: 1px solid #cad5ca; border-radius: 14px; background: #fbfaf5; }
.chat-msg { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid #dbe3da; min-width: 0; overflow-wrap: anywhere; }
.chat-msg.own { background: #e2eee5; border-color: #b8cfbf; }
.chat-msg.hidden { background: #f4f1e8; }
.chat-meta { margin: 0; font-size: .95rem; color: #4c5f55; }
.chat-meta strong { color: #18312b; }
.chat-text { margin: 0; white-space: pre-line; font-size: 1.05rem; }
.chat-text.muted { color: #5d6b62; font-style: italic; }
.chat-list.big .chat-text { font-size: 1.35rem; }
.chat-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-card { display: grid; justify-items: center; gap: 2px; min-width: 64px; max-width: 100%; padding: 4px; border-radius: 10px; background: #fff; border: 1px solid #e4e9e3; font-weight: 700; font-size: .95rem; text-align: center; }
.chat-card img { width: 56px; height: 56px; object-fit: contain; }
.chat-list.big .chat-card img { width: 72px; height: 72px; }
.chat-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-actions button, .chat-reasons button, .chat-older, .chat-compose button, .send-bar button, .chat-pick button, .chat-mode button { min-height: 44px; padding: 6px 14px; font: inherit; font-weight: 700; }
.chat-reasons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chat-reasons p { margin: 0; flex-basis: 100%; font-weight: 700; }
.chat-flag { color: #7a4f12; font-weight: 700; margin: 0; }
.chat-empty { color: #5d6b62; padding: 8px; }
.chat-compose { display: grid; gap: 6px; }
.chat-compose textarea { width: 100%; max-width: none; box-sizing: border-box; min-height: 5rem; padding: 10px 12px; border: 2px solid #788a79; border-radius: 10px; font: inherit; resize: vertical; }
.chat-compose button { justify-self: start; }
.chat-extra { display: grid; gap: 10px; }
.chat-extra:empty { display: none; }
.send-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.send-bar[hidden] { display: none; }
.send-sentence { flex: 1 1 12rem; min-height: 52px !important; border-radius: 12px; border: 2px solid #185b46; background: #185b46; color: #fff; font-size: 1.1rem !important; cursor: pointer; }
.send-sentence:disabled { opacity: .55; cursor: default; }
.send-cancel { width: 48px; min-height: 48px; border-radius: 12px; border: 2px solid #185b46; background: #fff; color: #185b46; font-size: 1.4rem; cursor: pointer; }
.send-note { flex-basis: 100%; margin: 0; font-weight: 700; }
.send-note:empty { display: none; }
.send-note[data-error="true"] { color: #8a2420; }
.child-chat-write { display: grid; gap: 10px; }
.child-key-text { margin: 0; min-height: 3rem; padding: 10px 12px; border: 2px solid #788a79; border-radius: 12px; background: #fff; font-size: 1.4rem; overflow-wrap: anywhere; }
.child-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.my-day .child-keys .key { min-height: 52px; padding: 4px; font-size: 1.3rem; }
.my-day .child-keys .key.wide { grid-column: span 3; font-size: 1.05rem; }
.my-day button.primary { background: #185b46; color: #fff; }
.chat-overview { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.chat-pick { display: grid; gap: 8px; }
.chat-pick button { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; width: 100%; text-align: left; overflow-wrap: anywhere; }
.chat-pick button[aria-current="true"] { outline: 3px solid #185b46; outline-offset: 2px; }
.chat-mode { display: grid; gap: 6px; }
.chat-members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.chat-members li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; overflow-wrap: anywhere; }
.chat-report { border-top: 1px solid #dbe3da; padding-top: 10px; display: grid; gap: 6px; overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .my-day .child-chat-tile { grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; min-height: 88px; }
  .child-chat-tile .letter { width: 56px; height: 56px; }
}
.speech-note { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: .95rem; color: #4c5f55; }
.speech-note.muted { font-style: italic; }
.speech-toggle, .speech-input button { min-height: 44px; padding: 6px 14px; font: inherit; font-weight: 700; }
.chat-original, .info-original { margin: 0; border-radius: 8px; padding: 6px 10px; background: #f4f1e8; color: #33463d; }
.chat-original[hidden], .info-original[hidden] { display: none; }
.speech-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.speech-counter { font-weight: 700; font-variant-numeric: tabular-nums; }
.speech-status { flex-basis: 100%; margin: 0; font-weight: 700; }
.speech-status:empty { display: none; }
.speech-status[data-error="true"] { color: #8a2420; }

.child-chat-conv .chat-title { display: none; }

body[data-view] .chat-actions button:not(.danger):not(.primary), body[data-view] .chat-older,
body[data-view] .speech-toggle, body[data-view] .speech-input button, body[data-view] .chat-reasons button:not(.danger) {
  background: #fff; color: #185b46; border: 2px solid #185b46; border-radius: 12px; }
body[data-view] .chat-actions button:not(.danger):not(.primary):hover:enabled, body[data-view] .chat-older:hover:enabled,
body[data-view] .speech-toggle:hover:enabled, body[data-view] .speech-input button:hover:enabled, body[data-view] .chat-reasons button:not(.danger):hover:enabled {
  background: #e2eee5; color: #103f32; }
.chat-compose { justify-items: start; }
.chat-compose label, .chat-compose textarea { justify-self: stretch; }
