/*
 * 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.
 */

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

.uaps {
    /* Primary fills share a white foreground in both colour modes. */
    --uaps-brand: #3154cb;
    --uaps-on-brand: #fff;
    --uaps-soft: #edf2ff;
    --uaps-brand-line: #bac9f1;

    /* Text */
    --uaps-ink: #202936;
    --uaps-muted: #626e80;
    --uaps-faint: #626e80;

    /* Surfaces */
    --uaps-paper: #fff;
    --uaps-surface: #f5f6f8;
    --uaps-line: #e6eaf0;
    --uaps-line-strong: #d3d9e3;

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

    /* Radius scale */
    --uaps-r-xs: 6px;
    --uaps-r-sm: 8px;
    --uaps-r-md: 12px;
    --uaps-r-lg: 16px;
    --uaps-r-xl: 22px;
    --uaps-r-bubble: 16px;
    --uaps-r-tight: 5px;

    /* Elevation */
    --uaps-shadow-sm: 0 1px 2px rgba(22, 37, 68, .04);
    --uaps-shadow-md: 0 8px 32px rgba(20, 37, 68, .13);
    --uaps-shadow-lg: 0 16px 64px rgba(24, 45, 84, .17);

    /* Motion */
    --uaps-dur: 170ms;
    --uaps-dur-fast: 110ms;
    --uaps-ease: cubic-bezier(.2, .7, .3, 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.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    background: var(--uaps-paper);
    text-align: left;
    isolation: isolate;
    color-scheme: light;
}

/* 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: #232c45;
        --uaps-brand-line: #495b91;

        --uaps-ink: #e6eaf2;
        --uaps-muted: #9aa5b8;
        --uaps-faint: #7c869a;

        --uaps-paper: #141922;
        --uaps-surface: #1c2230;
        --uaps-line: #2b3242;
        --uaps-line-strong: #3a4356;

        --uaps-success: #5fd0a0;
        --uaps-warn: #e2bd84;
        --uaps-warn-soft: #2c2418;
        --uaps-warn-line: #453722;
        --uaps-danger: #ff8f9d;

        --uaps-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
        --uaps-shadow-md: 0 8px 32px rgba(0, 0, 0, .5);
        --uaps-shadow-lg: 0 16px 64px rgba(0, 0, 0, .6);

        --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-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: 7px;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-sm);
    background: var(--uaps-paper);
    color: var(--uaps-ink);
    padding: 7px 12px;
    cursor: pointer;
    line-height: 1.5;
    text-transform: none;
    box-shadow: none;
    min-height: 36px;
    transition: background 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);
}

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

.uaps button:disabled {
    opacity: .5;
    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: 3px;
}

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

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

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

.uaps h1 { font-size: 21px; line-height: 1.4; font-weight: 600; }
.uaps h2 { font-size: 16px; line-height: 1.5; font-weight: 600; }
.uaps h3 { font-size: 14px; font-weight: 600; }

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

.uaps button.uaps-primary:hover {
    filter: none;
}

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

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

.uaps-modal {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 410px;
    max-width: calc(100vw - 32px);
    height: 690px;
    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(10px) scale(.985);
    pointer-events: none;
}

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

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

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

.uaps-customer.uaps-standalone {
    max-width: 600px;
    margin: auto;
    box-shadow: 0 0 60px rgba(22, 51, 92, .04);
}

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

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

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

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

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

.uaps-heading h2 {
    overflow-wrap: anywhere;
}

.uaps-heading p {
    font-size: 12px;
    color: var(--uaps-muted);
    margin-top: 4px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* Availability reads as a status, so it carries a dot as well as colour. */
.uaps-customer .uaps-heading p::before {
    content: "";
    display: none;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    vertical-align: 1px;
    background: currentColor;
}

.uaps-customer[data-available] .uaps-heading p::before {
    display: inline-block;
}

.uaps-customer[data-available="true"] .uaps-heading p {
    color: var(--uaps-success);
}

.uaps-customer[data-available="false"] .uaps-heading p::before {
    background: var(--uaps-warn);
}

.uaps-avatar {
    width: 42px;
    height: 42px;
    /* 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-weight: 500;
    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; }

.uaps .uaps-icon {
    width: 36px;
    padding: 7px;
    border: 0;
    color: var(--uaps-muted);
    flex-shrink: 0;
}

.uaps .uaps-icon:hover {
    color: var(--uaps-ink);
}

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

.uaps-context {
    margin: 10px 20px 0;
    padding: 10px 12px;
    border-radius: var(--uaps-r-sm);
    background: var(--uaps-warn-soft);
    color: var(--uaps-warn);
    font-size: 12px;
    overflow-wrap: anywhere;
    white-space: pre-line;
    max-height: 84px;
    overflow: auto;
    flex-shrink: 0;
}

.uaps-status {
    font-size: 12px;
    padding: 8px 20px;
    background: var(--uaps-warn-soft);
    color: var(--uaps-warn);
    white-space: pre-line;
    flex-shrink: 0;
    max-height: 100px;
    overflow: auto;
}

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

.uaps-history button {
    margin: 5px 0;
    font-size: 12px;
    border: 0;
    color: var(--uaps-muted);
}

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

.uaps-messages {
    flex: 1;
    overflow: auto;
    min-height: 64px;
    padding: 22px 22px 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;
}

.uaps-welcome {
    text-align: left;
    padding: 26px 10px 24px;
    max-width: 440px;
    margin: auto;
}

.uaps-welcome h3 {
    font-size: 24px;
    line-height: 1.55;
    font-weight: 500;
    white-space: pre-line;
    color: var(--uaps-ink);
    margin-bottom: 14px;
}

.uaps-welcome p {
    font-size: 13px;
    color: var(--uaps-muted);
    line-height: 1.9;
    white-space: pre-line;
}

.uaps-welcome small {
    display: block;
    font-size: 12px;
    color: var(--uaps-muted);
    margin-top: 22px;
}

/*
 * Message clusters. Script sets `data-group` to start / middle / end /
 * single; CSS derives the spine radii and hides repeated timestamps so a
 * burst of messages reads as one turn instead of separate events.
 */
.uaps-msg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0 0 18px;
}

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

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

.uaps-bubble {
    border: 0;
    max-width: 90%;
    padding: 11px 14px;
    background: var(--uaps-surface);
    color: var(--uaps-ink);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.75;
    /* Incoming: spine on the left, tail on the last bubble's bottom-left. */
    border-radius: var(--uaps-r-bubble) var(--uaps-r-bubble) var(--uaps-r-bubble) var(--uaps-r-tight);
}

.uaps-msg[data-group="start"] > .uaps-bubble {
    border-radius: var(--uaps-r-bubble) var(--uaps-r-bubble) var(--uaps-r-bubble) var(--uaps-r-tight);
}

.uaps-msg[data-group="middle"] > .uaps-bubble,
.uaps-msg[data-group="end"] > .uaps-bubble {
    border-radius: var(--uaps-r-tight) 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. Tail sits on the last bubble. */
.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);
}

