/* =========================================================
   shopdarret — Human agent dashboard
   Shared base + LOGIN view (waiting & call styled later)
   ========================================================= */

/* ---------- 1. Colours & sizes (reuse everywhere) ---------- */
:root {
    --navy: #0E3155;
    /* buttons, titles, logo, headset */
    --navy-hover: #16426F;
    --slate: #55718D;
    /* input icons, secondary text */
    --muted: #7B90A5;
    /* placeholder / hint text */
    --text: #1C2B3A;
    /* normal body text */
    --page-bg: #F4F1EA;
    /* warm off-white page */
    --card-bg: #FDFCFA;
    /* login card */
    --border: #DCE2E8;
    /* card + input borders */
    --focus: #3B82C4;
    /* keyboard focus ring */
    --error: #B42318;
    --error-bg: #FDECEA;
    --info: #1D4E7E;
    --info-bg: #EAF2FA;

    --radius-card: 16px;
    --radius-input: 10px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* ---------- 2. Reset & base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* The "do not show" sign always wins over any display rule */
[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--page-bg);
}

img {
    display: block;
    max-width: 100%;
}

h1,
h2,
p {
    margin: 0;
}

/* Visible focus ring for keyboard users only */
:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* ---------- 3. Brand (logo) — shared ---------- */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 32px;
    height: 32px;
}

.brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.01em;
}

/* ---------- 4. LOGIN view layout ---------- */
.view-login {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 440px);
    align-items: center;
    gap: 48px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 48px;
}

/* Left side */
.login-intro {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-intro .brand {
    margin-bottom: 28px;
}

.login-title {
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    line-height: 1.15;
    font-weight: 700;
    color: var(--navy);
    max-width: 12ch;
    /* breaks into "Human Agent / Sign In" */
}

.login-subtitle {
    font-size: 1.05rem;
    color: var(--slate);
    max-width: 34ch;
}

.login-illustration {
    width: 140px;
    height: 140px;
    margin-top: 24px;
}

/* Right side: card */
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 40px 36px 28px;
    box-shadow: 0 10px 30px rgba(14, 49, 85, 0.06);
}

.card-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
}

.card-subtitle {
    margin-top: 4px;
    margin-bottom: 28px;
    color: var(--slate);
}

/* ---------- 5. Form ---------- */
.login-form {
    display: flex;
    flex-direction: column;
}

.field-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 8px;
}

/* Wrapper that holds icon + input (+ eye button) */
.input-wrap {
    position: relative;
    margin-bottom: 22px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
    /* clicks go through to the input */
}

.input-wrap input {
    width: 100%;
    height: 48px;
    padding: 0 48px 0 44px;
    /* room for left icon and right eye button */
    font: inherit;
    font-size: 0.98rem;
    color: var(--text);
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-wrap input::placeholder {
    color: var(--muted);
}

.input-wrap input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 196, 0.2);
}

/* Eye (show / hide password) button */
.toggle-password {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.toggle-password img {
    width: 20px;
    height: 20px;
}

.toggle-password:hover {
    background: rgba(85, 113, 141, 0.1);
}

/* Sign in button */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    margin-top: 6px;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #FFFFFF;
    background: var(--navy);
    border: none;
    border-radius: var(--radius-input);
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-primary:hover {
    background: var(--navy-hover);
}

/* Used while "Signing in…" so double clicks do nothing */
.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

/* Message area under the button (empty = takes no space) */
.login-message {
    margin-top: 14px;
    font-size: 0.9rem;
    text-align: center;
}

.login-message:empty {
    display: none;
}

/* JS adds ONE of these classes depending on the message */
.login-message.is-error {
    color: var(--error);
    background: var(--error-bg);
    padding: 10px 12px;
    border-radius: 8px;
}

.login-message.is-info {
    color: var(--info);
    background: var(--info-bg);
    padding: 10px 12px;
    border-radius: 8px;
}

/* Need help? link */
.help-text {
    margin-top: 22px;
    text-align: center;
    font-size: 0.85rem;
}

.help-text a {
    color: var(--slate);
    text-decoration: none;
}

.help-text a:hover {
    color: var(--navy);
    text-decoration: underline;
}

/* ---------- 6. Small screens (phones / narrow tablets) ---------- */
@media (max-width: 820px) {
    .view-login {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 24px 20px;
        align-content: start;
    }

    .login-intro {
        gap: 12px;
    }

    .login-intro .brand {
        margin-bottom: 12px;
    }

    .login-title {
        max-width: none;
    }

    .login-illustration {
        display: none;
        /* save space on phones */
    }

    .login-card {
        padding: 28px 22px 22px;
    }
}

/* =========================================================
   Step 3a — top bar, waiting view, incoming-call popup
   ========================================================= */

/* ---------- Top bar ---------- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-logo-text {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--navy);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    /* lets a long name shrink instead of breaking the bar */
}

