/*
 * Shared, self-contained support surfaces: no remote fonts or UI framework.
 *
 * Everything is scoped to `.uaps` so themes cannot leak in and the widget
 * cannot leak out. All colour, radius, shadow and motion decisions live in the
 * token block below; component rules only consume tokens. The accent is always
 * the solid configured colour with a white foreground: no gradients, derived
 * shades or hover darkening.
 */

/* ---------------------------------------------------------------- tokens */

.uaps {
    /* Primary fills share a white foreground in both colour modes. */
    --uaps-brand: #3154cb;
    --uaps-on-brand: #fff;
    --uaps-soft: #eef2fd;
    --uaps-brand-line: #bac9f1;
    --uaps-focus-ring: 0 0 0 3px #dbe3fa;

    /* Text: the plugin's warm-paper ramp. */
    --uaps-ink: #1c1917;
    --uaps-ink-2: #3f3a36;
    --uaps-muted: #57534b;
    --uaps-faint: #7a736b;

    /* Surfaces */
    --uaps-paper: #fff;
    --uaps-canvas: #faf9f7;
    --uaps-surface: #f4f2ee;
    --uaps-fill: #efece7;
    --uaps-line: #e8e5df;
    --uaps-line-soft: #f0eee9;
    --uaps-line-strong: #d6d1c9;

    /* Status */
    --uaps-success: #26754e;
    --uaps-success-soft: #eaf5ef;
    --uaps-warn: #885719;
    --uaps-warn-soft: #fdf6ea;
    --uaps-warn-line: #ecddc3;
    --uaps-danger: #b42335;
    --uaps-danger-soft: #fdf0f1;

    /* Search hits use the conventional highlighter amber, never the accent. */
    --uaps-hit: #fbe3a4;

    /* Radius scale */
    --uaps-r-xs: 6px;
    --uaps-r-sm: 8px;
    --uaps-r-md: 10px;
    --uaps-r-lg: 14px;
    --uaps-r-xl: 16px;
    --uaps-r-bubble: 18px;
    --uaps-r-tight: 6px;

    /* Elevation: warm, layered and only on floating layers. */
    --uaps-shadow-xs: 0 1px 2px rgba(28, 25, 23, .05);
    --uaps-shadow-sm: 0 1px 2px rgba(28, 25, 23, .06), 0 3px 8px -3px rgba(28, 25, 23, .1);
    --uaps-shadow-md: 0 14px 30px -10px rgba(28, 25, 23, .22), 0 4px 12px -4px rgba(28, 25, 23, .08);
    --uaps-shadow-lg: 0 30px 60px -18px rgba(28, 25, 23, .3), 0 12px 26px -12px rgba(28, 25, 23, .14);

    /* Motion */
    --uaps-dur: 200ms;
    --uaps-dur-fast: 120ms;
    --uaps-ease: cubic-bezier(.2, .7, .2, 1);

    /* Queue avatar palette: stable, low-saturation, readable at 12px. */
    --uaps-a1: #e4ecfb; --uaps-a1-ink: #2f4d8f;
    --uaps-a2: #e6f2ec; --uaps-a2-ink: #256b53;
    --uaps-a3: #f6ebe3; --uaps-a3-ink: #8a5426;
    --uaps-a4: #efe9f7; --uaps-a4-ink: #5c4189;
    --uaps-a5: #e6f1f6; --uaps-a5-ink: #23697f;
    --uaps-a6: #f7e9ee; --uaps-a6-ink: #8d3a55;

    box-sizing: border-box;
    color: var(--uaps-ink);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "HarmonyOS Sans SC", "Microsoft YaHei", Roboto, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    background: var(--uaps-paper);
    text-align: left;
    isolation: isolate;
    color-scheme: light;
    -webkit-font-smoothing: antialiased;
}

/* Surfaces embedded in a light host page (the site widget and admin preview)
   stay light. Full-page desk and standalone chat may follow the OS. */
.uaps[data-scheme="light"] {
    color-scheme: light;
}

.uaps[data-scheme="auto"] {
    color-scheme: light dark;
}

/*
 * Dark mode only overrides tokens, and only on full-page surfaces that opted
 * in with `data-scheme="auto"`. The embedded widget stays light so it does not
 * punch a dark hole in a typical WordPress theme.
 */
@media (prefers-color-scheme: dark) {
    .uaps[data-scheme="auto"] {
        --uaps-soft: #232b42;
        --uaps-brand-line: #4a5b8f;
        --uaps-focus-ring: 0 0 0 3px #28335a;

        --uaps-ink: #ece8e1;
        --uaps-ink-2: #d6d1c8;
        --uaps-muted: #b0aa9e;
        --uaps-faint: #8f897e;

        --uaps-paper: #1b1916;
        --uaps-canvas: #161411;
        --uaps-surface: #26231f;
        --uaps-fill: #2e2a25;
        --uaps-line: #35312b;
        --uaps-line-soft: #2a2723;
        --uaps-line-strong: #4a453d;

        --uaps-success: #5fd0a0;
        --uaps-success-soft: #18302a;
        --uaps-warn: #e2bd84;
        --uaps-warn-soft: #2d2519;
        --uaps-warn-line: #4a3c26;
        --uaps-danger: #ff8f9d;
        --uaps-danger-soft: #36201f;
        --uaps-hit: #6b5317;

        --uaps-shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
        --uaps-shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 3px 8px -3px rgba(0, 0, 0, .45);
        --uaps-shadow-md: 0 14px 30px -10px rgba(0, 0, 0, .6), 0 4px 12px -4px rgba(0, 0, 0, .4);
        --uaps-shadow-lg: 0 30px 60px -18px rgba(0, 0, 0, .7), 0 12px 26px -12px rgba(0, 0, 0, .5);

        --uaps-a1: #22304d; --uaps-a1-ink: #a9c0ee;
        --uaps-a2: #1d3630; --uaps-a2-ink: #8fd0b7;
        --uaps-a3: #3a2c20; --uaps-a3-ink: #e0b48a;
        --uaps-a4: #2c2540; --uaps-a4-ink: #bfabe4;
        --uaps-a5: #1e313a; --uaps-a5-ink: #93c6d8;
        --uaps-a6: #372430; --uaps-a6-ink: #e2a3b8;
    }
}

/* System means UserHub appearance settings, independent of OS colour scheme. */
.uaps[data-accent="system"] {
    --uaps-brand: var(--uaps-system-brand, #4f46e5);
    --uaps-on-brand: #fff;
    --uaps-accent-ink: var(--uaps-brand);
    --uaps-soft: var(--uaps-paper);
    --uaps-brand-line: var(--uaps-brand);
    --uaps-focus-ring: 0 0 0 1px var(--uaps-brand);
    --uaps-a1: var(--uaps-brand); --uaps-a1-ink: #fff;
    --uaps-a2: var(--uaps-brand); --uaps-a2-ink: #fff;
    --uaps-a3: var(--uaps-brand); --uaps-a3-ink: #fff;
    --uaps-a4: var(--uaps-brand); --uaps-a4-ink: #fff;
    --uaps-a5: var(--uaps-brand); --uaps-a5-ink: #fff;
    --uaps-a6: var(--uaps-brand); --uaps-a6-ink: #fff;
}

/* ------------------------------------------------------------ primitives */

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

.uaps [hidden],
.uaps[hidden] {
    display: none !important;
}

.uaps button,
.uaps input,
.uaps select,
.uaps textarea {
    font: inherit;
    letter-spacing: normal;
    margin: 0;
}

.uaps button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-md);
    background: var(--uaps-paper);
    color: var(--uaps-ink);
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    text-transform: none;
    box-shadow: none;
    min-height: 34px;
    transition: background-color var(--uaps-dur-fast) var(--uaps-ease), border-color var(--uaps-dur-fast) var(--uaps-ease), color var(--uaps-dur-fast) var(--uaps-ease), opacity var(--uaps-dur-fast) var(--uaps-ease), box-shadow var(--uaps-dur-fast) var(--uaps-ease);
}

.uaps button:hover {
    background: var(--uaps-surface);
}

.uaps button:disabled {
    opacity: .45;
    cursor: default;
}

.uaps svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.uaps :focus-visible {
    outline: 2px solid var(--uaps-accent-ink, var(--uaps-brand));
    outline-offset: 2px;
}