.uaps-msg.is-mine[data-group="start"] > .uaps-bubble {
    border-radius: var(--uaps-r-bubble) var(--uaps-r-bubble) var(--uaps-r-tight) var(--uaps-r-bubble);
}

.uaps-msg.is-mine[data-group="middle"] > .uaps-bubble,
.uaps-msg.is-mine[data-group="end"] > .uaps-bubble {
    border-radius: var(--uaps-r-bubble) var(--uaps-r-tight) var(--uaps-r-tight) var(--uaps-r-bubble);
}

/* 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); }
.uaps-image-caption { padding: 7px 2px 0; font-size: 13px; line-height: 1.65; 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-update-notice { margin: 6px 16px; padding: 8px 12px; border-radius: 8px; background: var(--uaps-surface); color: var(--uaps-muted); font-size: 12px; line-height: 1.6; }

.uaps-msg time {
    font-size: 11px;
    color: var(--uaps-muted);
    margin: 6px 1px 0;
    font-variant-numeric: tabular-nums;
}

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

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

.uaps-new-messages {
    align-self: center;
    font-size: 12px !important;
    color: var(--uaps-accent-ink, var(--uaps-brand)) !important;
    flex-shrink: 0;
    margin: 0 12px 8px;
    box-shadow: var(--uaps-shadow-sm);
}

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

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

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

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

.uaps .uaps-contact-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    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-toggle:hover { background: var(--uaps-paper); }
.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-muted); transition: transform var(--uaps-dur-fast) var(--uaps-ease); }
.uaps-contact-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .uaps-contact-toggle svg { transition: none; } }

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

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

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

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

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

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

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

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

.uaps-contact-actions button {
    font-size: 12px;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------- composer */
