/* ==== Chat (trainer environment and member app) ==== */

:root {
    --tbm-chat-system-bg: rgba(34, 211, 255, 0.1);
    --tbm-chat-system: #5CE1FF;
    --tbm-chat-partner: #0A8FB8;
    --tbm-chat-pinned-bg: rgba(252, 211, 77, 0.12);
    --tbm-chat-pinned: #FCD34D;
    --tbm-chat-mention: #5CE1FF;
}

/* ---- Avatars ----------------------------------------------------------- */

.tbm-chat-avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--tbm-radius-pill);
    background: var(--tbm-input-raised);
    color: var(--tbm-text);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.tbm-chat-avatar--small {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

.tbm-chat-avatar--pink { background: var(--tbm-pink); color: #FFFFFF; }
.tbm-chat-avatar--blue { background: var(--tbm-carbs); color: var(--tbm-on-accent); }
.tbm-chat-avatar--rose { background: #F38BB0; color: var(--tbm-on-accent); }
.tbm-chat-avatar--yellow { background: var(--tbm-fat); color: var(--tbm-on-accent); }
.tbm-chat-avatar--purple { background: #8B5CF6; color: #FFFFFF; }
.tbm-chat-avatar--green { background: #1E7A4A; color: #FFFFFF; }
.tbm-chat-avatar--teal { background: #0A8FB8; color: #FFFFFF; }
.tbm-chat-avatar--gray { background: #2A2A36; color: #FFFFFF; }
.tbm-chat-avatar--channel { background: var(--tbm-input-raised); color: var(--tbm-text-secondary); }

/* ---- Trainer page: three columns --------------------------------------- */

.tbm-chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 48px);
    min-height: 560px;
}

.tbm-chat-page .tbm-page-header {
    margin-bottom: 18px;
}

.tbm-chat-kicker--member {
    color: var(--tbm-warning);
}

.tbm-chat-columns {
    display: grid;
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(240px, 300px);
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.tbm-chat-columns--no-side {
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
}

.tbm-chat-column {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--tbm-card);
    border: 1px solid var(--tbm-border);
    border-radius: 10px;
}

/* ---- Conversation list ------------------------------------------------- */

.tbm-chat-list {
    padding: 14px 0 0;
}

.tbm-chat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0 14px 12px;
    padding: 3px;
    border-radius: var(--tbm-radius);
    background: var(--tbm-bg);
}

.tbm-chat-tab {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 34px;
    padding: 0 7px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--tbm-text-secondary);
    font-family: var(--tbm-font);
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.tbm-chat-tab--active {
    background: var(--tbm-input-raised);
    color: var(--tbm-text);
}

.tbm-chat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--tbm-radius-pill);
    background: var(--tbm-pink);
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
}

.tbm-chat-search {
    position: relative;
    margin: 0 14px 10px;
}

.tbm-chat-search .mud-icon-root {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--tbm-text-secondary);
    transform: translateY(-50%);
}

.tbm-chat-search input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px 0 38px;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius);
    background: var(--tbm-bg);
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    font-size: 1.1rem;
}

.tbm-chat-search input::placeholder {
    color: var(--tbm-text-secondary);
}

.tbm-chat-rows {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0 10px 10px;
    overflow-y: auto;
    list-style: none;
}

.tbm-chat-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    margin-bottom: 4px;
    padding: 12px 10px 12px 12px;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--tbm-text);
    text-align: left;
    font-family: var(--tbm-font);
    cursor: pointer;
}

.tbm-chat-row:hover {
    background: rgba(var(--tbm-overlay), 0.03);
}

.tbm-chat-row--active {
    border-left-color: var(--tbm-pink);
    background: rgba(231, 50, 114, 0.16);
}

.tbm-chat-row--active:hover {
    background: rgba(231, 50, 114, 0.2);
}