.uaps a {
    color: var(--uaps-accent-ink, var(--uaps-brand));
    text-decoration: none;
}

.uaps a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.uaps h1,
.uaps h2,
.uaps h3,
.uaps p,
.uaps dl,
.uaps dd,
.uaps ul {
    margin: 0;
    padding: 0;
    font-family: inherit;
    letter-spacing: normal;
}

.uaps h1 { font-size: 17px; line-height: 1.35; font-weight: 650; letter-spacing: -.01em; }
.uaps h2 { font-size: 15px; line-height: 1.4; font-weight: 600; }
.uaps h3 { font-size: 14px; font-weight: 600; }

.uaps kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid var(--uaps-line-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--uaps-paper);
    color: var(--uaps-ink-2);
    font: 600 11px/1 ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
    white-space: nowrap;
}

.uaps button.uaps-primary {
    background: var(--uaps-brand);
    border-color: var(--uaps-brand);
    color: var(--uaps-on-brand);
    min-width: 72px;
    font-size: 13px;
    font-weight: 600;
}

/* The configured primary is used exactly; hovering never darkens it. */
.uaps button.uaps-primary:hover {
    background: var(--uaps-brand);
    filter: none;
}

.uaps .uaps-icon {
    width: 34px;
    min-width: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--uaps-r-md);
    background: transparent;
    color: var(--uaps-muted);
    flex-shrink: 0;
}

.uaps a.uaps-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
}

.uaps .uaps-icon:hover {
    background: var(--uaps-fill);
    color: var(--uaps-ink);
    text-decoration: none;
}

.uaps-sr,
.uaps-honeypot {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

/* ----------------------------------------------------------- containers */

.uaps-modal {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 704px;
    max-height: calc(100dvh - 48px);
    z-index: 100001;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-xl);
    box-shadow: var(--uaps-shadow-lg);
    overflow: hidden;
    /* Opening state is applied by script, then cleared on the next frame. */
    transform-origin: 100% 100%;
    transition: opacity var(--uaps-dur) var(--uaps-ease), transform var(--uaps-dur) var(--uaps-ease);
}

.uaps-modal[data-enter],
.uaps-modal[data-leave] {
    opacity: 0;
    transform: translateY(12px) scale(.98);
    pointer-events: none;
}

@media (max-width: 700px) {
    html.uaps-open { overflow: hidden; }
}

.uaps-page {
    margin: 0;
    background: #faf9f7;
}

.uaps-standalone {
    height: 100dvh;
    min-height: 320px;
}

.uaps-customer.uaps-standalone {
    max-width: 640px;
    margin: auto;
    box-shadow: none;
}

@media (min-width: 701px) and (min-height: 560px) {
    /* A standalone chat reads as one focused card on the warm canvas. */
    .uaps-customer.uaps-standalone {
        height: calc(100dvh - 48px);
        margin: 24px auto;
        border: 1px solid var(--uaps-line);
        border-radius: var(--uaps-r-xl);
        box-shadow: var(--uaps-shadow-md);
        overflow: hidden;
    }
}

@media (prefers-color-scheme: dark) {
    .uaps-page:has(.uaps[data-scheme="auto"]) {
        background: #110f0d;
    }
}

.uaps-chat {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    overflow: hidden;
    background: var(--uaps-paper);
}

/* ----------------------------------------------------------- chat header */

.uaps-chat-head {
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 68px;
    padding: 12px 12px 12px 18px;
    flex-shrink: 0;
    background: var(--uaps-paper);
    border-bottom: 1px solid var(--uaps-line);
}

.uaps-heading {
    flex: 1;
    min-width: 0;
}

/* The name keeps priority: status chips wrap below it rather than truncating it. */
.uaps-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
    min-width: 0;
}

.uaps-heading h2 {
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uaps-heading p {
    font-size: 12px;
    color: var(--uaps-muted);
    margin-top: 2px;
    white-space: pre-line;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.uaps-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    line-height: 0;
}

.uaps-avatar {
    width: 40px;
    height: 40px;
    /* Percentage keeps the squircle identical at every avatar size. */
    border-radius: 33%;
    background: var(--uaps-soft);
    color: var(--uaps-accent-ink, var(--uaps-brand));
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    overflow: hidden;
}

.uaps-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uaps-user-avatar > * { grid-area: 1 / 1; }
.uaps-user-avatar img { display: block; min-width: 0; min-height: 0; transition: opacity var(--uaps-dur) var(--uaps-ease); }

/* Presence reads as a status: the dot pairs with the written status line. */
.uaps-presence {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: none;
    width: 12px;
    height: 12px;
    border: 2px solid var(--uaps-paper);
    border-radius: 50%;
    background: var(--uaps-faint);
}

.uaps-customer[data-available] .uaps-presence { display: block; }
.uaps-customer[data-available="true"] .uaps-presence { background: var(--uaps-success); }
.uaps-customer[data-available="false"] .uaps-presence { background: var(--uaps-warn); }
.uaps-customer[data-available="true"] .uaps-heading p { color: var(--uaps-success); }

/* The visitor header keeps the reminder entry to an icon; its state and name stay readable. */
.uaps-chat-head .uaps-reminder-trigger [data-reminder-label] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.uaps-chat-head .uaps-reminder-trigger { width: 38px; padding: 0; }
.uaps-chat-head .uaps-reminder-trigger .uaps-reminder-dot { position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; box-shadow: 0 0 0 2px var(--uaps-paper); }

.uaps-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.uaps .uaps-thread-action {
    gap: 6px;
    min-height: 32px;
    padding: 0 12px 0 10px;
    border-color: var(--uaps-line);
    font-size: 12.5px;
}

.uaps .uaps-thread-action svg { width: 16px; height: 16px; }

/* Status chips: dot + text so state never depends on colour alone. */
.uaps-head-tags {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 6px;
    flex-shrink: 0;
}

.uaps-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--uaps-fill);
    color: var(--uaps-muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
}

.uaps-chip svg { width: 12px; height: 12px; }
.uaps-chip[data-tone="pending"] { background: var(--uaps-warn-soft); color: var(--uaps-warn); }
.uaps-chip[data-tone="open"] { background: var(--uaps-soft); color: var(--uaps-accent-ink, var(--uaps-brand)); box-shadow: inset 0 0 0 1px var(--uaps-brand-line); }
.uaps-chip[data-tone="closed"] { background: var(--uaps-fill); color: var(--uaps-faint); }
.uaps-chip[data-tone="pending"]::before,
.uaps-chip[data-tone="open"]::before,
.uaps-chip[data-tone="closed"]::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* --------------------------------------------------------- notice strips */

.uaps-context,
.uaps-status,
.uaps-update-notice {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin: 12px 16px 0;
    padding: 9px 12px;
    border: 1px solid var(--uaps-warn-line);
    border-radius: 12px;
    background: var(--uaps-warn-soft);
    color: var(--uaps-warn);
    font-size: 12.5px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-line;
    flex-shrink: 0;
}

.uaps-context::before,
.uaps-status::before {
    content: "";
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin-top: 7px;
    border-radius: 50%;
    background: currentColor;
}

.uaps-context {
    max-height: 92px;
    overflow: auto;
}

.uaps-status {
    max-height: 100px;
    overflow: auto;
}

.uaps-update-notice {
    border-color: var(--uaps-line);
    background: var(--uaps-surface);
    color: var(--uaps-muted);
}

.uaps-history {
    text-align: center;
}

.uaps .uaps-history button {
    margin: 10px auto 0;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--uaps-muted);
    font-size: 12px;
}

/* ------------------------------------------------------------- transcript */

.uaps-messages {
    flex: 1;
    overflow: auto;
    min-height: 64px;
    padding: 18px 18px 8px;
    background: var(--uaps-paper);
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--uaps-line-strong) transparent;
}

.uaps-empty {
    padding: 36px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--uaps-muted);
    white-space: pre-line;
}

/* Day separators: dates keep the full 2026/9/7 form; messages show the time. */
.uaps-day {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 16px;
    color: var(--uaps-faint);
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}

.uaps-day::before,
.uaps-day::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--uaps-line-soft);
}

.uaps-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 12px 28px;
    max-width: 360px;
    margin: auto;
}

.uaps .uaps-welcome-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 33%;
    overflow: hidden;
    box-shadow: 0 0 0 6px var(--uaps-surface);
}