.uaps .uaps-send-allowance { margin: 0 0 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 18px 12px;
    background: var(--uaps-paper);
    margin: 0;
    flex-shrink: 0;
}

.uaps-editor {
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-lg);
    padding: 11px 13px;
    background: var(--uaps-paper);
    box-shadow: var(--uaps-shadow-sm);
    transition: border-color var(--uaps-dur-fast) var(--uaps-ease), box-shadow var(--uaps-dur-fast) var(--uaps-ease);
}

.uaps-editor:focus-within {
    border-color: var(--uaps-accent-ink, var(--uaps-brand));
}

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

.uaps-compose-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--uaps-muted);
    font-size: 11px;
    margin-top: 10px;
    position: relative;
}

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

/* Native emoji and private image controls share the existing compact composer. */
.uaps-media-tools { display: flex; flex: 0 0 auto; gap: 2px; }
.uaps .uaps-media-tools > button { width: 32px; min-width: 32px; height: 34px; padding: 0; border: 0; background: transparent; color: var(--uaps-muted); }
.uaps .uaps-media-tools > button:hover,
.uaps .uaps-media-tools > button[aria-expanded="true"] { color: var(--uaps-brand); background: var(--uaps-surface); }
.uaps-emoji-panel { position: absolute; z-index: 5; bottom: 46px; left: 0; width: 260px; max-width: 100%; padding: 12px; border: 1px solid var(--uaps-line); border-radius: 14px; background: var(--uaps-paper); box-shadow: var(--uaps-shadow-lg); }
.uaps-emoji-panel > span { display: block; margin: 0 0 6px 4px; font-size: 11px; color: var(--uaps-muted); }
.uaps [data-emoji-list] { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.uaps [data-emoji] { min-width: 0; min-height: 34px; padding: 3px; border: 0; 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: 8px 10px; margin-bottom: 8px; background: var(--uaps-surface); border-radius: 10px; }
.uaps-attachment > img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.uaps-attachment > div { flex: 1; min-width: 0; }
.uaps-attachment strong { display: block; font-size: 12px; font-weight: 500; }
.uaps-attachment small { display: block; font-size: 11px; color: var(--uaps-muted); }
.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: 12px; 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(8, 12, 18, .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: 30px; padding: 4px; }
}
@media (max-width: 380px) {
    .uaps .uaps-media-tools > button { width: 28px; min-width: 28px; }
    .uaps-compose-bottom { gap: 6px; }
}

.uaps-compose-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--uaps-muted);
    margin-top: 8px;
}

.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 2px 9px;
    overflow-wrap: anywhere;
}

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

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

.uaps-send-feedback button {
    font-size: 12px;
    flex-shrink: 0;
}

.uaps-footnote {
    font-size: 11px !important;
    color: var(--uaps-muted);
    padding: 0 20px 14px !important;
    text-align: center;
    line-height: 1.7;
}

/* The editor frame provides one clear keyboard focus indicator. */
.uaps .uaps-editor:focus-within {
    outline: 0;
    box-shadow: inset 0 0 0 1px var(--uaps-accent-ink, var(--uaps-brand));
}

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

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

