/* =============================================================================
   Staff Hub in AM Navy, presence status (18 Oct 2026)

   Loaded after hr.css, so these rules win over the Staff Hub's original look.
   Status colours come from DEX.Features.HR.Presence through --presence.
   ============================================================================= */

/* ---- The avatar dot ------------------------------------------------------ */
.header-user-avatar__status--presence { background: var(--presence, var(--status-success)); }
.header-user-avatar__status--out { background: var(--status-neutral); }

/* ---- The status picker in the Staff Hub header (on the navy header) ------- */
.presence-picker { position: relative; }
.presence-picker__button {
    display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 12px;
    border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--am-radius);
    background: rgba(255, 255, 255, .08); color: var(--text-on-dark); font: inherit; font-size: var(--font-size-base); font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.presence-picker__button:hover { background: rgba(255, 255, 255, .14); }
.presence-picker__button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.presence-picker__button .icon { opacity: .8; }
.presence-picker__dot {
    flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%;
    background: var(--presence, var(--status-success)); box-shadow: 0 0 0 2px rgba(255, 255, 255, .9);
}
.presence-picker__menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 220px; padding: 6px;
    border: 1px solid var(--am-blue-soft); border-radius: var(--am-radius);
    background: var(--surface-panel); box-shadow: var(--shadow-dropdown);
}
.presence-picker__menu[hidden] { display: none; }
.presence-picker__option {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px;
    border: 0; border-radius: var(--am-radius); background: none; cursor: pointer;
    font: inherit; font-size: var(--font-size-base); color: var(--am-blue); text-align: left;
}
.presence-picker__option:hover:not(:disabled) { background: var(--am-blue-tint); }
.presence-picker__option:focus-visible { outline: none; box-shadow: var(--am-focus); }
.presence-picker__option[aria-checked="true"] { font-weight: 700; }
.presence-picker__option:disabled { cursor: default; opacity: .55; }
.presence-picker__option .presence-picker__dot { box-shadow: none; }
.presence-picker__label { flex: 1 1 auto; display: flex; flex-direction: column; line-height: 1.25; }
.presence-picker__hint { font-size: var(--font-size-tiny); font-weight: 500; color: var(--text-muted); }
.presence-picker__tick { display: inline-flex; color: var(--am-blue); }

/* ---- Staff Hub body in AM Navy ------------------------------------------- */
.clock-panel { gap: 16px; }
.clock-record-tabs { margin: 0; }

.clock-panel__status {
    border: 0; border-radius: var(--am-radius); background: var(--am-blue-tint); padding: 22px 16px;
}
.clock-panel__time { color: var(--am-blue); }
.clock-panel__state { color: var(--text-secondary); }
.clock-panel__status--active { background: var(--status-success-tint); }
.clock-panel__status--active .clock-panel__time { color: var(--status-success); }
.clock-panel__status--active .clock-panel__state { color: var(--status-success); }
.clock-panel__status--break { background: var(--status-warning-tint); }
.clock-panel__status--break .clock-panel__time { color: var(--status-warning); }
.clock-panel__status--break .clock-panel__state { color: var(--status-warning); }

/* The secondary figure under the big timer: worked so far while on a break,
   breaks taken while working. A soft tag, so it reads as context, not a clock. */
.clock-panel__sub {
    margin-top: 4px; padding: 3px 9px; border-radius: 5px;
    background: var(--surface-panel); color: var(--text-secondary);
    font-size: var(--font-size-small); font-weight: 600; font-variant-numeric: tabular-nums;
}
.clock-panel__sub[hidden] { display: none; }

.clock-panel__actions { gap: 8px; }
.clock-panel__next-shift:empty { display: none; }
.clock-panel__action { justify-content: center; }

.clock-panel__section { border-top-color: var(--am-blue-soft); }
.clock-panel__section-glyph { color: var(--am-blue); }
.clock-panel__section-title { color: var(--am-blue); font-weight: 700; }
.clock-panel__next-shift, .clock-today, .clock-leave, .clock-shift, .clock-holiday {
    border-color: var(--am-blue-soft); border-radius: var(--am-radius);
}
.clock-today__label, .clock-leave__label, .clock-shift__date, .clock-holiday__name { color: var(--am-blue); }
.clock-today--empty, .clock-leave--empty, .clock-shift--empty, .clock-holiday--empty {
    border-color: var(--am-blue-soft); border-radius: var(--am-radius);
}
.clock-leave-form { border-radius: var(--am-radius); }
.clock-leave-form__field input, .clock-leave-form__field select { border-radius: var(--am-radius); }
.clock-leave-form__field input:focus, .clock-leave-form__field select:focus {
    outline: none; border-color: var(--am-blue); box-shadow: var(--am-focus);
}
.clock-shift__act { border-radius: var(--am-radius); }

