/* =============================================================================
   Agent Meeko Live help (16 Nov 2026)

   1. The card under Meeko's message in Agent Meeko chat (live-help-cards.js)
   2. The Live help card on Settings > Agent Meeko Phone > Call Handling
      (live-help-settings.js)
   3. The Live help section of a Meeko call in Call Logs (meeko-calls-tab.js)
   4. Handlers: who has picked a question up, the held chat pop-up, and the
      Handlers card on Security Check

   Every value comes from design-tokens.css. The card follows the chat's own
   suggestion cards: a hairline, an icon in a soft badge, no coloured strip.
   ============================================================================= */

/* ---- 1. In chat ------------------------------------------------------------------- */

.staff-chat__live-help:empty { display: none; }
.staff-chat__live-help { max-width: 100%; }

.live-help-card {
    display: flex; flex-direction: column; gap: 10px;
    width: 380px; max-width: 100%; box-sizing: border-box; padding: 12px;
    border: 1px solid var(--accent-border); border-radius: 10px; background: var(--surface-panel);
}
.live-help-card--done { border-color: var(--border-default); }

.live-help-card__head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.live-help-card__badge {
    flex: 0 0 28px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; background: var(--accent-tint); color: var(--accent);
}
.live-help-card--done .live-help-card__badge { background: var(--status-neutral-tint); color: var(--status-neutral); }
.live-help-card__heading { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.live-help-card__title { margin: 0; font-size: var(--font-size-base); font-weight: 600; color: var(--text-primary); }
.live-help-card__who {
    margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    font-size: var(--font-size-small); color: var(--text-secondary); overflow-wrap: anywhere;
}
.live-help-card__dot { color: var(--text-muted); }
.live-help-card__reference { color: var(--text-muted); }
.live-help-card__link {
    padding: 0; border: 0; background: none; font: inherit; color: var(--accent);
    font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.live-help-card__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.live-help-card__question {
    margin: 0; font-size: var(--font-size-base); line-height: 1.5; color: var(--text-primary); overflow-wrap: anywhere;
}

/* Soft 5px tags: the state of the question. */
.live-help-tag {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
    border-radius: var(--radius-button); font-size: var(--font-size-tiny); font-weight: 600; white-space: nowrap;
    background: var(--status-neutral-tint); color: var(--status-neutral);
}
.live-help-tag .icon { width: 12px; height: 12px; }
.live-help-tag--waiting { background: var(--status-warning-tint); color: var(--status-warning-ink); font-variant-numeric: tabular-nums; }
.live-help-tag--answered { background: var(--status-success-tint); color: var(--status-success); }
.live-help-tag--expired { background: var(--status-neutral-tint); color: var(--status-neutral); }
.live-help-tag--cancelled { background: var(--status-danger-tint); color: var(--status-danger); }

.live-help-card__replies { display: flex; flex-wrap: wrap; gap: 6px; }
.live-help-chip {
    max-width: 100%; padding: 6px 10px; border: 1px solid var(--accent-border); border-radius: var(--radius-button);
    background: var(--accent-tint); color: var(--accent); font: inherit; font-size: var(--font-size-small); font-weight: 600;
    text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.live-help-chip:hover { border-color: var(--accent); }
.live-help-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-help-chip:disabled { opacity: 0.6; cursor: default; }

.live-help-card__answer { display: flex; gap: 6px; min-width: 0; }
.live-help-card__input {
    flex: 1 1 auto; min-width: 0; height: 28px; box-sizing: border-box; padding: 0 10px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-button); background: var(--surface-panel);
    font: inherit; font-size: var(--font-size-small); color: var(--text-primary);
}
.live-help-card__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.live-help-card__send { flex: 0 0 auto; }

.live-help-card__outcome { display: flex; flex-direction: column; gap: 4px; }
.live-help-card__outcome p {
    margin: 0; font-size: var(--font-size-small); line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere;
}

/* Join call sits under a ruled line: it is the other way to answer. */
.live-help-card__join {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding-top: 10px; border-top: 1px solid var(--border-subtle);
}
.live-help-card__join-label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: var(--font-size-small); font-weight: 600; color: var(--text-primary);
}
.live-help-card__join-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.live-help-card__hint { flex: 1 1 100%; margin: 0; font-size: var(--font-size-tiny); line-height: 1.4; color: var(--text-muted); }
.live-help-card__error { margin: 0; font-size: var(--font-size-tiny); line-height: 1.4; color: var(--status-danger); }

/* ---- 2. Settings: Live help on Call Handling ---------------------------------------- */

.mp-live-help__details { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.mp-live-help__wait { max-width: 320px; }
.mp-live-help__wait .gs-hint { margin: 6px 0 0; }
.mp-live-help__order {
    padding: 12px 14px; border: 1px solid var(--border-default); border-radius: 10px; background: var(--surface-subtle);
}
.mp-live-help__label { margin: 0 0 6px; font-size: var(--font-size-small); font-weight: 600; color: var(--text-primary); }
.mp-live-help__steps {
    margin: 0 0 6px; padding-left: 20px; display: flex; flex-direction: column; gap: 3px;
    font-size: var(--font-size-small); line-height: 1.45; color: var(--text-secondary);
}
.mp-live-help__order .gs-hint { margin: 0; }

/* ---- 3. Call Logs: Live help on one Meeko call (meeko-calls-tab.js) ----------------- */

.meeko-call__help { list-style: none; margin: 0; padding: 0; }
.meeko-call__help-row {
    display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); min-width: 0;
}
.meeko-call__help-row:last-child { border-bottom: 0; }
.meeko-call__help-row--join { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.meeko-call__help-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.meeko-call__help-who { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.meeko-call__help-time { font-size: var(--font-size-small); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.meeko-call__help-head .live-help-tag { margin-left: auto; }
.meeko-call__help-question { margin: 0; line-height: 1.55; color: var(--text-primary); overflow-wrap: anywhere; }
.meeko-call__help-answer { margin: 0; line-height: 1.55; color: var(--text-secondary); overflow-wrap: anywhere; }
.meeko-call__help-icon {
    flex: 0 0 24px; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; background: var(--accent-tint); color: var(--accent);
}

/* ---- 4. Handlers ------------------------------------------------------------------- */

/* Who has it, in the card: a soft line, never a coloured strip. */
.live-help-card__handling {
    margin: 0; display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
    padding: 4px 8px; border-radius: var(--radius-button);
    background: var(--status-neutral-tint); color: var(--text-secondary);
    font-size: var(--font-size-small); font-weight: 600; overflow-wrap: anywhere;
}
.live-help-card__handling .icon { width: 13px; height: 13px; flex: 0 0 auto; }
.live-help-card__handling--mine { background: var(--accent-tint); color: var(--accent); }
.live-help-card__pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.live-help-card__pick .live-help-card__hint { flex: 1 1 200px; }

/* The chat pop-up for a caller on hold stays until clicked (live-help-cards.js holdPopup). It sits on the dark pop-up. */
.chat-popup__live-help {
    display: block; margin-top: 4px; font-size: var(--font-size-small); font-weight: 600;
    color: var(--text-on-dark); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}

/* Security Check: Handlers. */
.mp-handlers__picker { max-width: 560px; }
.mp-handlers__rules { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 3px;
    font-size: var(--font-size-small); line-height: 1.45; color: var(--text-secondary); }

/* ---- Phones ------------------------------------------------------------------------- */

@media (max-width: 560px) {
    .live-help-card { width: 100%; }
    .live-help-card__answer { flex-wrap: wrap; }
    /* iOS zooms the page into any input under 16px. */
    .live-help-card__input { font-size: 16px; height: 36px; flex-basis: 100%; }
    .live-help-card__send { flex: 1 1 100%; justify-content: center; }
    .live-help-card__join-buttons { margin-left: 0; width: 100%; }
    .live-help-card__join-buttons .am-btn { flex: 1 1 0; justify-content: center; }
    .mp-live-help__wait { max-width: none; }
    .mp-handlers__picker { max-width: none; }
    .live-help-card__pick .am-btn { flex: 1 1 100%; justify-content: center; }
}