.uaps-welcome-avatar > * { grid-area: 1 / 1; }
.uaps-welcome-avatar img { width: 100%; height: 100%; object-fit: cover; }

.uaps-welcome h3 {
    margin-top: 20px;
    font-size: 19px;
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: -.01em;
    white-space: pre-line;
    overflow-wrap: anywhere;
    text-wrap: balance;
    color: var(--uaps-ink);
}

.uaps .uaps-welcome-hours {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 5px 11px 5px 9px;
    border-radius: 999px;
    background: var(--uaps-surface);
    color: var(--uaps-muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.uaps-welcome-hours svg { width: 14px; height: 14px; color: var(--uaps-faint); }

/*
 * Message clusters. Script sets `data-group` to start / middle / end /
 * single; CSS tightens spacing and hides repeated timestamps so a burst of
 * messages reads as one turn. A bubble keeps its shape when its group changes.
 */
.uaps-msg {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0 0 16px;
}

.uaps-msg[data-group="start"],
.uaps-msg[data-group="middle"] {
    margin-bottom: 4px;
}

.uaps-msg.is-mine {
    align-items: flex-end;
}

.uaps-msg[data-enter] {
    animation: uaps-msg-in var(--uaps-dur) var(--uaps-ease) both;
}

@keyframes uaps-msg-in {
    from { opacity: 0; transform: translateY(6px); }
}

.uaps-bubble {
    border: 0;
    max-width: 82%;
    padding: 9px 13px;
    background: var(--uaps-surface);
    color: var(--uaps-ink);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.6;
    /* Stable incoming silhouette, including while messages are regrouped. */
    border-radius: var(--uaps-r-bubble) var(--uaps-r-bubble) var(--uaps-r-bubble) var(--uaps-r-tight);
}

/* Outgoing carries the brand fill: the only large colour area in the UI, and
   the fastest way to tell the two sides apart. Mirror the incoming silhouette. */
.uaps-msg.is-mine > .uaps-bubble {
    background: var(--uaps-brand);
    color: var(--uaps-on-brand);
    border-radius: var(--uaps-r-bubble) var(--uaps-r-bubble) var(--uaps-r-tight) var(--uaps-r-bubble);
}

/* Visitors see who answers: the support avatar closes each incoming cluster. */
.uaps-customer .uaps-msg:not(.is-mine) {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 8px;
    align-items: end;
    justify-items: start;
}

.uaps-customer .uaps-msg:not(.is-mine) > :not(.uaps-msg-avatar) { grid-column: 2; }
.uaps-customer .uaps-msg:not(.is-mine) > .uaps-bubble { max-width: 88%; }

.uaps .uaps-msg-avatar {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 33%;
    overflow: hidden;
    visibility: hidden;
}

.uaps-msg-avatar > * { grid-area: 1 / 1; }
.uaps-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.uaps-msg[data-group="end"] > .uaps-msg-avatar,
.uaps-msg[data-group="single"] > .uaps-msg-avatar { visibility: visible; }

/* Media keeps its own silhouette. Only text messages use coloured bubbles. */
.uaps .uaps-msg[data-kind="image"] > .uaps-bubble,
.uaps .uaps-msg[data-kind="emoji"] > .uaps-bubble {
    padding: 0;
    background: transparent;
    color: var(--uaps-ink);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
.uaps .uaps-msg[data-kind="image"] > .uaps-bubble { width: var(--uaps-image-width, 280px); max-width: 82%; }
.uaps-image-caption { padding: 7px 2px 0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.uaps .uaps-msg[data-kind="emoji"] > .uaps-bubble { padding: 3px 2px; font-size: 24px; line-height: 1.4; }
.uaps .uaps-msg[data-kind="emoji"][data-emoji-size="large"] > .uaps-bubble { font-size: 36px; }

.uaps-msg-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 5px 2px 0;
    font-size: 11px;
    color: var(--uaps-faint);
    font-variant-numeric: tabular-nums;
}

.uaps-msg time {
    font-size: inherit;
    color: inherit;
    margin: 0;
    font-variant-numeric: inherit;
}

.uaps-receipt {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: inherit;
    color: var(--uaps-accent-ink, var(--uaps-brand));
    font-weight: 600;
}

.uaps-receipt::before {
    content: "";
    width: 9px;
    height: 5px;
    margin-top: -3px;
    border-left: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
}

.uaps-msg[data-group="start"] time,
.uaps-msg[data-group="middle"] time {
    display: none;
}

.uaps-msg[data-group="start"]:not(.has-receipt) > .uaps-msg-meta,
.uaps-msg[data-group="middle"]:not(.has-receipt) > .uaps-msg-meta {
    display: none;
}

.uaps-customer .uaps-receipt {
    display: none;
}

/* Optimistic echo while the request is in flight. */
.uaps-msg[data-state="sending"] {
    opacity: .6;
}

/* Desk messages flow as a row so the copy action sits right beside its bubble. */
.uaps-desk .uaps-msg {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    column-gap: 6px;
}

.uaps-desk .uaps-msg.is-mine { justify-content: flex-end; }
.uaps-desk .uaps-msg > .uaps-msg-meta { order: 2; flex-basis: 100%; }
.uaps-desk .uaps-msg.is-mine > .uaps-msg-meta { justify-content: flex-end; }
.uaps-desk .uaps-msg.is-mine > .uaps-copy { order: -1; }

/* Desk-only copy action, revealed beside the hovered or focused message. */
.uaps .uaps-copy {
    flex-shrink: 0;
    margin-top: 4px;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-sm);
    background: var(--uaps-paper);
    color: var(--uaps-faint);
    box-shadow: var(--uaps-shadow-xs);
    opacity: 0;
    pointer-events: none;
}

.uaps .uaps-copy svg { width: 14px; height: 14px; }
.uaps .uaps-copy:hover { color: var(--uaps-ink); background: var(--uaps-paper); }
.uaps .uaps-copy[data-copied] { color: var(--uaps-success); }
.uaps .uaps-msg:hover > .uaps-copy,
.uaps .uaps-copy:focus-visible,
.uaps .uaps-copy[data-copied] { opacity: 1; pointer-events: auto; }

.uaps .uaps-new-messages {
    align-self: center;
    min-height: 30px;
    margin: -38px 12px 8px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--uaps-accent-ink, var(--uaps-brand));
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    box-shadow: var(--uaps-shadow-md);
}

/* ------------------------------------------------------- contact details */

.uaps-contact {
    margin: 0 16px 10px;
    padding: 0;
    font-size: 12px;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-lg);
    flex-shrink: 0;
    max-height: 32dvh;
    overflow: auto;
    background: var(--uaps-canvas);
}

.uaps-contact.is-required {
    border-color: var(--uaps-warn-line);
    background: var(--uaps-warn-soft);
}

.uaps-contact-head {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 0 4px 0 12px;
}

.uaps-contact-icon {
    display: inline-flex;
    color: var(--uaps-faint);
}

.uaps-contact-icon svg { width: 15px; height: 15px; }
.uaps-contact.is-required .uaps-contact-icon { color: var(--uaps-warn); }

.uaps-contact-preview {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--uaps-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uaps-contact-form {
    margin: 0;
    padding: 2px 12px 12px;
}

.uaps .uaps-contact-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 8px;
    border: 0;
    border-radius: var(--uaps-r-md);
    background: transparent;
    box-shadow: none;
    color: var(--uaps-ink);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

.uaps .uaps-contact-preview[hidden] + .uaps-contact-toggle { flex: 1; }
.uaps .uaps-contact-preview:not([hidden]) + .uaps-contact-toggle { color: var(--uaps-accent-ink, var(--uaps-brand)); }
.uaps .uaps-contact-toggle:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.uaps .uaps-contact-toggle:focus-visible { outline: 2px solid var(--uaps-brand); outline-offset: -3px; }
.uaps-contact-toggle svg { width: 14px; height: 14px; color: var(--uaps-faint); transition: transform var(--uaps-dur-fast) var(--uaps-ease); }
.uaps-contact-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

.uaps-contact-fields {
    display: grid;
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
    gap: 8px;
}

.uaps-contact label {
    display: block;
    margin-top: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--uaps-muted);
}