.tbm-chat-row__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tbm-chat-row__top {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.tbm-chat-row__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 1.15rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tbm-chat-row__time {
    flex: none;
    color: var(--tbm-text-secondary);
    font-size: 0.95rem;
}

.tbm-chat-row__preview,
.tbm-chat-row__people {
    overflow: hidden;
    color: var(--tbm-text-secondary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tbm-chat-row__preview {
    font-size: 1.05rem;
}

.tbm-chat-row--unread .tbm-chat-row__preview {
    color: var(--tbm-text);
}

.tbm-chat-row__people {
    font-size: 0.95rem;
}

.tbm-chat-row__waiting {
    align-self: flex-start;
    margin-top: 4px;
    padding: 1px 8px;
    border-radius: var(--tbm-radius-pill);
    background: var(--tbm-warning-bg);
    color: var(--tbm-warning);
    font-size: 0.9rem;
    font-weight: 600;
}

.tbm-chat-row__waiting--late {
    background: var(--tbm-error-bg);
    color: var(--tbm-error);
}

.tbm-chat-empty {
    padding: 24px 16px;
    color: var(--tbm-text-secondary);
    text-align: center;
}

/* ---- Conversation ------------------------------------------------------ */

.tbm-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--tbm-border);
}

.tbm-chat-head__titles {
    flex: 1;
    min-width: 0;
}

.tbm-chat-head__title {
    margin: 0;
    overflow: hidden;
    font-size: 1.4rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tbm-chat-head__sub {
    margin: 2px 0 0;
    color: var(--tbm-text-secondary);
    font-size: 1.05rem;
}

.tbm-chat-head__people {
    display: flex;
    align-items: center;
}

.tbm-chat-head__people .tbm-chat-avatar {
    width: 34px;
    height: 34px;
    margin-left: -8px;
    border: 2px solid var(--tbm-card);
    font-size: 0.9rem;
}

.tbm-chat-head__people .tbm-chat-avatar:first-child {
    margin-left: 0;
}

.tbm-chat-round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px dashed var(--tbm-border-strong);
    border-radius: var(--tbm-radius-pill);
    background: transparent;
    color: var(--tbm-text);
    cursor: pointer;
}

.tbm-chat-round--solid {
    border-style: solid;
}

.tbm-chat-round .mud-icon-root {
    width: 18px;
    height: 18px;
}

.tbm-chat-thread {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.tbm-chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    padding: 18px 22px 12px;
    overflow-y: auto;
}

.tbm-chat-more {
    align-self: center;
    margin-bottom: 8px;
    color: var(--tbm-text-secondary);
    font-size: 0.95rem;
}

.tbm-chat-day {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 6px;
    color: var(--tbm-text-secondary);
    font-size: 0.95rem;
}

.tbm-chat-day::before,
.tbm-chat-day::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--tbm-border);
}