.uaps-desk {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    max-width: 1680px;
    margin: auto;
}

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

.uaps-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 27px 22px 16px;
}

.uaps-sidebar-head > a {
    font-size: 12px;
}

.uaps-eyebrow {
    font-size: 11px;
    letter-spacing: .09em;
    color: var(--uaps-muted);
    display: block;
    margin-bottom: 6px;
}

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

.uaps-tools button {
    font-size: 12px;
    padding: 5px 2px;
    background: transparent;
    border: 0;
}

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

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

.uaps-availability {
    gap: 7px;
    padding: 4px 10px 4px 8px !important;
    border: 1px solid var(--uaps-line) !important;
    border-radius: 999px !important;
    background: var(--uaps-paper) !important;
    color: var(--uaps-warn);
    font-size: 12px;
}

.uaps-availability:hover {
    background: var(--uaps-paper) !important;
    text-decoration: none !important;
}

.uaps-availability i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

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

.uaps-tools [data-action="notifications"] {
    font-size: 11px;
    color: var(--uaps-muted);
}

.uaps-tabs {
    display: flex;
    gap: 8px;
    margin: 0 16px 10px;
    border-bottom: 1px solid var(--uaps-line);
}

.uaps-tabs button {
    font-size: 12px;
    padding: 7px 2px;
    flex: 1;
    white-space: nowrap;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
}

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

.uaps-tabs [aria-pressed="true"] {
    color: var(--uaps-accent-ink, var(--uaps-brand));
    border-bottom-color: var(--uaps-accent-ink, var(--uaps-brand));
}

/* 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;
    line-height: 17px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.uaps-list {
    flex: 1;
    overflow: auto;
    padding: 4px 12px;
}

.uaps-list button {
    display: block;
    text-align: left;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid transparent;
    background: transparent;
    position: relative;
    margin-bottom: 4px;
    border-radius: var(--uaps-r-md);
    min-height: 0;
}

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

/* Two rows: identity + time, then preview + unread. Roughly a third more
   conversations fit on screen than the previous four-row stack. */
.uaps-list-head {
    display: flex;
    align-items: center;
    gap: 9px;
}

.uaps-list .uaps-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    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-title {
    flex: 1;
    min-width: 0;
}

.uaps-list strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uaps-list small {
    display: block;
    color: var(--uaps-muted);
    font-size: 11px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uaps-list time {
    flex-shrink: 0;
    align-self: flex-start;
    color: var(--uaps-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.uaps-list time span { display: block; }

.uaps-list-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-left: 41px;
}

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

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

.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-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    font-size: 12px;
}

.uaps-pagination button {
    font-size: 12px;
    background: transparent;
    border: 0;
}

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

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

.uaps-desk .uaps-bubble {
    max-width: 82%;
}

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

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

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

.uaps-quick > button {
    border: 0;
    color: var(--uaps-accent-ink, var(--uaps-brand));
    font-size: 12px;
    padding: 4px 0;
    background: transparent;
}

.uaps-quick > button:hover {
    background: transparent;
    text-decoration: underline;
}

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

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

.uaps-quick-panel label {
    display: block;
    padding: 6px;
    font-size: 12px;
}

.uaps-quick-panel input {
    width: 100%;
    margin-top: 5px;
    padding: 7px;
    border: 1px solid var(--uaps-line);
    border-radius: var(--uaps-r-xs);
    color: var(--uaps-ink);
    background: var(--uaps-paper);
}

.uaps-quick-panel button {
    display: block;
    width: 100%;
    text-align: left;
    white-space: normal;
    border: 0;
    padding: 10px;
    font-size: 13px;
    border-radius: var(--uaps-r-sm);
}

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

.uaps-quick-panel > a {
    display: block;
    border-top: 1px solid var(--uaps-line);
    padding: 9px 10px 3px;
    margin-top: 5px;
    font-size: 12px;
}

.uaps-quick-empty {
    padding: 16px !important;
    font-size: 12px;
    color: var(--uaps-muted);
}

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

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

.uaps .uaps-details::backdrop {
    background: rgba(20, 34, 56, .38);
}

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

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

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

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

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

.uaps-details dt {
    margin-top: 14px;
    font-size: 11px;
    color: var(--uaps-muted);
}

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

.uaps .uaps-details-note {
    padding: 14px 20px;
    background: var(--uaps-surface);
    font-size: 11px;
    color: var(--uaps-muted);
}

.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; }

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