.uaps-contact input {
    width: 100%;
    margin-top: 4px;
    padding: 6px 10px;
    border: 1px solid var(--uaps-line-strong);
    border-radius: var(--uaps-r-sm);
    background: var(--uaps-paper);
    color: var(--uaps-ink);
    min-height: 34px;
    box-shadow: none;
    line-height: 1.5;
    transition: border-color var(--uaps-dur-fast) var(--uaps-ease), box-shadow var(--uaps-dur-fast) var(--uaps-ease);
}

.uaps-contact input::placeholder { color: var(--uaps-faint); }

.uaps-contact input:focus {
    outline: 0;
    border-color: var(--uaps-accent-ink, var(--uaps-brand));
    box-shadow: var(--uaps-focus-ring);
}

.uaps-contact input[aria-invalid="true"] {
    border-color: var(--uaps-danger);
}

.uaps-contact-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.uaps-contact-actions [data-contact-feedback] {
    flex: 1;
    min-width: 0;
    color: var(--uaps-faint);
    font-size: 11.5px;
    overflow-wrap: anywhere;
}

.uaps-contact-actions [data-state="error"] {
    color: var(--uaps-danger);
}

.uaps .uaps-contact-actions button {
    min-height: 32px;
    padding: 0 12px 0 10px;
    font-size: 12px;
    flex-shrink: 0;
    border-color: var(--uaps-line-strong);
}

.uaps .uaps-contact-actions button svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- composer */
.uaps .uaps-send-allowance { margin: 0 4px 8px; font-size: 12px; line-height: 1.6; color: var(--uaps-muted); }
.uaps .uaps-send-allowance[data-blocked="true"] { color: var(--uaps-warn); }

.uaps-compose {
    padding: 0 16px 12px;
    background: var(--uaps-paper);
    margin: 0;
    flex-shrink: 0;
}

/* One composer frame holds the text, the tools and the send action. */
.uaps-editor {
    position: relative;
    border: 1px solid var(--uaps-line-strong);
    border-radius: var(--uaps-r-lg);
    padding: 10px 10px 8px 12px;
    background: var(--uaps-paper);
    box-shadow: none;
    transition: border-color var(--uaps-dur-fast) var(--uaps-ease), box-shadow var(--uaps-dur-fast) var(--uaps-ease);
}

.uaps .uaps-editor:focus-within {
    outline: 0;
    border-color: var(--uaps-accent-ink, var(--uaps-brand));
    box-shadow: var(--uaps-focus-ring);
}

.uaps .uaps-editor textarea:focus-visible {
    outline: 0;
}

.uaps-compose textarea {
    display: block;
    width: 100%;
    min-height: 46px;
    max-height: min(200px, 28dvh);
    resize: none;
    overflow-y: hidden;
    border: 0;
    border-radius: 5px;
    box-shadow: none;
    background: transparent;
    color: var(--uaps-ink);
    padding: 1px 2px;
    line-height: 1.6;
}

.uaps-compose textarea::placeholder { color: var(--uaps-faint); }
.uaps-compose textarea:disabled { cursor: not-allowed; }

/* Static on purpose: emoji and quick-reply popovers anchor to the whole composer frame. */
.uaps-compose-bottom {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--uaps-faint);
    font-size: 11px;
    margin-top: 6px;
    position: static;
}

.uaps-compose-bottom [data-count] {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.uaps .uaps-compose-bottom > button.uaps-primary {
    min-height: 32px;
    min-width: 0;
    padding: 0 10px 0 13px;
    border-radius: var(--uaps-r-md);
    gap: 5px;
}

.uaps .uaps-compose-bottom > button.uaps-primary svg { width: 16px; height: 16px; }
.uaps-compose-bottom [data-count] + button.uaps-primary { margin-left: 4px; }
.uaps-compose-bottom [data-count][hidden] + button.uaps-primary { margin-left: auto; }
.uaps [data-count][data-over="true"] { color: var(--uaps-danger); font-weight: 600; }

/* Native emoji and private image controls share the compact composer. */
.uaps-media-tools { display: flex; flex: 0 0 auto; gap: 2px; margin-left: -4px; }
.uaps .uaps-media-tools > button { width: 32px; min-width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: var(--uaps-r-sm); background: transparent; color: var(--uaps-faint); }
.uaps .uaps-media-tools > button:hover,
.uaps .uaps-media-tools > button[aria-expanded="true"] { color: var(--uaps-accent-ink, var(--uaps-brand)); background: var(--uaps-fill); }
.uaps-emoji-panel { position: absolute; z-index: 5; bottom: calc(100% + 8px); left: 0; width: 264px; max-width: calc(100vw - 48px); padding: 10px; border: 1px solid var(--uaps-line); border-radius: var(--uaps-r-lg); background: var(--uaps-paper); box-shadow: var(--uaps-shadow-md); }
.uaps-emoji-panel > span { display: block; margin: 0 0 6px 4px; font-size: 11px; font-weight: 500; color: var(--uaps-faint); }
.uaps [data-emoji-list] { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.uaps [data-emoji] { min-width: 0; min-height: 36px; padding: 3px; border: 0; border-radius: var(--uaps-r-sm); background: transparent; font-size: 22px; line-height: 1; }
.uaps [data-emoji]:hover { background: var(--uaps-surface); }
.uaps-attachment { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; margin: 0 0 8px -2px; background: var(--uaps-surface); border-radius: var(--uaps-r-md); }
.uaps-attachment > img { width: 44px; height: 44px; object-fit: cover; border-radius: var(--uaps-r-sm); }
.uaps-attachment > div { flex: 1; min-width: 0; }
.uaps-attachment strong { display: block; font-size: 12px; font-weight: 600; }
.uaps-attachment small { display: block; font-size: 11px; color: var(--uaps-muted); font-variant-numeric: tabular-nums; }
.uaps .uaps-attachment > button { border: 0; background: transparent; color: var(--uaps-muted); }
.uaps .uaps-message-image { display: block; width: 100%; max-width: 100%; max-height: 300px; min-height: 72px; padding: 0; margin: 0; overflow: hidden; border: 0; border-radius: 14px; background: transparent; color: var(--uaps-muted); font-size: 12px; cursor: zoom-in; }
.uaps .uaps-message-image:hover { background: transparent; }
.uaps .uaps-message-image[data-image-state="waiting"],
.uaps .uaps-message-image[data-image-state="loading"],
.uaps .uaps-message-image[data-image-state="error"] { background: var(--uaps-surface); }
.uaps .uaps-message-image:disabled { opacity: 1; }
.uaps-message-image img { display: block; width: 100%; height: 100%; max-height: 300px; object-fit: contain; }
.uaps-image-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; min-height: 72px; height: 100%; padding: 12px; }
.uaps .uaps-image-placeholder svg { width: 25px; height: 25px; opacity: .65; }
.uaps [data-image-state="loading"] .uaps-image-placeholder svg { animation: uaps-image-pulse 1.5s ease-in-out infinite alternate; }
@keyframes uaps-image-pulse { to { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .uaps [data-image-state="loading"] .uaps-image-placeholder svg { animation: none; } }
.uaps .uaps-image-viewer { --uaps-viewer-top: max(72px, calc(env(safe-area-inset-top, 0px) + 60px)); --uaps-viewer-bottom: max(20px, env(safe-area-inset-bottom, 0px)); position: fixed; inset: 0; box-sizing: border-box; margin: 0; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; padding: var(--uaps-viewer-top) max(16px, env(safe-area-inset-right, 0px)) var(--uaps-viewer-bottom) max(16px, env(safe-area-inset-left, 0px)); border: 0; border-radius: 0; background: transparent; color: #fff; box-shadow: none; overflow: hidden; }
.uaps .uaps-image-viewer[open] { display: flex; align-items: center; justify-content: center; }
.uaps-image-viewer::backdrop { background: rgba(12, 10, 9, .9); }
.uaps .uaps-image-viewer > img { display: block; flex: 0 1 auto; min-width: 0; width: auto; height: auto; max-width: 100%; max-height: calc(100vh - var(--uaps-viewer-top) - var(--uaps-viewer-bottom)); max-height: calc(100dvh - var(--uaps-viewer-top) - var(--uaps-viewer-bottom)); object-fit: contain; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.uaps .uaps-image-close { position: fixed; top: max(12px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: 44px; height: 44px; min-height: 44px; padding: 10px; border: 0; border-radius: 50%; background: transparent; color: #fff; box-shadow: none; }
.uaps .uaps-image-close:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.uaps .uaps-image-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 1200px) {
    .uaps-quick > button > span { display: none; }
    .uaps .uaps-quick > button { width: 32px; padding: 0; }
}
@media (max-width: 380px) {
    .uaps .uaps-media-tools > button { width: 30px; min-width: 30px; }
    .uaps-compose-bottom { gap: 4px; }
}

.uaps-compose-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 0;
    font-size: 11px;
    color: var(--uaps-faint);
    margin-top: 6px;
    padding: 0 4px;
}

.uaps-compose-hint [data-compose-hint]:empty { display: none; }

.uaps-compose-hint button {
    border: 0;
    padding: 0;
    min-height: 0;
    background: transparent;
    color: var(--uaps-accent-ink, var(--uaps-brand));
    font-size: inherit;
}

.uaps-compose-hint button:hover {
    background: transparent;
    text-decoration: underline;
}

.uaps-compose-hint small {
    margin-left: auto;
    font: inherit;
    white-space: nowrap;
}

.uaps-send-feedback {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--uaps-success);
    margin: 0 4px 8px;
    overflow-wrap: anywhere;
}

.uaps-send-feedback[data-state="error"] {
    color: var(--uaps-danger);
}

.uaps-send-feedback span {
    flex: 1;
    min-width: 0;
}

.uaps .uaps-send-feedback button {
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
    flex-shrink: 0;
}

.uaps .uaps-footnote {
    font-size: 11px;
    color: var(--uaps-faint);
    padding: 0 22px 12px;
    text-align: center;
    line-height: 1.65;
}

/* ================================================================== desk */

.uaps-desk {
    display: grid;
    grid-template-columns: 304px minmax(0, 1fr);
    max-width: 1720px;
    margin: auto;
    background: var(--uaps-paper);
}

.uaps-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-right: 1px solid var(--uaps-line);
    background: var(--uaps-canvas);
}

.uaps-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 12px 14px 16px;
}

.uaps-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.uaps-brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 33%;
    background: var(--uaps-brand);
    color: var(--uaps-on-brand);
}