.status-wrap {
    display: inline-flex;
    align-items: center;
    color: var(--navy);
    font-size: 0.95rem;
    white-space: nowrap;
}

/* The coloured dot is drawn in front of the status text */
#agent-status::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 50%;
    background: #9AA7B4;
    /* checking = grey */
}

#agent-status[data-state="online"]::before {
    background: #22A65A;
    /* green */
}

#agent-status[data-state="offline"]::before {
    background: #D64545;
    /* red */
}

.top-bar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.agent-name {
    color: var(--navy);
    font-weight: 600;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout,
.btn-sound {
    font: inherit;
    font-size: 0.9rem;
    color: var(--navy);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-sound {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFF4E0;
    /* soft orange, like the "Incoming" badge */
    border-color: #F2C98A;
}

.btn-logout:hover,
.btn-sound:hover {
    background: rgba(14, 49, 85, 0.06);
}

/* ---------- Waiting view ---------- */
.view-waiting {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.waiting-title {
    margin: 0;
    font-size: 1.5rem;
    color: var(--navy);
}

.waiting-subtitle {
    margin: 4px 0 16px;
    color: var(--slate);
}

.waiting-card {
    max-width: 500px;
    padding: 28px 24px;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.waiting-icon-circle {
    width: 88px;
    height: 88px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(14, 49, 85, 0.06);
}

.waiting-card-title {
    margin: 0 0 8px;
    font-size: 1.2rem;
    color: var(--navy);
}

.waiting-card-text {
    margin: 0 0 24px;
    color: var(--slate);
}

.waiting-no-call {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border-radius: 8px;
    background: rgba(14, 49, 85, 0.05);
    color: var(--slate);
}

/* ---------- Incoming-call popup ---------- */
.incoming-call {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 340px;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(14, 49, 85, 0.15);
}

.incoming-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.incoming-title {
    font-weight: 600;
    color: var(--navy);
}

.incoming-badge {
    margin-left: auto;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #B4600A;
    background: #FFE9C7;
}

.incoming-summary {
    margin: 0 0 4px;
    color: var(--navy);
    overflow-wrap: anywhere;
    /* long words never break the box */
}


.incoming-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.btn-accept,
.btn-decline {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.btn-accept {
    color: #FFFFFF;
    background: var(--navy);
    border: 1px solid var(--navy);
}

.btn-decline {
    color: var(--navy);
    background: var(--card-bg);
    border: 1px solid var(--navy);
}

.btn-accept:disabled,
.btn-decline:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- Phones / narrow screens ---------- */
@media (max-width: 820px) {
    .top-bar {
        flex-wrap: wrap;
        padding: 10px 12px;
    }

    .top-bar-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .top-bar-divider {
        display: none;
    }

    .view-waiting {
        padding: 16px 12px;
    }

    .view-waiting:not([hidden]) {
        display: flex;
        flex-direction: column;
    }

    /* Popup sits in the page flow, between the title and the card */
    .incoming-call {
        position: static;
        width: auto;
        margin-bottom: 16px;
    }

    .waiting-header {
        order: 0;
    }

    .incoming-call {
        order: 1;
    }

    .waiting-card {
        order: 2;
    }
}


/* =========================================================
   ACTIVE CALL VIEW (Phase 7, step 4 layout)
   Append to the END of /agent/style.css.
   ========================================================= */

.view-call {
    /* local colours (only used inside the call view) */
    --call-muted: #7B90A5;
    /* labels, timestamps, helper note   */
    --call-live: #22A65A;
    /* live dot (same green as "Online") */
    --call-pill-bg: #E1F0FD;
    /* Order match / RAGAS pills          */
    --call-pill-border: #C3E2FE;
    --call-pill-text: #1B4F9C;
    --call-badge-bg: #CFE6FD;
    /* "Layer 2 · English", "Layer 3"     */
    --call-badge-text: #1C5DB8;
    --call-tag-bg: #E1F0FD;
    /* Customer / AI Agent tags           */
    --call-tag-text: #1769D6;
    --call-tag-agent-bg: #E8EDF3;
    /* human agent tag                    */
    --call-row-bg: #F1F5F8;
    /* helper result rows                 */
    --call-input-border: #E5EAED;
    --call-scroll-thumb: #B9C9D6;
    --call-panel-height: clamp(260px, 38vh, 420px);
    /* height of the three panels         */

    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: 16px 24px 32px;
    box-sizing: border-box;
    color: var(--navy);
}

.view-call:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.view-call *,
.view-call *::before,
.view-call *::after {
    box-sizing: border-box;
}

/* screen-reader-only text (scoped so it can't clash) */
.view-call .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- shared card ---------- */
.call-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 0;
    /* lets long text wrap inside grid/flex */
}

/* ---------- 1. header + handoff ---------- */
.call-handoff {
    padding: 0 0 16px;
}

.call-handoff-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.call-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 18px;
}

.call-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
}

.call-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    color: var(--navy);
    white-space: nowrap;
}

.call-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--call-live);
}