/* ---- Settings > Users & Roles > Status ----------------------------------- */
.presence-card {
    /* The page header sits 24px in; the card lines up with it. */
    margin: var(--content-gap-top) 24px 32px;
    max-width: 860px; padding: 18px 20px; border: 1px solid var(--am-blue-soft);
    border-radius: var(--am-radius); background: var(--surface-panel);
    /* .page-surface is a fixed-height column that clips: a long list scrolls
       inside the card instead of running off the page. */
    flex: 0 1 auto; min-height: 0; overflow-y: auto;
}
@media (max-width: 900px) { .presence-card { overflow-y: visible; } }
.presence-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.presence-card__title { margin: 0; font-size: var(--font-size-base); font-weight: 700; color: var(--am-blue); }
.presence-list { margin: 0; padding: 0; list-style: none; }
.presence-row {
    display: flex; align-items: center; gap: 14px; padding: 14px 4px;
    border-bottom: 1px solid var(--am-blue-soft);
}
.presence-row:last-child { border-bottom: 0; }
.presence-row__dot {
    flex: 0 0 14px; width: 14px; height: 14px; border-radius: 50%; background: var(--presence);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--presence) 18%, transparent);
}
.presence-row__text { flex: 1 1 auto; min-width: 0; }
.presence-row__name { font-size: var(--font-size-base); font-weight: 700; color: var(--am-blue); }
.presence-row__desc { margin-top: 2px; font-size: var(--font-size-base); color: var(--text-secondary); }
.presence-row__facts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.presence-pill {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
    border-radius: var(--am-radius); font-size: var(--font-size-small); font-weight: 600; white-space: nowrap;
}
.presence-pill--ok { background: var(--status-success-tint); color: var(--status-success); }
.presence-pill--no { background: var(--am-red-soft); color: var(--am-red-ink); }
.presence-pill--muted { background: var(--am-blue-tint); color: var(--text-secondary); }
.presence-notes { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--am-blue-soft); }
.presence-note { display: flex; gap: 10px; align-items: flex-start; font-size: var(--font-size-base); color: var(--text-secondary); line-height: 1.5; }
.presence-note p { margin: 0; }
.presence-note__icon {
    flex: 0 0 28px; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
    border-radius: var(--am-radius); background: var(--am-blue-tint); color: var(--am-blue);
}

/* RM-173: the agency's own statuses, under the core ones. */
.presence-card__add { display: inline-flex; align-items: center; gap: 6px; }
.presence-card__subtitle {
    margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--am-blue-soft);
    font-size: var(--font-size-small); font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-secondary);
}
.presence-card__empty { margin: 8px 0 0; font-size: var(--font-size-base); color: var(--text-secondary); }
.presence-row__edit {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
    border: 1px solid var(--border-default); border-radius: var(--am-radius); background: var(--surface-panel);
    color: var(--text-secondary); cursor: pointer;
}
.presence-row__edit:hover, .presence-row__edit:focus-visible { color: var(--accent); border-color: var(--accent-border); background: var(--accent-tint); }
.presence-form { display: flex; flex-direction: column; gap: 16px; padding: 4px 0; }
.presence-form .form-field { margin: 0; }
.presence-form .crm-swatches { flex-wrap: wrap; }