.uaps-brand-mark svg { width: 20px; height: 20px; }

.uaps-sidebar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.uaps-eyebrow {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--uaps-faint);
    display: block;
    margin-bottom: 1px;
}

.uaps-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 12px 16px;
}

.uaps-tools [data-action="availability"] {
    white-space: nowrap;
    margin-right: auto;
}

.uaps .uaps-availability {
    gap: 7px;
    min-height: 32px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--uaps-line);
    border-radius: 999px;
    background: var(--uaps-paper);
    color: var(--uaps-warn);
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--uaps-shadow-xs);
}

.uaps .uaps-availability:hover {
    background: var(--uaps-paper);
    border-color: var(--uaps-line-strong);
}

.uaps .uaps-availability svg { width: 15px; height: 15px; }

.uaps .uaps-availability[aria-pressed="true"] {
    color: var(--uaps-success);
    border-color: var(--uaps-success);
}

.uaps-tools [data-action="notifications"] {
    font-size: 11.5px;
}

.uaps-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 12px 10px;
    color: var(--uaps-faint);
}

.uaps-search > svg {
    position: absolute;
    left: 11px;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.uaps-search input {
    width: 100%;
    height: 36px;
    padding: 0 34px 0 34px;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-md);
    background: var(--uaps-paper);
    color: var(--uaps-ink);
    font-size: 13px;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color var(--uaps-dur-fast) var(--uaps-ease), box-shadow var(--uaps-dur-fast) var(--uaps-ease);
}

.uaps-search input::placeholder { color: var(--uaps-faint); }

.uaps-search input:focus {
    outline: 0;
    border-color: var(--uaps-accent-ink, var(--uaps-brand));
    box-shadow: var(--uaps-focus-ring);
}

.uaps-search kbd {
    position: absolute;
    right: 9px;
    pointer-events: none;
}

.uaps-search input:focus ~ kbd,
.uaps-search input:not(:placeholder-shown) ~ kbd { display: none; }

/* Segmented status filter: the selected state is a raised paper chip. */
.uaps-tabs {
    display: flex;
    gap: 2px;
    margin: 0 12px 8px;
    padding: 3px;
    border-radius: 11px;
    background: var(--uaps-fill);
    /* Long translations scroll instead of clipping a filter. */
    overflow-x: auto;
    scrollbar-width: none;
}

.uaps-tabs::-webkit-scrollbar { display: none; }

.uaps .uaps-tabs button {
    flex: 1;
    gap: 5px;
    min-height: 30px;
    padding: 0 6px;
    border: 0;
    border-radius: var(--uaps-r-sm);
    background: transparent;
    color: var(--uaps-muted);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}

.uaps .uaps-tabs button:hover {
    background: transparent;
    color: var(--uaps-ink);
}

.uaps .uaps-tabs [aria-pressed="true"],
.uaps .uaps-tabs [aria-pressed="true"]:hover {
    background: var(--uaps-paper);
    color: var(--uaps-ink);
    font-weight: 600;
    box-shadow: var(--uaps-shadow-sm);
}

/* Queue counts read as counts, not as part of the label. */
.uaps-count {
    display: inline-block;
    min-width: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--uaps-brand);
    color: var(--uaps-on-brand);
    font-size: 10px;
    font-weight: 600;
    line-height: 17px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.uaps-list {
    flex: 1;
    overflow: auto;
    padding: 2px 8px 8px;
}

.uaps .uaps-list button {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 10px;
    align-items: start;
    text-align: left;
    width: 100%;
    padding: 10px 10px;
    border: 1px solid transparent;
    background: transparent;
    position: relative;
    margin-bottom: 2px;
    border-radius: 12px;
    min-height: 0;
    font-weight: 400;
}

.uaps .uaps-list button:hover {
    background: var(--uaps-fill);
}

.uaps .uaps-list button[aria-current="true"] {
    background: var(--uaps-soft);
    border-color: var(--uaps-brand-line);
    box-shadow: none;
}

.uaps-list .uaps-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
    font-weight: 600;
    background: var(--uaps-a1);
    color: var(--uaps-a1-ink);
}

.uaps-list .uaps-avatar[data-tone="2"] { background: var(--uaps-a2); color: var(--uaps-a2-ink); }
.uaps-list .uaps-avatar[data-tone="3"] { background: var(--uaps-a3); color: var(--uaps-a3-ink); }
.uaps-list .uaps-avatar[data-tone="4"] { background: var(--uaps-a4); color: var(--uaps-a4-ink); }
.uaps-list .uaps-avatar[data-tone="5"] { background: var(--uaps-a5); color: var(--uaps-a5-ink); }
.uaps-list .uaps-avatar[data-tone="6"] { background: var(--uaps-a6); color: var(--uaps-a6-ink); }

.uaps-desk .uaps-chat-head .uaps-avatar[data-tone="1"] { background: var(--uaps-a1); color: var(--uaps-a1-ink); }
.uaps-desk .uaps-chat-head .uaps-avatar[data-tone="2"] { background: var(--uaps-a2); color: var(--uaps-a2-ink); }
.uaps-desk .uaps-chat-head .uaps-avatar[data-tone="3"] { background: var(--uaps-a3); color: var(--uaps-a3-ink); }
.uaps-desk .uaps-chat-head .uaps-avatar[data-tone="4"] { background: var(--uaps-a4); color: var(--uaps-a4-ink); }
.uaps-desk .uaps-chat-head .uaps-avatar[data-tone="5"] { background: var(--uaps-a5); color: var(--uaps-a5-ink); }
.uaps-desk .uaps-chat-head .uaps-avatar[data-tone="6"] { background: var(--uaps-a6); color: var(--uaps-a6-ink); }

.uaps-list-main {
    min-width: 0;
}

.uaps-list-head,
.uaps-list-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.uaps-list-foot {
    margin-top: 3px;
}

.uaps-list strong {
    min-width: 0;
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uaps-list .uaps-list-tag {
    flex-shrink: 0;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--uaps-paper);
    box-shadow: inset 0 0 0 1px var(--uaps-line);
    color: var(--uaps-faint);
    font-size: 10.5px;
    font-weight: 500;
    line-height: 17px;
    white-space: nowrap;
}

.uaps-list-head > :last-child {
    margin-left: auto;
}