.call-timer {
    font-variant-numeric: tabular-nums;
    /* stops the timer "jumping" */
}

.call-subtitle {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
}

.call-handoff .call-subtitle {
    padding: 12px 18px 0;
}

.call-facts {
    margin: 0;
    padding: 0 18px;
    display: grid;
    gap: 6px;
}

.call-fact {
    display: grid;
    grid-template-columns: minmax(160px, 30%) 1fr;
    gap: 16px;
    font-size: 0.9rem;
}

.call-fact dt {
    color: var(--call-muted);
}

.call-fact dd {
    margin: 0;
    color: var(--navy);
    overflow-wrap: anywhere;
}

/* ---------- pills and badges ---------- */
.call-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.call-pill,
.call-badge,
.call-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.2;
}

.call-pill {
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--call-pill-bg);
    border: 1px solid var(--call-pill-border);
    color: var(--call-pill-text);
}

.call-badge {
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--call-badge-bg);
    color: var(--call-badge-text);
}

.call-tag {
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--call-tag-bg);
    color: var(--call-tag-text);
}

.call-tag-agent {
    background: var(--call-tag-agent-bg);
    color: var(--navy);
}

/* ---------- 2. three panels ---------- */
.call-panels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.call-panel {
    display: flex;
    flex-direction: column;
    height: var(--call-panel-height);
    /* fixed height: content scrolls inside */
    overflow: hidden;
}

.call-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.call-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
}

.call-panel-title img {
    flex-shrink: 0;
}

/* the body fills the rest of the panel; min-height: 0 is what
   allows the inner list to scroll instead of stretching the card */
.call-panel-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- shared scroll area + scrollbar ---------- */
.call-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* phone: don't drag the page */
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px;
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--call-scroll-thumb) transparent;
}

.call-scroll::-webkit-scrollbar {
    /* Chrome, Edge, Safari */
    width: 8px;
}

.call-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.call-scroll::-webkit-scrollbar-thumb {
    background: var(--call-scroll-thumb);
    border-radius: 8px;
}

.call-scroll:focus-visible {
    outline: 2px solid var(--call-tag-text);
    outline-offset: -2px;
}

/* ---------- 2a. live transcript ---------- */
.call-transcript-list {
    list-style: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.call-line {
    max-width: 85%;
}

.call-line-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.call-line-time {
    font-size: 0.75rem;
    color: var(--call-muted);
    font-variant-numeric: tabular-nums;
}

.call-line-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--navy);
    overflow-wrap: anywhere;
}

/* "New messages" button floating at the bottom of the transcript */
.call-jump {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--navy);
    color: #FFFFFF;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(14, 49, 85, 0.25);
}

/* ---------- 2b. translation captions ---------- */
.call-captions p {
    margin: 0 0 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--navy);
    overflow-wrap: anywhere;
}

/* ---------- 2c. AI agent helper ---------- */
.call-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 36px;
    border: 1px solid var(--call-input-border);
    border-radius: 8px;
    background: #FFFFFF;
}

.call-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 16px;
    /* 16px stops iPhone zooming on focus */
    color: var(--navy);
}

.call-search input::placeholder {
    color: var(--call-muted);
}

.call-search:focus-within {
    border-color: var(--call-tag-text);
}

.call-helper-note {
    margin: 10px 0;
    font-size: 0.8rem;
    color: var(--call-muted);
}

.call-helper-results {
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    background: var(--call-row-bg);
    overflow: hidden;
}

.call-helper-results li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--navy);
}

.call-helper-results li+li {
    border-top: 1px solid var(--card-bg);
}

.call-helper-results img {
    flex-shrink: 0;
}

.call-helper-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.call-helper-form .call-search {
    flex: 1;
    min-width: 0;
}

.call-helper-send {
    flex: none;
    height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: var(--navy);
    color: #FFFFFF;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.call-helper-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.call-helper-status {
    margin: 0 0 10px;
    font-size: 0.8rem;
    color: var(--call-muted);
}

.call-helper-status:empty {
    display: none;
}

.call-helper-result-title {
    font-weight: 600;
}

.call-helper-result-excerpt {
    margin: 0;
}

.call-helper-result-file {
    font-size: 0.75rem;
    color: var(--call-muted);
}

.call-placeholder[hidden] {
    display: none;
}

/* ---------- 3. suggested resolution + End call ---------- */
.call-resolution {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
}