.uaps .uaps-reminders {
    position: fixed;
    inset: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 20px;
    border: 1px solid var(--uaps-line);
    border-radius: 16px;
    background: var(--uaps-paper);
    color: var(--uaps-ink);
    box-shadow: var(--uaps-shadow-lg);
    font: inherit;
    overflow: auto;
    overscroll-behavior: contain;
}
.uaps-reminders::backdrop { background: rgba(20, 34, 56, .38); }
.uaps-reminders header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.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: 16px 0; border-bottom: 1px solid var(--uaps-line); }
.uaps-reminder-option > span { min-width: 0; }
.uaps-reminder-option strong { display: block; font-size: 13px; margin-bottom: 4px; }
.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-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--uaps-line); font-size: 11px; }


/* 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: 290px minmax(0, 1fr) 280px;
    }

    .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;
    }

    .uaps-desk .uaps-details > header {
        position: static;
        flex-shrink: 0;
        padding: 14px 16px;
    }

    .uaps-desk .uaps-details [data-details-body] {
        flex: 1;
        min-height: 0;
        overflow: auto;
        padding: 0 16px 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: 10px; font-size: 12px; }
    .uaps-desk .uaps-details dl { font-size: 12px; line-height: 1.6; }
    .uaps-desk .uaps-details dl > div {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 8px;
        align-items: baseline;
    }
    .uaps-desk .uaps-details dl > div + div { margin-top: 7px; }
    .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-muted); }
    .uaps-desk .uaps-details-note { flex-shrink: 0; margin: 0; padding: 10px 16px; line-height: 1.6; }
}

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

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

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

}

@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%;
    }

    .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 {
        padding: 14px 12px;
        gap: 8px;
    }

    .uaps-desk .uaps-chat-head > .uaps-avatar {
        display: none;
    }

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

    .uaps-desk .uaps-bubble {
        max-width: 94%;
    }

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

    .uaps-chat-head > button {
        font-size: 12px;
        padding: 7px;
    }

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

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

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

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

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

    .uaps-contact {
        margin: 0 14px 10px;
    }

    .uaps-context {
        margin: 8px 14px 0;
    }

    .uaps-quick-panel {
        bottom: 50px;
    }

    .uaps-welcome {
        padding: 20px 6px;
    }

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

@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 {
        padding-left: 14px;
        padding-right: 14px;
    }

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

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

    .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-footnote {
        padding-bottom: 6px !important;
    }

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

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

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


}

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

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

    .uaps summary {
        padding: 8px 0;
    }

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

    /* Queue rows already exceed the target and must stay compact. */
    .uaps-list button {
        min-height: 0;
    }
}

@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-avatar[data-default="true"] > img { display: none; }
.uaps .uaps-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: 70%; height: 70%; }
.uaps [data-count][data-over="true"] { color: var(--uaps-danger); }

/* 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: 36px; padding: 7px 9px; gap: 5px; font-size: 11px; 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: 16px; height: 16px; 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: 220px; max-width: calc(100vw - 40px); padding: 10px 12px; z-index: 20; border: 1px solid var(--uaps-line); border-radius: 10px; background: var(--uaps-paper); color: var(--uaps-ink); box-shadow: var(--uaps-shadow-sm); font-size: 12px; line-height: 1.6; font-weight: 400; }
.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 [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); } }
.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); }
.uaps-skeleton-heading, .uaps-skeleton-row > * { display: block; height: 10px; border-radius: 5px; background: var(--uaps-line); 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; }
}