.uaps-list time {
    flex-shrink: 0;
    color: var(--uaps-faint);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.uaps-wait {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 3px;
    color: var(--uaps-faint);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.uaps-wait svg { width: 12px; height: 12px; }
.uaps-wait[data-attention="true"] { color: var(--uaps-warn); font-weight: 600; }
.uaps-list .uaps-wait[data-attention="true"] { padding: 0 6px; border-radius: 999px; background: var(--uaps-warn-soft); line-height: 18px; }

.uaps-list .uaps-preview {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    color: var(--uaps-muted);
}

.uaps-draft-tag {
    margin-right: 4px;
    color: var(--uaps-danger);
    font-weight: 600;
}

/* Search results get two lines so the marked words keep some context. */
.uaps-list .uaps-preview.is-match {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.uaps mark.uaps-hit {
    padding: 0 1px;
    border-radius: 3px;
    background: var(--uaps-hit);
    color: inherit;
}

/* On the solid accent bubble (text only; media sits on the paper) a white chip keeps hits readable in any accent. */
.uaps .uaps-msg.is-mine:not([data-kind]) > .uaps-bubble mark.uaps-hit {
    background: #fff;
    color: #1c1917;
}

.uaps-msg[data-focus] > .uaps-bubble {
    animation: uaps-hit-focus 1.8s var(--uaps-ease) both;
}

@keyframes uaps-hit-focus {
    0%, 40% { box-shadow: 0 0 0 3px var(--uaps-hit); }
    100% { box-shadow: 0 0 0 3px transparent; }
}

.uaps .uaps-list button.is-unread strong {
    color: var(--uaps-ink);
}

.uaps .uaps-list button.is-unread .uaps-preview {
    color: var(--uaps-ink);
    font-weight: 500;
}

.uaps-unread {
    flex-shrink: 0;
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--uaps-brand);
    color: var(--uaps-on-brand);
    font-size: 10px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.uaps-list .uaps-empty {
    padding: 40px 16px;
    color: var(--uaps-faint);
}

.uaps-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px 12px;
    font-size: 12px;
    color: var(--uaps-muted);
    font-variant-numeric: tabular-nums;
    border-top: 1px solid var(--uaps-line-soft);
}

.uaps .uaps-pagination .uaps-icon {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
}

.uaps .uaps-mobile-back {
    display: none;
}

/* Nothing selected yet: one calm empty state instead of a disabled composer. */
.uaps-desk-empty {
    display: none;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 32px 24px 56px;
    text-align: center;
}

.uaps-desk:not(.is-selected) .uaps-desk-empty { display: flex; }
.uaps-desk:not(.is-selected) :is(.uaps-chat-head, .uaps-context, .uaps-history, .uaps-messages, .uaps-new-messages, .uaps-compose) { display: none; }
.uaps-desk:not(.is-selected) :is(.uaps-status, .uaps-update-notice) { order: -1; }

.uaps-desk-empty-mark {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
    border-radius: 33%;
    background: var(--uaps-surface);
    color: var(--uaps-faint);
}

.uaps-desk-empty-mark svg { width: 28px; height: 28px; }
.uaps-desk-empty h2 { font-size: 17px; }
.uaps-desk-empty p { max-width: 340px; color: var(--uaps-muted); font-size: 13px; }

.uaps .uaps-desk-empty-stats {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.uaps-desk-empty-stats > div {
    min-width: 116px;
    padding: 10px 16px;
    border: 1px solid var(--uaps-line);
    border-radius: 12px;
    background: var(--uaps-paper);
    text-align: left;
}

.uaps-desk-empty-stats dt { color: var(--uaps-muted); font-size: 12px; }
.uaps-desk-empty-stats dd { margin-top: 2px; font-size: 22px; font-weight: 650; line-height: 1.3; font-variant-numeric: tabular-nums; }

.uaps .uaps-desk-empty-keys {
    display: grid;
    gap: 8px;
    margin-top: 24px;
    list-style: none;
    color: var(--uaps-muted);
    font-size: 12px;
}

.uaps-desk-empty-keys li {
    display: grid;
    grid-template-columns: 76px auto;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.uaps-desk-empty-keys li > span {
    display: inline-flex;
    justify-content: flex-end;
    gap: 3px;
}

.uaps-desk .uaps-chat-head {
    min-height: 72px;
    padding: 14px 16px 14px 24px;
}

.uaps-desk .uaps-messages {
    padding: 24px 32px 8px;
}

.uaps-desk .uaps-bubble,
.uaps-desk .uaps-msg[data-kind="image"] > .uaps-bubble {
    max-width: min(72%, 640px);
}

.uaps-desk .uaps-compose {
    padding: 0 24px 16px;
}

.uaps-desk .uaps-compose textarea {
    min-height: 66px;
}

/* --------------------------------------------------------- quick replies */

.uaps-quick { position: static; }

.uaps .uaps-quick > button {
    gap: 5px;
    min-height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--uaps-r-sm);
    color: var(--uaps-faint);
    font-size: 12px;
    background: transparent;
}

.uaps .uaps-quick > button svg { width: 16px; height: 16px; }

.uaps .uaps-quick > button:hover,
.uaps .uaps-quick > button[aria-expanded="true"] {
    background: var(--uaps-fill);
    color: var(--uaps-accent-ink, var(--uaps-brand));
}

.uaps-quick-panel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 360px;
    max-width: calc(100vw - 48px);
    padding: 6px;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-lg);
    background: var(--uaps-paper);
    box-shadow: var(--uaps-shadow-md);
    z-index: 5;
}

.uaps-quick-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px 8px;
}

.uaps-quick-head strong { color: var(--uaps-ink); font-size: 12.5px; }
.uaps-quick-head a { font-size: 12px; }

.uaps-quick-panel label {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 2px 6px;
    color: var(--uaps-faint);
}

.uaps-quick-panel label svg {
    position: absolute;
    left: 9px;
    width: 15px;
    height: 15px;
}

.uaps-quick-panel input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 30px;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-sm);
    color: var(--uaps-ink);
    background: var(--uaps-canvas);
    font-size: 12.5px;
}

.uaps-quick-panel input:focus {
    outline: 0;
    border-color: var(--uaps-accent-ink, var(--uaps-brand));
    box-shadow: var(--uaps-focus-ring);
}

.uaps-quick-panel [data-quick-list] {
    max-height: min(280px, 32dvh);
    overflow: auto;
    overscroll-behavior: contain;
}

.uaps .uaps-quick-panel [data-quick-list] button {
    display: block;
    width: 100%;
    min-height: 0;
    text-align: left;
    white-space: normal;
    border: 0;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--uaps-r-md);
}

.uaps .uaps-quick-panel [data-quick-list] button:hover,
.uaps .uaps-quick-panel [data-quick-list] button:focus-visible {
    background: var(--uaps-surface);
}

.uaps .uaps-quick-panel [data-quick-list] button:focus-visible {
    outline-offset: -2px;
}

.uaps-quick-panel button small {
    display: block;
    margin-top: 2px;
    color: var(--uaps-muted);
    font-size: 12px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uaps .uaps-quick-empty {
    padding: 18px 12px;
    font-size: 12px;
    text-align: center;
    color: var(--uaps-faint);
}

/* ------------------------------------------------------ contact details */

.uaps .uaps-details {
    width: 340px;
    max-width: calc(100vw - 24px);
    max-height: 90dvh;
    margin: auto;
    padding: 0;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-xl);
    background: var(--uaps-paper);
    color: var(--uaps-ink);
    font: inherit;
    box-shadow: var(--uaps-shadow-lg);
    overflow: auto;
}

.uaps .uaps-details::backdrop {
    background: rgba(28, 25, 23, .36);
}

.uaps-details > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 12px 14px 18px;
    border-bottom: 1px solid var(--uaps-line);
    position: sticky;
    top: 0;
    background: var(--uaps-paper);
    z-index: 1;
}

.uaps-details > header h2 { font-size: 14px; }
.uaps-details > header .uaps-eyebrow { letter-spacing: .02em; }

.uaps-details [data-details-body] {
    padding: 0 18px 18px;
    overflow-wrap: anywhere;
}

.uaps-detail-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0 2px;
}

.uaps-detail-profile .uaps-avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
    background: var(--uaps-a1);
    color: var(--uaps-a1-ink);
}