.call-resolution-icon {
    align-self: flex-start;
    flex-shrink: 0;
}

.call-resolution-text {
    flex: 1;
    min-width: 0;
}

.call-resolution-text p {
    margin: 0 0 10px;
    color: var(--navy);
    overflow-wrap: anywhere;
}

.call-end {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 160px;
    min-height: 44px;
    padding: 10px 24px;
    border: 0;
    border-radius: 8px;
    background: var(--navy);
    color: #FFFFFF;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.call-end:hover {
    filter: brightness(1.15);
}

.call-end:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- tablet (≤ 1100px): transcript full width, other two side by side ---------- */
@media (max-width: 1100px) {
    .call-panels {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .call-panel-transcript {
        grid-column: 1 / -1;
        height: 340px;
    }
}

/* ---------- phone (≤ 820px, same breakpoint as login/waiting) ---------- */
@media (max-width: 820px) {
    .view-call {
        padding: 12px 12px 24px;
        --call-panel-height: 260px;
    }

    .view-call:not([hidden]) {
        gap: 12px;
    }

    .call-handoff-head {
        padding: 12px 14px;
    }

    .call-handoff .call-subtitle {
        padding: 12px 14px 0;
    }

    .call-facts {
        padding: 0 14px;
        gap: 10px;
    }

    /* label above value instead of two columns */
    .call-fact {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .call-panels {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* transcript is the most important panel: taller, but never the whole screen */
    .call-panel-transcript {
        height: clamp(280px, 55vh, 440px);
    }

    .call-line {
        max-width: 100%;
    }

    .call-resolution {
        flex-wrap: wrap;
        padding: 16px;
    }

    .call-end {
        width: 100%;
        /* big, easy tap target */
        min-height: 48px;
    }
}

/* =========================================================
   ACTIVE CALL VIEW 
   Append AFTER block 2 at the very end of /agent/style.css.
   ========================================================= */

.view-call .call-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 16px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--call-muted);
    pointer-events: none;
}

.view-call .call-placeholder {
    margin: 0;
    font-size: 0.9rem;
    color: var(--call-muted);
}


/* the results box has a grey background: hide it while it has no rows */
.call-helper-results:empty {
    display: none;
}

/*"Session expired" notice on the call view */
.call-session-notice {
    margin: 0;
    padding: 10px 14px;
    border: 1px solid #F5C26B;
    border-radius: 8px;
    background: #FFF6E5;
    color: #8A5300;
    font-size: 14px;
    font-weight: 600;
}

.call-session-notice[hidden] {
    display: none;
}

/* ---------- handoff summary (scrolls like the other boxes) ---------- */
.call-handoff .call-summary {
    margin: 0 18px;
    max-height: 7.5em;
    /* about 4 lines, then it scrolls */
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--navy);
    overflow-wrap: anywhere;
}

@media (max-width: 820px) {
    .call-handoff .call-summary {
        margin: 0 14px;
    }
}

/* ---------- RAGAS pill and reason ---------- */
.call-ragas[data-colour="green"] {
    background: #e3f6e8;
    color: #14612c;
    border-color: #8fd0a2;
}

.call-ragas[data-colour="orange"] {
    background: #fff1dc;
    color: #8a4b00;
    border-color: #f0b863;
}

.call-ragas[data-colour="red"] {
    background: #fde4e4;
    color: #8f1d1d;
    border-color: #eb9b9b;
}

.call-ragas[data-colour="grey"] {
    background: #eceff3;
    color: #4a5565;
    border-color: #c4cbd6;
}

.call-handoff .call-ragas-reason {
    margin: 8px 18px 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--navy);
    overflow-wrap: anywhere;
}

.call-handoff .call-ragas-reason[data-colour="orange"] {
    border-left-color: #f0b863;
    background: #fff8ec;
}

.call-handoff .call-ragas-reason[data-colour="red"] {
    border-left-color: #eb9b9b;
    background: #fff1f1;
}

@media (max-width: 820px) {
    .call-handoff .call-ragas-reason {
        margin: 8px 14px 0;
    }
}

.call-ragas {
    gap: 6px;
}

#call-ragas-score:empty {
    display: none;
}

.call-handoff .call-ragas-reason-text {
    margin: 0;
    max-height: 4.5em;
    /* 3 lines, so a long reason never grows the card */
    overflow: hidden;
    white-space: pre-line;
}

.call-handoff .call-ragas-reason-text.is-expanded {
    max-height: 12em;
    /* about 8 lines, then it scrolls inside the box */
    overflow-y: auto;
}

.call-handoff .call-ragas-toggle {
    margin: 4px 0 0;
    padding: 2px 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy);
    text-decoration: underline;
    cursor: pointer;
}

.call-ragas-reason[hidden],
.call-ragas-toggle[hidden] {
    display: none;
}