.tbm-chat-new {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    color: var(--tbm-pink-accent);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tbm-chat-new::after {
    content: "";
    flex: 1;
    border-top: 1px solid rgba(231, 50, 114, 0.5);
}

/* A message */

.tbm-chat-msg {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 10px;
}

.tbm-chat-msg--grouped {
    margin-top: 2px;
}

.tbm-chat-msg--own {
    align-items: flex-end;
}

.tbm-chat-msg__meta {
    margin: 0 0 4px;
    color: var(--tbm-text-secondary);
    font-size: 0.95rem;
}

.tbm-chat-msg__row {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: min(78%, 560px);
}

.tbm-chat-msg--own .tbm-chat-msg__row {
    flex-direction: row-reverse;
}

.tbm-chat-bubble {
    min-width: 0;
    padding: 11px 18px;
    border: 1px solid var(--tbm-border-strong);
    border-radius: 10px;
    background: var(--tbm-bg);
    color: var(--tbm-text);
    font-size: 1.15rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.tbm-chat-msg--own .tbm-chat-bubble {
    border-color: var(--tbm-pink);
    background: var(--tbm-pink);
    color: var(--tbm-on-pink);
}

.tbm-chat-msg--partner .tbm-chat-bubble {
    border-color: var(--tbm-chat-partner);
    background: rgba(10, 143, 184, 0.22);
}

.tbm-chat-msg--deleted .tbm-chat-bubble {
    border-style: dashed;
    background: transparent;
    color: var(--tbm-text-secondary);
    font-style: italic;
}

.tbm-chat-msg--own.tbm-chat-msg--deleted .tbm-chat-bubble {
    border-color: var(--tbm-border-strong);
}

.tbm-chat-bubble p {
    margin: 0;
}

.tbm-chat-bubble p + p,
.tbm-chat-bubble ul,
.tbm-chat-bubble ol {
    margin-top: 6px;
}

.tbm-chat-bubble ul,
.tbm-chat-bubble ol {
    margin-bottom: 0;
    padding-left: 20px;
}

.tbm-chat-bubble a {
    color: inherit;
    text-decoration: underline;
}

.tbm-chat-bubble .chat-mention {
    color: var(--tbm-chat-mention);
    font-weight: 700;
}

.tbm-chat-msg--own .tbm-chat-bubble .chat-mention {
    color: #0B3A75;
}

.tbm-chat-quote {
    display: block;
    margin-bottom: 6px;
    padding: 4px 10px;
    border-left: 3px solid currentColor;
    opacity: 0.8;
    font-size: 1rem;
}

.tbm-chat-edited {
    margin-left: 6px;
    opacity: 0.7;
    font-size: 0.9rem;
}

.tbm-chat-msg__status {
    margin-top: 3px;
    color: var(--tbm-text-secondary);
    font-size: 0.9rem;
}

.tbm-chat-msg__status--failed {
    color: var(--tbm-error);
}

.tbm-chat-msg__status button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.tbm-chat-msg--pending .tbm-chat-bubble {
    opacity: 0.7;
}

.tbm-chat-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.tbm-chat-reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 26px;
    padding: 0 8px;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius-pill);
    background: var(--tbm-card);
    color: var(--tbm-text);
    font-size: 0.95rem;
    cursor: pointer;
}

.tbm-chat-reaction--mine {
    border-color: var(--tbm-pink);
    background: rgba(231, 50, 114, 0.16);
}

.tbm-chat-read {
    align-self: flex-end;
    margin-top: 3px;
    color: var(--tbm-text-secondary);
    font-size: 0.9rem;
}

/* The actions on hover */

.tbm-chat-actions {
    position: absolute;
    top: -16px;
    left: 0;
    z-index: 2;
    display: none;
    align-items: center;
    gap: 1px;
    padding: 2px;
    border: 1px solid var(--tbm-border-strong);
    border-radius: 8px;
    background: var(--tbm-input-raised);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.tbm-chat-msg--own .tbm-chat-actions {
    right: 0;
    left: auto;
}

.tbm-chat-msg__row:hover .tbm-chat-actions,
.tbm-chat-msg__row:focus-within .tbm-chat-actions,
.tbm-chat-actions--open {
    display: flex;
}

.tbm-chat-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 4px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tbm-text);
    font-size: 1.05rem;
    cursor: pointer;
}

.tbm-chat-action:hover {
    background: rgba(var(--tbm-overlay), 0.08);
}

.tbm-chat-action .mud-icon-root {
    width: 17px;
    height: 17px;
}

.tbm-chat-action--text {
    padding: 0 8px;
    font-family: var(--tbm-font);
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
}

/* System message: a blue pill with a star */

.tbm-chat-system {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 12px 0 4px;
    padding: 12px 22px;
    border-radius: 28px;
    background: var(--tbm-chat-system-bg);
    color: var(--tbm-chat-system);
    font-size: 1.1rem;
    line-height: 1.35;
}

.tbm-chat-system .mud-icon-root {
    flex: none;
    width: 18px;
    height: 18px;
}

.tbm-chat-system p {
    margin: 0;
}

.tbm-chat-typing {
    min-height: 20px;
    padding: 0 22px 4px;
    color: var(--tbm-text-secondary);
    font-size: 0.95rem;
    font-style: italic;
}

/* ---- Composer ---------------------------------------------------------- */

.tbm-chat-composer {
    position: relative;
    padding: 14px 22px 16px;
    border-top: 1px solid var(--tbm-border);
}

.tbm-chat-composer__label {
    display: block;
    margin-bottom: 8px;
    font-size: 1.15rem;
    font-weight: 700;
}

.tbm-chat-composer__row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
}