.uaps-detail-profile .uaps-avatar[data-tone="2"] { background: var(--uaps-a2); color: var(--uaps-a2-ink); }
.uaps-detail-profile .uaps-avatar[data-tone="3"] { background: var(--uaps-a3); color: var(--uaps-a3-ink); }
.uaps-detail-profile .uaps-avatar[data-tone="4"] { background: var(--uaps-a4); color: var(--uaps-a4-ink); }
.uaps-detail-profile .uaps-avatar[data-tone="5"] { background: var(--uaps-a5); color: var(--uaps-a5-ink); }
.uaps-detail-profile .uaps-avatar[data-tone="6"] { background: var(--uaps-a6); color: var(--uaps-a6-ink); }
.uaps-detail-profile > div { min-width: 0; }
.uaps-detail-profile strong { display: block; overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.uaps-detail-profile span:not(.uaps-avatar) { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }

.uaps-details section {
    padding-top: 18px;
}

.uaps-details section + section {
    border-top: 1px solid var(--uaps-line-soft);
    margin-top: 18px;
}

.uaps-details h3 {
    margin-bottom: 4px;
    color: var(--uaps-ink-2);
    font-size: 12px;
    font-weight: 600;
}

.uaps-details dl {
    margin: 0;
    font-size: 13px;
}

.uaps-details dt {
    margin-top: 12px;
    font-size: 11.5px;
    color: var(--uaps-faint);
}

.uaps-details dd {
    margin: 3px 0 0;
    white-space: pre-wrap;
}

.uaps .uaps-details-note {
    padding: 12px 18px;
    background: var(--uaps-canvas);
    border-top: 1px solid var(--uaps-line-soft);
    font-size: 11px;
    line-height: 1.6;
    color: var(--uaps-faint);
}

.uaps .uaps-profile-link { text-decoration: underline; text-underline-offset: 3px; }
.uaps .uaps-profile-link::after { content: '↗'; display: inline-block; margin-left: 4px; font-size: 11px; }

/* Scroll gestures stay in the region being read, including at either end. */
.uaps-messages,
.uaps-list,
.uaps .uaps-details,
.uaps-details [data-details-body] {
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--uaps-line-strong) transparent;
}
.uaps-details [data-details-body]::-webkit-scrollbar { width: 5px; }
.uaps-details [data-details-body]::-webkit-scrollbar-thumb { background: var(--uaps-line-strong); border-radius: 8px; }

/* -------------------------------------------------- dialogs: shortcuts */

.uaps .uaps-shortcuts,
.uaps .uaps-reminders {
    position: fixed;
    inset: 0;
    width: 400px;
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 18px 20px 20px;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-xl);
    background: var(--uaps-paper);
    color: var(--uaps-ink);
    box-shadow: var(--uaps-shadow-lg);
    font: inherit;
    overflow: auto;
    overscroll-behavior: contain;
}

.uaps-shortcuts::backdrop,
.uaps-reminders::backdrop { background: rgba(28, 25, 23, .36); }

.uaps-shortcuts header,
.uaps-reminders header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.uaps-shortcuts header h2,
.uaps-reminders header h2 { flex: 1; font-size: 15px; }

.uaps-dialog-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 33%;
    background: var(--uaps-surface);
    color: var(--uaps-muted);
}

.uaps-dialog-mark svg { width: 16px; height: 16px; }

.uaps-shortcuts dl > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--uaps-line-soft);
}

.uaps-shortcuts dl > div:last-child { border-bottom: 0; }
.uaps-shortcuts dt { display: inline-flex; flex-shrink: 0; gap: 4px; order: 2; }
.uaps-shortcuts dd { font-size: 13px; color: var(--uaps-ink-2); }
.uaps .uaps-shortcuts-note { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--uaps-line); font-size: 11.5px; line-height: 1.65; color: var(--uaps-faint); }

/* ------------------------------------------------------------ reminders */

.uaps .uaps-reminders p { font-size: 12px; line-height: 1.7; color: var(--uaps-muted); }
.uaps .uaps-reminder-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--uaps-line-soft); cursor: pointer; }
.uaps-reminder-option > span { min-width: 0; }
.uaps-reminder-option strong { display: block; font-size: 13px; margin-bottom: 3px; }
.uaps-reminder-option small { display: block; font-size: 12px; line-height: 1.6; color: var(--uaps-muted); }
.uaps .uaps-reminder-option input[type="checkbox"] { appearance: auto; width: 18px; height: 18px; min-width: 18px; padding: 0; margin: 0; accent-color: var(--uaps-brand); cursor: pointer; }
.uaps .uaps-reminder-option input[type="checkbox"]:disabled { cursor: default; opacity: .5; }
.uaps .uaps-reminder-feedback { margin: 12px 0; font-size: 12px; line-height: 1.6; color: var(--uaps-muted); }
.uaps .uaps-reminder-feedback:empty { margin: 6px 0; }
.uaps .uaps-reminder-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--uaps-line); font-size: 11px; color: var(--uaps-faint); }

/* A compact, explicit reminder control; attention is brief, never perpetual. */
.uaps-reminder-entry { position: relative; flex-shrink: 0; }
.uaps .uaps-reminder-trigger { position: relative; min-height: 34px; padding: 6px 9px; gap: 5px; font-size: 11.5px; font-weight: 500; color: var(--uaps-muted); white-space: nowrap; }
.uaps .uaps-reminder-trigger,
.uaps .uaps-reminder-trigger:hover { background: transparent; border: 0; box-shadow: none; }
.uaps .uaps-reminder-trigger svg { width: 17px; height: 17px; flex-shrink: 0; }
.uaps-reminder-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .55; }
.uaps .uaps-reminder-trigger[data-reminder-state="partial"],
.uaps .uaps-reminder-trigger[data-reminder-state="attention"] { color: var(--uaps-warn); }
.uaps .uaps-reminder-trigger[data-reminder-state="on"] { color: var(--uaps-success); }
.uaps .uaps-reminder-trigger[data-reminder-state="on"] .uaps-reminder-dot { opacity: 1; }
.uaps-reminder-tip { position: absolute; top: calc(100% + 10px); right: 0; width: 230px; max-width: calc(100vw - 40px); padding: 10px 12px; z-index: 20; border: 1px solid var(--uaps-line); border-radius: 12px; background: var(--uaps-paper); color: var(--uaps-ink); box-shadow: var(--uaps-shadow-md); font-size: 12px; line-height: 1.6; font-weight: 400; white-space: normal; }
.uaps-reminder-tip::before { content: ''; position: absolute; right: 16px; top: -5px; width: 8px; height: 8px; transform: rotate(45deg); border-left: 1px solid var(--uaps-line); border-top: 1px solid var(--uaps-line); background: var(--uaps-paper); }
.uaps-sidebar .uaps-reminder-tip { right: auto; left: -60px; }
.uaps-sidebar .uaps-reminder-tip::before { right: auto; left: 84px; }
.uaps [data-nudge="true"] svg { animation: uaps-bell-nudge .65s ease-in-out 2; transform-origin: 50% 15%; }
@keyframes uaps-bell-nudge { 0%,100% { transform: rotate(0); } 20%,60% { transform: rotate(-12deg); } 40%,80% { transform: rotate(12deg); } }

/* ============================================== host-page entry badge */