@media (max-width: 640px) {
    .presence-card { margin: var(--content-gap-top) 16px 24px; padding: 14px 14px; }
    .presence-card__head { flex-wrap: wrap; }
    /* Dot beside the name, the pills underneath: a long description no longer
       drops the name below its dot. */
    .presence-row { display: grid; grid-template-columns: 14px minmax(0, 1fr); column-gap: 14px; row-gap: 8px; align-items: start; }
    .presence-row__dot { margin-top: 3px; }
    .presence-row__facts { grid-column: 2; justify-content: flex-start; }
    .presence-picker__current { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
}

/* ---- Staff Hub: Team and All Staff (19 Oct 2026) ------------------------ */
.clock-record-tabs { overflow-x: auto; scrollbar-width: none; }
.clock-record-tabs::-webkit-scrollbar { display: none; }
.clock-record-tabs .record-tab { white-space: nowrap; }

.staff-hub-list { display: flex; flex-direction: column; gap: 14px; }
.staff-hub-muted { margin: 0; font-size: var(--font-size-base); color: var(--text-muted); }
.staff-hub-count { font-size: var(--font-size-small); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.staff-hub-search {
    position: relative; display: flex; align-items: center; margin-bottom: 12px;
}
.staff-hub-search__icon { position: absolute; left: 11px; display: inline-flex; color: var(--text-muted); pointer-events: none; }
.staff-hub-search__input {
    width: 100%; height: 38px; padding: 0 12px 0 36px; font: inherit; font-size: var(--font-size-base); color: var(--am-blue);
    border: 1px solid var(--am-outline); border-radius: var(--am-radius); background: var(--surface-panel);
}
.staff-hub-search__input:focus { outline: none; border-color: var(--am-blue); box-shadow: var(--am-focus); }

.staff-team { display: flex; flex-direction: column; gap: 8px; }
.staff-team__head { display: flex; align-items: center; gap: 8px; }
.staff-team__icon {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
    border-radius: var(--am-radius); background: var(--am-blue); color: var(--text-on-dark);
}
.staff-team__name { margin: 0; flex: 1 1 auto; font-size: var(--font-size-base); font-weight: 700; color: var(--am-blue); }
.staff-team__count { font-size: var(--font-size-small); color: var(--text-muted); }

.staff-rows { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.staff-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border: 1px solid var(--am-blue-soft); border-radius: 5px; background: var(--surface-panel);
}
.staff-row__face { position: relative; flex: 0 0 38px; width: 38px; height: 38px; }
.staff-row__avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; overflow: hidden;
    border-radius: 50%; background: var(--am-blue-soft); color: var(--am-blue);
    font-size: var(--font-size-base); font-weight: 700;
}
.staff-row__avatar .avatar-photo { width: 100%; height: 100%; object-fit: cover; }
.staff-row__dot {
    position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--presence); box-shadow: 0 0 0 2px var(--surface-panel);
}
/* RM-115: an Agent Meeko agent wears a small sparkle where a person has a presence dot. */
.staff-row__agent-mark {
    position: absolute; right: -3px; bottom: -3px; display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%; color: var(--surface-panel);
    background: var(--brand-gradient); box-shadow: 0 0 0 2px var(--surface-panel);
}
.staff-chat__msg-face .staff-row__agent-mark { display: none; }
.staff-row__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.staff-row__name {
    font-size: var(--font-size-base); font-weight: 600; color: var(--am-blue);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.staff-row__you, .staff-row__lead {
    display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 4px; vertical-align: 1px;
    font-size: var(--font-size-tiny); font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.staff-row__you { background: var(--am-blue-tint); color: var(--text-secondary); }
.staff-row__lead { background: var(--am-blue); color: var(--text-on-dark); }
.staff-row__meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--font-size-small); color: var(--text-secondary);
}
.staff-row__status { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text-secondary); }
.staff-row__status::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--presence);
}
.staff-row__status--none { color: var(--text-muted); font-weight: 500; }
.staff-row__status--none::before { background: var(--border-strong); }
.staff-row__ext {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px;
    border: 1px solid var(--am-blue-soft); border-radius: var(--am-radius); background: var(--am-blue-tint);
    color: var(--am-blue); font: inherit; font-size: var(--font-size-small); font-weight: 700; cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.staff-row__ext:hover:not(:disabled) { background: var(--am-blue-soft); }
.staff-row__ext:focus-visible { outline: none; box-shadow: var(--am-focus); }
.staff-row__ext:disabled { cursor: default; opacity: .7; }

.staff-hub-empty {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center;
    border: 1px dashed var(--am-blue-soft); border-radius: var(--am-radius);
}
.staff-hub-empty__icon {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 50%; background: var(--am-blue-tint); color: var(--am-blue);
}
.staff-hub-empty__title { margin: 4px 0 0; font-size: var(--font-size-base); font-weight: 700; color: var(--am-blue); }

/* ---- Staff Hub: header icons (19 Oct 2026) ------------------------------ */
.staff-hub-header-action { display: inline-flex; align-items: center; justify-content: center; }
.staff-hub-header-action--danger:hover { color: color-mix(in srgb, var(--status-danger) 45%, var(--text-on-dark)); }

/* ---- Staff Hub: Chat (19 Oct 2026) -------------------------------------- */
.staff-chat-tab-badge {
    display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
    margin-left: 4px; border-radius: 9px; background: var(--am-blue); color: var(--text-on-dark); /* the bell's blue */
    font-size: var(--font-size-tiny); font-weight: 700; line-height: 1; vertical-align: 1px;
}
.header-user-avatar { position: relative; }
/* Looks like the bell's badge (.notification-badge); sits top right, the status dot stays bottom right. */
.header-user-avatar__chat { top: -2px; right: -3px; z-index: 1; pointer-events: none; }
.header-user-avatar__chat[hidden] { display: none; }

.staff-chat { display: flex; flex-direction: column; gap: 12px; }
.staff-chat__toolbar { display: flex; align-items: center; gap: 8px; }
.staff-chat__toolbar .staff-chat__search { flex: 1 1 auto; margin: 0; }
.staff-chat__toolbar .am-btn { flex: 0 0 auto; white-space: nowrap; }
.staff-chat__section {
    margin-top: 4px; font-size: var(--font-size-small); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}
.staff-chat__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.staff-chat__item {
    width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-align: left; cursor: pointer;
    border: 1px solid var(--am-blue-soft); border-radius: 5px; background: var(--surface-panel); font: inherit;
}
.staff-chat__item:hover { background: var(--am-blue-tint); }
.staff-chat__item:focus-visible, .staff-chat__pick:focus-visible { outline: none; box-shadow: var(--am-focus); }
.staff-chat__item-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.staff-chat__item-top, .staff-chat__item-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.staff-chat__item-title {
    flex: 1 1 auto; min-width: 0; font-size: var(--font-size-base); font-weight: 600; color: var(--am-blue);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.staff-chat__item-time { flex: 0 0 auto; font-size: var(--font-size-small); color: var(--text-muted); }
.staff-chat__item-preview {
    flex: 1 1 auto; min-width: 0; font-size: var(--font-size-base); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.staff-chat__item--unread .staff-chat__item-title, .staff-chat__item--unread .staff-chat__item-preview { font-weight: 700; color: var(--am-blue); }
.staff-chat__unread {
    flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px; background: var(--am-blue); color: var(--text-on-dark); font-size: var(--font-size-tiny); font-weight: 700;
}
.staff-chat__group-face {
    flex: 0 0 38px; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--am-blue-soft); color: var(--am-blue);
}
.staff-chat__group-face--team { background: var(--am-blue); color: var(--text-on-dark); }

/* Picker */
.staff-chat__head { display: flex; align-items: center; gap: 10px; }
.staff-chat__back, .staff-chat__leave {
    flex: 0 0 34px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    border: 1px solid var(--am-blue-soft); border-radius: var(--am-radius); background: var(--surface-panel); color: var(--am-blue);
}
.staff-chat__back:hover, .staff-chat__leave:hover { background: var(--am-blue-tint); }
.staff-chat__leave:hover { color: var(--am-red-ink); }
.staff-chat__head-text { flex: 1 1 auto; min-width: 0; }
.staff-chat__head-title {
    font-size: var(--font-size-medium); font-weight: 700; color: var(--am-blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.staff-chat__head-sub { font-size: var(--font-size-small); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-chat__field { display: flex; flex-direction: column; gap: 6px; font-size: var(--font-size-base); font-weight: 600; color: var(--am-blue); }
.staff-chat__field .staff-chat__name { padding-left: 12px; }
.staff-chat__pick { width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--am-blue); }
.staff-chat__pick:hover { background: var(--am-blue-tint); }
.staff-chat__pick--on { border-color: var(--am-blue); background: var(--am-blue-tint); }
.staff-chat__check {
    flex: 0 0 22px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--am-outline); border-radius: 5px; background: var(--surface-panel); color: var(--text-on-dark);
}
.staff-chat__pick--on .staff-chat__check { border-color: var(--am-blue); background: var(--am-blue); }
.staff-chat__picker-hint { font-size: var(--font-size-small); line-height: 1.45; }
.staff-chat__picker-actions {
    position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 0 4px; background: var(--surface-panel); border-top: 1px solid var(--am-blue-soft);
}

/* One conversation */
.staff-chat--open { gap: 0; height: calc(100vh - 290px); min-height: 360px; }
.staff-chat--open .staff-chat__head { padding-bottom: 12px; border-bottom: 1px solid var(--am-blue-soft); }
.staff-chat__messages {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 6px;
    overscroll-behavior: contain;
}
.staff-chat__earlier {
    align-self: center; padding: 5px 12px; border: 1px solid var(--am-blue-soft); border-radius: 14px;
    background: var(--surface-panel); color: var(--am-blue); font: inherit; font-size: var(--font-size-small); font-weight: 600; cursor: pointer;
}
.staff-chat__empty { margin: auto; font-size: var(--font-size-base); color: var(--text-muted); }
.staff-chat__day {
    align-self: center; margin: 8px 0 4px; padding: 3px 10px; border-radius: 11px;
    background: var(--am-blue-tint); color: var(--text-secondary); font-size: var(--font-size-tiny); font-weight: 600;
}
.staff-chat__msg { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; }
.staff-chat__msg--mine { align-self: flex-end; flex-direction: row-reverse; }
.staff-chat__msg-face { flex: 0 0 28px; width: 28px; align-self: flex-start; }
.staff-chat__avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; overflow: hidden;
    border-radius: 50%; background: var(--am-blue-soft); color: var(--am-blue); font-size: var(--font-size-tiny); font-weight: 700;
}
.staff-chat__avatar .avatar-photo { width: 100%; height: 100%; object-fit: cover; }
.staff-chat__bubble-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.staff-chat__msg--mine .staff-chat__bubble-wrap { align-items: flex-end; }
.staff-chat__sender { font-size: var(--font-size-small); font-weight: 600; color: var(--text-secondary); }
.staff-chat__bubble {
    display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; max-width: 100%;
    border-radius: 14px 14px 14px 4px; background: var(--am-blue-tint); color: var(--am-blue);
}
.staff-chat__msg--mine .staff-chat__bubble { border-radius: 14px 14px 4px 14px; background: var(--am-blue); color: var(--text-on-dark); }
.staff-chat__text { font-size: var(--font-size-base); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.staff-chat__removed { font-size: var(--font-size-base); font-style: italic; opacity: .75; }
.staff-chat__meta { font-size: var(--font-size-tiny); color: var(--text-muted); }
.staff-chat__remove {
    padding: 0; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: var(--font-size-tiny); cursor: pointer;
}
.staff-chat__remove:hover { color: var(--am-red-ink); text-decoration: underline; }
.staff-chat__image {
    display: block; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: rgba(0, 0, 0, .06); cursor: zoom-in;
}
.staff-chat__image img { display: block; max-width: 240px; max-height: 220px; min-width: 80px; min-height: 60px; object-fit: cover; }
.staff-chat__attachment {
    display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 280px; padding: 8px 10px; cursor: pointer;
    border: 1px solid color-mix(in srgb, var(--am-blue) 12%, transparent); border-radius: 8px; background: var(--surface-panel); color: var(--am-blue);
    font: inherit; text-align: left;
}
.staff-chat__msg--mine .staff-chat__attachment { border-color: rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .1); color: var(--text-on-dark); }
.staff-chat__attachment-icon {
    flex: 0 0 30px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; background: var(--am-blue-soft); color: var(--am-blue);
}
.staff-chat__attachment-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.staff-chat__attachment-name { font-size: var(--font-size-base); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staff-chat__attachment-size { font-size: var(--font-size-tiny); opacity: .75; }

/* Composer */
.staff-chat__composer { flex: 0 0 auto; padding-top: 10px; border-top: 1px solid var(--am-blue-soft); }
.staff-chat__file {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 6px 8px;
    border: 1px solid var(--am-blue-soft); border-radius: 6px; background: var(--am-blue-tint); font-size: var(--font-size-base);
}
.staff-chat__file[hidden] { display: none; }
.staff-chat__file .staff-chat__attachment-icon { flex-basis: 24px; width: 24px; height: 24px; }
.staff-chat__file .staff-chat__attachment-name { flex: 1 1 auto; min-width: 0; color: var(--am-blue); }
.staff-chat__file-clear {
    flex: 0 0 24px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 4px; background: none; color: var(--text-secondary); cursor: pointer;
}
.staff-chat__file-clear:hover { background: var(--am-blue-soft); }
.staff-chat__compose-row { display: flex; align-items: flex-end; gap: 8px; }
.staff-chat__attach, .staff-chat__send {
    flex: 0 0 40px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    border-radius: var(--am-radius);
}
.staff-chat__attach { border: 1px solid var(--am-outline); background: var(--surface-panel); color: var(--am-blue); }
.staff-chat__attach:hover { background: var(--am-blue-tint); }
.staff-chat__send { border: 0; background: var(--am-blue); color: var(--text-on-dark); }
.staff-chat__send:hover:not(:disabled) { filter: brightness(1.15); }
.staff-chat__send:disabled { opacity: .55; cursor: default; }
.staff-chat__input {
    flex: 1 1 auto; min-height: 40px; max-height: 140px; padding: 9px 12px; resize: none;
    border: 1px solid var(--am-outline); border-radius: var(--am-radius); background: var(--surface-panel);
    font: inherit; font-size: var(--font-size-base); line-height: 1.45; color: var(--am-blue);
}
.staff-chat__input:focus { outline: none; border-color: var(--am-blue); box-shadow: var(--am-focus); }
.staff-chat__hint { margin-top: 6px; font-size: var(--font-size-tiny); color: var(--text-muted); }

@media (max-width: 640px) {
    .staff-chat__toolbar { flex-wrap: wrap; }
    .staff-chat__toolbar .staff-chat__search { flex-basis: 100%; }
    .staff-chat--open { height: calc(100vh - 240px); }
    .staff-chat__msg { max-width: 94%; }
    .staff-chat__hint { display: none; }
}

/* ---- Team / All Staff: Message beside the extension (19 Oct 2026) ------- */
.staff-row__actions { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.staff-row__msg {
    width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    border: 1px solid var(--am-blue-soft); border-radius: var(--am-radius);
    background: var(--surface-panel); color: var(--am-blue);
}
.staff-row__msg:hover { background: var(--am-blue-tint); }
.staff-row__msg:focus-visible { outline: none; box-shadow: var(--am-focus); }

/* The open chat's height is set to fill the panel (staff-chat.js); no fixed guess. */
.staff-chat--open { height: auto; min-height: 320px; }

/* ---- New message pop-up, bottom right (19 Oct 2026) --------------------- */
.chat-popup-stack {
    position: fixed; right: var(--gutter); bottom: calc(var(--gutter) + var(--chat-popup-lift, 0px));
    z-index: 300; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.chat-popup {
    pointer-events: auto; position: relative; display: flex; align-items: center; gap: 12px;
    width: 320px; max-width: calc(100vw - 32px); padding: 12px 38px 12px 14px; cursor: pointer;
    border: 1px solid var(--border-default); border-left: 3px solid var(--am-blue); border-radius: 8px;
    background: var(--surface-panel); box-shadow: 0 18px 40px -18px rgba(16, 24, 40, .55);
    transform: translateX(16px); opacity: 0; transition: transform .22s ease, opacity .22s ease;
}
.chat-popup--visible { transform: translateX(0); opacity: 1; }
.chat-popup:focus-visible { outline: none; box-shadow: var(--am-focus), 0 18px 40px -18px rgba(16, 24, 40, .55); }
.chat-popup__face { position: relative; flex: 0 0 40px; width: 40px; height: 40px; }
.chat-popup__avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; overflow: hidden;
    border-radius: 50%; background: var(--am-blue-soft); color: var(--am-blue); font-size: var(--font-size-base); font-weight: 700;
}
.chat-popup__avatar .avatar-photo { width: 100%; height: 100%; object-fit: cover; }
.chat-popup__icon {
    position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--am-blue); color: var(--text-on-dark); box-shadow: 0 0 0 2px var(--surface-panel);
}
.chat-popup__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-popup__name {
    font-size: var(--font-size-base); font-weight: 700; color: var(--am-blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-popup__where { font-weight: 500; color: var(--text-muted); }
.chat-popup__body { font-size: var(--font-size-base); color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-popup__close {
    position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 4px; background: none; color: var(--text-muted); cursor: pointer;
}
.chat-popup__close:hover { background: var(--am-blue-tint); color: var(--am-blue); }
@media (prefers-reduced-motion: reduce) { .chat-popup { transform: none; transition: opacity .15s ease; } }
@media (max-width: 640px) { .chat-popup-stack { right: 16px; left: 16px; } .chat-popup { width: auto; } }

/* ---- Chat toolbar: icon buttons, soft, as tall as the search (19 Oct 2026) */
.staff-chat__tool {
    flex: 0 0 38px; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    border: 0; border-radius: var(--am-radius); background: var(--am-blue-tint); color: var(--am-blue);
}
.staff-chat__tool:hover { background: var(--am-blue-soft); }
.staff-chat__tool:focus-visible { outline: none; box-shadow: var(--am-focus); }
.staff-chat__toolbar { flex-wrap: nowrap; }
.staff-chat__pick .staff-row__msg { flex: 0 0 30px; }
@media (max-width: 640px) { .staff-chat__toolbar .staff-chat__search { flex-basis: auto; } }

/* ---- Agent Meeko pinned in Chat (19 Oct 2026) --------------------------- */
.staff-chat__list--pinned { margin-bottom: 2px; }
.staff-chat__item--meeko {
    border-color: color-mix(in srgb, var(--am-blue) 28%, var(--am-blue-soft));
    background: linear-gradient(135deg, var(--am-blue-tint) 0%, var(--surface-panel) 70%);
}
.staff-chat__item--meeko:hover { background: var(--am-blue-soft); }
.staff-chat__group-face--meeko {
    /* Black, so the mark's own colours show (24 Oct 2026). */
    background: var(--surface-meeko-mark); color: var(--text-on-dark);
}
.staff-chat__pin { flex: 0 0 auto; display: inline-flex; color: var(--accent); }

/* The Meeko chat itself moves in here; it fills what is left of the panel. */
.staff-chat--meeko .staff-chat__head { padding-bottom: 12px; border-bottom: 1px solid var(--am-blue-soft); }
.staff-chat__meeko-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.staff-chat__meeko-host .agent-meeko__thread { padding-left: 2px; padding-right: 2px; }

/* ---- Avatars: 6px corners, not circles (19 Oct 2026) ----------------------
   People, groups, teams and Agent Meeko in Chat, Team, All Staff and the
   message pop-up. Status dots stay round. */
.staff-row__avatar,
.staff-chat__avatar,
.staff-chat__group-face,
.chat-popup__avatar { border-radius: 6px; }
.staff-row__avatar .avatar-photo,
.staff-chat__avatar .avatar-photo,
.chat-popup__avatar .avatar-photo { border-radius: 6px; }

/* ---- @mentions (19 Oct 2026) ------------------------------------------ */
.staff-chat__mention {
    padding: 0 3px; border-radius: 3px; font-weight: 600;
    background: color-mix(in srgb, var(--am-blue) 12%, transparent); color: var(--accent);
}
.staff-chat__msg--mine .staff-chat__mention { background: rgba(255, 255, 255, .18); color: var(--text-on-dark); }
.staff-chat__mention--me { background: var(--status-warning-tint); color: var(--status-warning); }
.staff-chat__msg--mentions-me .staff-chat__bubble { box-shadow: inset 3px 0 0 var(--status-warning); }

.staff-chat__compose-row { position: relative; }
.staff-chat__mentions {
    position: absolute; left: 48px; right: 48px; bottom: calc(100% + 6px); z-index: 5;
    max-height: 220px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
    border: 1px solid var(--border-default); border-radius: 8px; background: var(--surface-panel);
    box-shadow: 0 12px 28px -12px rgba(16, 24, 40, .35);
}
.staff-chat__mentions[hidden] { display: none; }
.staff-chat__mention-option {
    width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; cursor: pointer; text-align: left;
    border: 0; border-radius: var(--am-radius); background: none; font: inherit; font-size: var(--font-size-base); color: var(--am-blue);
}
.staff-chat__mention-option[aria-selected="true"], .staff-chat__mention-option:hover { background: var(--am-blue-tint); }
.staff-chat__mention-option .staff-chat__avatar { width: 26px; height: 26px; font-size: var(--font-size-tiny); }
.staff-chat__mention-option small { margin-left: auto; color: var(--text-muted); font-size: var(--font-size-small); }

/* ---- Phones (RM-035, 28 Oct 2026) ---------------------------------------- */
/* iOS zooms the page into any focused field under 16px. */
@media (max-width: 560px) {
    .staff-hub-search__input,
    .staff-chat__input { font-size: 16px; }
}

/* ---- RM-115: an agent working on a reply --------------------------------------- */
.staff-chat__thinking {
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
    margin: 4px 0 2px 44px; padding: 6px 10px; border-radius: 12px;
    background: var(--accent-tint); color: var(--text-secondary);
    font-size: var(--font-size-small);
}
.staff-chat__thinking-dots { display: inline-flex; gap: 3px; }
.staff-chat__thinking-dots i {
    width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .35;
    animation: staff-chat-thinking 1.2s infinite ease-in-out;
}
.staff-chat__thinking-dots i:nth-child(2) { animation-delay: .15s; }
.staff-chat__thinking-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes staff-chat-thinking { 0%, 80%, 100% { opacity: .35; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .staff-chat__thinking-dots i { animation: none; } }

/* ---- RM-115 Wave 2: read an agent's message aloud in its voice ---------------- */
/* Dressed like Remove beside it: a quiet text control in the meta line. */
.staff-chat__read-aloud {
    display: inline-flex; align-items: center; gap: 3px; vertical-align: bottom;
    padding: 0; border: 0; background: none; color: var(--text-muted);
    font: inherit; font-size: var(--font-size-tiny); cursor: pointer;
}
.staff-chat__read-aloud .icon { flex: none; }
.staff-chat__read-aloud:hover { color: var(--accent); text-decoration: underline; }
.staff-chat__read-aloud:focus-visible { outline: none; border-radius: 4px; box-shadow: 0 0 0 2px var(--accent-tint); }
.staff-chat__read-aloud--speaking { color: var(--accent); font-weight: 600; }
/* A thumb needs more than the text's own height to hit it. */
@media (max-width: 560px) { .staff-chat__read-aloud { padding: 6px 0; } }

/* ---- RM-115 Wave 3: an agent's suggestions, under its message ----------------- */
/* Quiet white cards beside the tinted bubble, so a suggestion reads as
   something to decide rather than more of the message. */
.staff-chat__approvals { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.staff-chat__approvals:empty { display: none; }
.staff-chat__approval {
    display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; max-width: 360px;
    border: 1px solid var(--accent-border); border-radius: 10px; background: var(--surface-panel);
}
.staff-chat__approval--decided { border-color: var(--border-subtle); background: var(--surface-subtle); }
.staff-chat__approval-icon {
    flex: 0 0 22px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; background: var(--accent-tint); color: var(--accent);
}
.staff-chat__approval--decided .staff-chat__approval-icon { background: var(--status-neutral-tint); color: var(--status-neutral); }
.staff-chat__approval-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.staff-chat__approval-summary {
    margin: 0; font-size: var(--font-size-small); line-height: 1.45; color: var(--text-primary); overflow-wrap: anywhere;
}
.staff-chat__approval--decided .staff-chat__approval-summary { color: var(--text-secondary); }
.staff-chat__approval-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.staff-chat__approval-actions .button { display: inline-flex; align-items: center; gap: 4px; }
.staff-chat__approval-status { margin: 0; font-size: var(--font-size-tiny); font-weight: 600; color: var(--text-muted); }
.staff-chat__approval-status--approved { color: var(--status-success); }
.staff-chat__approval-error { margin: 0; font-size: var(--font-size-tiny); line-height: 1.4; color: var(--status-danger); }
/* RM-117: what a prepared change will do, then what happened when it ran. */
.staff-chat__approval-lines {
    margin: 0; padding: 0 0 0 14px; display: flex; flex-direction: column; gap: 2px;
    font-size: var(--font-size-tiny); line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere;
}
.staff-chat__approval-result { margin: 0; font-size: var(--font-size-tiny); line-height: 1.4; color: var(--text-muted); overflow-wrap: anywhere; }
.staff-chat__approval-result--done { color: var(--status-success); }
.staff-chat__approval-result--failed { color: var(--status-danger); }
/* Thumbs: the two buttons share the card's width on a phone. */
@media (max-width: 560px) {
    .staff-chat__approval { max-width: 100%; }
    .staff-chat__approval-actions .button { flex: 1 1 0; justify-content: center; }
}