.tbm-chat-composer__field {
    position: relative;
    display: flex;
    flex: 1;
    align-items: flex-end;
    min-width: 0;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius);
    background: var(--tbm-bg);
}

.tbm-chat-composer__field:focus-within {
    border-color: rgba(231, 50, 114, 0.7);
}

.tbm-chat-composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 80px;
    max-height: 160px;
    padding: 12px 6px 12px 14px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    font-size: 1.15rem;
    line-height: 1.4;
    resize: none;
}

.tbm-chat-composer textarea::placeholder {
    color: var(--tbm-text-secondary);
}

.tbm-chat-composer__emoji {
    align-self: flex-end;
    padding: 0 6px 8px 0;
}

.tbm-chat-composer__emoji .tbm-popover__panel {
    top: auto;
    bottom: calc(100% + 8px);
}

.tbm-chat-composer__emoji .tbm-popover__panel:not(.tbm-popover__panel--left) {
    right: 0;
}

.tbm-chat-send {
    flex: none;
    width: auto;
    min-width: 150px;
    min-height: 58px;
    margin-bottom: 4px;
}

.tbm-chat-composer__hint {
    margin: 10px 0 0;
    color: var(--tbm-text-secondary);
    font-size: 0.98rem;
}

.tbm-chat-composer__hint--member {
    color: var(--tbm-warning);
    font-weight: 700;
}

.tbm-chat-reply {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-left: 3px solid var(--tbm-pink);
    background: var(--tbm-bg);
    color: var(--tbm-text-secondary);
    font-size: 1rem;
}

.tbm-chat-reply span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tbm-chat-mentions {
    position: absolute;
    right: 0;
    bottom: calc(100% + 6px);
    left: 0;
    z-index: 5;
    max-height: 220px;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    border: 1px solid var(--tbm-border-strong);
    border-radius: 8px;
    background: var(--tbm-input-raised);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    list-style: none;
}

.tbm-chat-mention-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    font-size: 1.05rem;
    text-align: left;
    cursor: pointer;
}

.tbm-chat-mention-option--active,
.tbm-chat-mention-option:hover {
    background: rgba(231, 50, 114, 0.18);
}

.tbm-chat-readonly {
    padding: 14px 22px;
    border-top: 1px solid var(--tbm-border);
    color: var(--tbm-text-secondary);
}

/* ---- Side panel -------------------------------------------------------- */

.tbm-chat-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    overflow-y: auto;
}

.tbm-chat-side .tbm-chat-column {
    flex: none;
    padding: 20px 22px;
}

.tbm-chat-side__title {
    margin: 0 0 14px;
    font-size: 1.45rem;
}

.tbm-chat-facts {
    margin: 0;
}

.tbm-chat-fact {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--tbm-border);
}

.tbm-chat-fact dt {
    color: var(--tbm-text-secondary);
    font-size: 1.08rem;
}

.tbm-chat-fact dd {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 700;
    text-align: right;
}

.tbm-chat-side__buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.tbm-chat-side__buttons .tbm-outline-button {
    justify-content: center;
}

.tbm-chat-side__link {
    display: inline-block;
    margin-top: 14px;
    color: var(--tbm-pink-accent);
    font-weight: 600;
}

.tbm-chat-pinned {
    margin: 0 0 8px;
    padding: 12px 16px;
    border-radius: 6px;
    background: var(--tbm-chat-pinned-bg);
    color: var(--tbm-chat-pinned);
    font-size: 1.08rem;
    line-height: 1.45;
}

.tbm-chat-pinned p {
    margin: 0;
}

.tbm-chat-pinned__by {
    display: block;
    margin-top: 4px;
    opacity: 0.75;
    font-size: 0.9rem;
}

/* ---- Pickers (new conversation) --------------------------------------- */

.tbm-chat-picker {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(440px, 86vw);
}

.tbm-chat-picker__list {
    max-height: 340px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.tbm-chat-picker__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
}

.tbm-chat-picker__item:hover {
    background: rgba(var(--tbm-overlay), 0.05);
}

/* ---- Trainer: narrow screens ------------------------------------------ */

.tbm-chat-back {
    display: none;
}