/* Independent fixed circles never participate in the host button's layout. */
body > .uaps-link-badge {
    all: initial;
    position: fixed;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 22px;
    height: 22px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #c52b40;
    color: #fff;
    box-shadow: 0 2px 5px rgba(100, 18, 32, .18);
    font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-variant-numeric: tabular-nums;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
body > .uaps-link-badge[data-digits="3"] { font-size: 9px; }
body > .uaps-link-badge[hidden] { display: none !important; }
body > .uaps-badge-reader {
    all: initial;
    position: absolute;
    width: 1px; height: 1px; padding: 0; border: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ============================================================ responsive */

@media (min-width: 1001px) {
    .uaps-desk.details-open {
        grid-template-columns: 304px minmax(0, 1fr) 300px;
    }

    .uaps-desk .uaps-details[open] {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
        position: static;
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        margin: 0;
        border: 0;
        border-left: 1px solid var(--uaps-line);
        border-radius: 0;
        box-shadow: none;
        background: var(--uaps-paper);
    }

    .uaps-desk .uaps-details > header {
        position: static;
        flex-shrink: 0;
        min-height: 72px;
        padding: 14px 12px 14px 18px;
    }

    .uaps-desk .uaps-details [data-details-body] {
        flex: 1;
        min-height: 0;
        overflow: auto;
        padding: 0 18px 14px;
    }

    .uaps-desk .uaps-detail-profile { padding-top: 14px; }
    .uaps-desk .uaps-details section { padding-top: 14px; }
    .uaps-desk .uaps-details section + section { margin-top: 14px; }
    .uaps-desk .uaps-details h3 { margin-bottom: 8px; font-size: 12px; }
    .uaps-desk .uaps-details dl { font-size: 12.5px; line-height: 1.55; }
    .uaps-desk .uaps-details dl > div {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 8px;
        align-items: baseline;
    }
    .uaps-desk .uaps-details dl > div + div { margin-top: 6px; }
    .uaps-desk .uaps-details dt,
    .uaps-desk .uaps-details dd { margin: 0; min-width: 0; }
    .uaps-desk .uaps-details .uaps-detail-source dl > div,
    .uaps-desk .uaps-details .uaps-detail-raw dl > div { display: block; }
    .uaps-desk .uaps-detail-source dd { margin-top: 2px; }
    .uaps-desk .uaps-detail-raw dt {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }
    .uaps-desk .uaps-detail-raw dd { font-size: 11px; color: var(--uaps-faint); }
    .uaps-desk .uaps-details-note { flex-shrink: 0; margin: 0; padding: 10px 18px; line-height: 1.6; }
}

@media (max-width: 1100px) {
    .uaps-desk {
        grid-template-columns: 276px minmax(0, 1fr);
    }

    .uaps-desk .uaps-compose-hint {
        justify-content: flex-end;
    }

    .uaps-desk .uaps-messages {
        padding: 22px 22px 8px;
    }

    .uaps-desk .uaps-compose {
        padding: 0 18px 14px;
    }
}

@media (min-width: 1001px) and (max-width: 1100px) {
    .uaps-desk.details-open {
        grid-template-columns: 276px minmax(0, 1fr) 280px;
    }
}

@media (max-width: 700px) {
    .uaps-modal {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: 0;
        transform-origin: 50% 100%;
    }

    .uaps-modal[data-enter],
    .uaps-modal[data-leave] {
        transform: translateY(16px);
    }

    .uaps-desk {
        display: block;
    }

    .uaps-desk .uaps-sidebar {
        height: 100%;
        border-right: 0;
    }

    .uaps-desk .uaps-chat {
        display: none;
    }

    .uaps-desk.has-conversation .uaps-sidebar {
        display: none;
    }

    .uaps-desk.has-conversation .uaps-chat {
        display: flex;
    }

    .uaps .uaps-mobile-back {
        display: inline-flex;
    }

    .uaps-chat-head,
    .uaps-desk .uaps-chat-head {
        min-height: 60px;
        padding: max(10px, env(safe-area-inset-top, 0px)) 8px 10px 14px;
        gap: 10px;
    }

    .uaps-desk .uaps-chat-head {
        padding-left: 6px;
    }

    .uaps-desk .uaps-chat-head .uaps-avatar-wrap,
    .uaps-desk .uaps-head-tags {
        display: none;
    }

    .uaps-desk .uaps-messages,
    .uaps-messages {
        padding: 16px 14px 6px;
    }

    .uaps-desk .uaps-bubble,
    .uaps-desk .uaps-msg[data-kind="image"] > .uaps-bubble {
        max-width: 88%;
    }

    .uaps-desk .uaps-copy { display: none; }

    .uaps-compose textarea,
    .uaps input {
        font-size: 16px;
    }

    .uaps .uaps-thread-action {
        padding: 0 10px;
    }

    .uaps-chat-head [data-action="close-thread"] svg {
        display: none;
    }

    .uaps .uaps-footnote {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .uaps-compose,
    .uaps-desk .uaps-compose {
        padding: 0 12px max(10px, env(safe-area-inset-bottom));
    }

    .uaps-compose-hint small {
        display: none;
    }

    .uaps-desk .uaps-compose-hint {
        display: none;
    }

    .uaps-contact {
        margin: 0 12px 8px;
    }

    .uaps-context,
    .uaps-status,
    .uaps-update-notice {
        margin: 10px 12px 0;
    }

    .uaps-welcome {
        padding: 24px 8px;
    }

    .uaps-welcome h3 {
        font-size: 18px;
    }

    .uaps-sidebar-head {
        padding-top: max(16px, env(safe-area-inset-top, 0px));
    }

    .uaps-list {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .uaps-search kbd {
        display: none;
    }
}

@media (max-width: 420px) {
    .uaps-contact-fields {
        grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr);
        gap: 8px;
    }

    .uaps-contact-actions {
        gap: 8px;
    }

    .uaps-compose-bottom {
        gap: 4px;
    }
}

@media (max-height: 600px) {
    .uaps-chat-head {
        min-height: 54px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .uaps-context {
        max-height: 54px;
    }

    .uaps-compose textarea,
    .uaps-desk .uaps-compose textarea {
        min-height: 42px;
        max-height: 110px;
    }

    .uaps-compose-hint {
        display: none;
    }

    .uaps .uaps-footnote {
        padding-bottom: 6px;
    }

    .uaps-contact {
        max-height: min(180px, 36dvh);
    }

    .uaps-welcome {
        padding: 10px 4px;
    }

    .uaps .uaps-welcome-avatar {
        width: 44px;
        height: 44px;
    }

    .uaps-welcome h3 {
        margin-top: 14px;
        font-size: 17px;
    }
}

@media (pointer: coarse) {
    .uaps button,
    .uaps summary {
        min-height: 44px;
    }

    .uaps .uaps-icon {
        width: 44px;
    }

    .uaps a.uaps-icon {
        height: 44px;
    }

    .uaps summary {
        padding: 8px 0;
    }

    .uaps input {
        min-height: 44px;
    }

    .uaps .uaps-media-tools > button,
    .uaps .uaps-compose-bottom > button.uaps-primary,
    .uaps .uaps-quick > button {
        min-height: 40px;
    }

    .uaps .uaps-media-tools > button {
        width: 40px;
        height: 40px;
    }

    /* Queue rows and inline controls already exceed the target and must stay compact. */
    .uaps .uaps-list button,
    .uaps .uaps-copy,
    .uaps [data-emoji],
    .uaps .uaps-quick-panel [data-quick-list] button {
        min-height: 0;
    }

    .uaps .uaps-copy { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .uaps *,
    .uaps-link-badge {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .uaps-modal[data-enter],
    .uaps-modal[data-leave] {
        opacity: 1;
        transform: none;
    }
}

/* Default service identity follows the brand; custom image colours remain intact. */
.uaps .uaps-default-avatar { display: none; }
.uaps .uaps-agent-avatar[data-default="true"] > img { display: none; }
.uaps .uaps-agent-avatar[data-default="true"] > .uaps-default-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%; border-radius: inherit;
    background: var(--uaps-brand);
    color: var(--uaps-on-brand);
}
.uaps .uaps-default-avatar svg { width: 64%; height: 64%; }

.uaps-detail-loading { padding: 2px 0; }
.uaps-skeleton-group { padding: 16px 0; }
.uaps-skeleton-group + .uaps-skeleton-group { border-top: 1px solid var(--uaps-line-soft); }
.uaps-skeleton-heading, .uaps-skeleton-row > * { display: block; height: 10px; border-radius: 5px; background: var(--uaps-fill); animation: uaps-skeleton-pulse 1.5s ease-in-out infinite; }
.uaps-skeleton-heading { width: 38%; height: 12px; margin-bottom: 20px; }
.uaps-skeleton-row { display: grid; grid-template-columns: 28% 1fr; gap: 16px; margin-top: 15px; }
.uaps-skeleton-row:nth-child(3) > span { width: 78%; }
.uaps-skeleton-row:nth-child(4) > span { width: 90%; }
@keyframes uaps-skeleton-pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.uaps-detail-error { padding: 24px 0; }
.uaps-detail-error strong { display: block; font-size: 13px; }
.uaps .uaps-detail-error p { margin: 8px 0 16px; color: var(--uaps-muted); font-size: 12px; line-height: 1.7; }
@media (prefers-reduced-motion: reduce) {
    .uaps [data-nudge="true"] svg, .uaps-skeleton-heading, .uaps-skeleton-row > * { animation: none; }
}