@media (max-width: 1279px) {
    .tbm-chat-columns,
    .tbm-chat-columns--no-side {
        grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    }

    .tbm-chat-side {
        display: none;
    }
}

@media (max-width: 860px) {
    .tbm-chat-page {
        height: auto;
    }

    .tbm-chat-columns,
    .tbm-chat-columns--no-side {
        grid-template-columns: minmax(0, 1fr);
    }

    .tbm-chat-columns--open .tbm-chat-list {
        display: none;
    }

    .tbm-chat-back {
        display: inline-flex;
    }

    .tbm-chat-columns:not(.tbm-chat-columns--open) .tbm-chat-main {
        display: none;
    }

    .tbm-chat-main {
        height: calc(100dvh - 140px);
    }

    .tbm-chat-send {
        min-width: 0;
    }
}

/* ---- Member app -------------------------------------------------------- */

.tbm-member-chat {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding: 0 var(--tbm-gutter, 16px);
}

.tbm-member-chat__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: calc(env(safe-area-inset-top) + 16px) 0 12px;
}

.tbm-member-chat__titles {
    flex: 1;
    min-width: 0;
}

.tbm-member-chat__title {
    margin: 0;
    font-size: 2.1rem;
    line-height: 1.05;
}

.tbm-member-chat__sub {
    margin: 4px 0 0;
    color: var(--tbm-text-secondary);
    font-size: 1.05rem;
}

.tbm-member-chat .tbm-chat-thread {
    flex: 1;
}

.tbm-member-chat .tbm-chat-messages {
    flex: 1;
    padding: 6px 0 12px;
    overflow: visible;
}

.tbm-member-chat .tbm-chat-msg__row {
    max-width: 86%;
}

.tbm-member-chat .tbm-chat-msg__meta {
    margin-left: 40px;
}

.tbm-member-chat .tbm-chat-msg--own .tbm-chat-msg__meta {
    margin-left: 0;
}

.tbm-member-chat .tbm-chat-bubble {
    font-size: 1.12rem;
}

.tbm-member-chat .tbm-chat-composer {
    position: sticky;
    bottom: var(--tbm-keyboard, 0px);
    z-index: 3;
    margin: 0 calc(-1 * var(--tbm-gutter, 16px));
    padding: 10px var(--tbm-gutter, 16px) calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--tbm-border);
    background: var(--tbm-bg);
}

.tbm-member-chat .tbm-chat-composer textarea {
    min-height: 46px;
}

.tbm-member-chat .tbm-chat-send {
    min-width: 0;
    width: 52px;
    min-height: 48px;
    padding: 0;
}

.tbm-member-chat .tbm-chat-send .mud-icon-root {
    width: 22px;
    height: 22px;
}

.tbm-member-chat .tbm-chat-typing {
    padding: 0 0 4px;
}

.tbm-member-chat__empty {
    margin: auto 0;
    padding: 32px 12px;
    color: var(--tbm-text-secondary);
    font-size: 1.15rem;
    text-align: center;
}

.tbm-member-chat__archived {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 12px 0;
    color: var(--tbm-text-secondary);
}

.tbm-member-chat__archived a {
    color: var(--tbm-pink-accent);
}

/* The chat icon next to the bell */

.tbm-chat-icon {
    position: relative;
}

.tbm-chat-icon__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--tbm-radius-pill);
    background: var(--tbm-pink);
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 700;
}

/* Trainer Vandaag: "Vragen van leden" as a fifth tile */

@media (min-width: 1100px) {
    .tbm-kpis:has(> :nth-child(5)) {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.tbm-kpi__value--pink {
    color: var(--tbm-pink-accent);
}

.tbm-chat-questions {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}

.tbm-chat-questions__count {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
}

.tbm-chat-questions__text {
    flex: 1;
}

.tbm-chat-questions__text strong {
    display: block;
    font-size: 1.15rem;
}

.tbm-chat-questions__text span {
    color: var(--tbm-text-secondary);
}

/* Vandaag: the chat icon makes the header wider; on a narrow phone the buttons move to their own line. */
.tbm-today__header {
    flex-wrap: wrap;
    row-gap: 8px;
}

.tbm-today__actions {
    margin-left: auto;
}
