:root {
    color-scheme: light;
    --font: Inter, "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --agent-bg: #f4f7f6;
    --panel-bg: #ffffff;
    --panel-border: #e2ebe7;
    --text-primary: #0f1f1c;
    --text-secondary: #5a6f69;
    --ink: var(--text-primary);
    --muted: var(--text-secondary);
    --line: var(--panel-border);
    --line-soft: #eef4f1;
    --surface: var(--panel-bg);
    --canvas: var(--agent-bg);
    --accent: #0f766e;
    --accent-hover: #0b5f59;
    --accent-soft: #d9f3ee;
    --accent-ink: #0b4f4a;
    --nav: #0d1614;
    --nav-soft: #1a2925;
    --danger: #dc2626;
    --danger-soft: #fef3f2;
    --success: #067647;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fff7ed;
    --warning-text: #9a3412;
    --warning-color: #f59e0b;
    --muted-bg: #eef3f1;
    --hover-bg: #eef4f1;
    --focus-color: #0f766e;
    --radius: 16px;
    --radius-md: 14px;
    --radius-sm: 12px;
    --shadow: 0 16px 40px rgba(15, 31, 28, .09);
    --shadow-sm: 0 1px 2px rgba(15, 31, 28, .05);
    --shadow-soft: var(--shadow-sm);
    --nav-width: 80px;
    --list-width: 340px;
    --details-width: 320px;
    font-family: var(--font);
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
html, body { height: 100%; height: 100dvh; }
body { margin: 0; overscroll-behavior: none; }
button, input, textarea, select { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; transition: background .18s ease, color .18s ease, border-color .18s ease, transform .15s ease, box-shadow .18s ease; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--accent); }

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    background:
        radial-gradient(circle at 10% 12%, rgba(15, 118, 110, .18), transparent 34%),
        radial-gradient(circle at 90% 88%, rgba(15, 31, 28, .08), transparent 28%),
        linear-gradient(165deg, #eaf4f1 0%, #f7faf8 46%, #e7f0ed 100%);
}
.login-card {
    width: min(420px, 100%);
    padding: 36px 32px;
    border: 1px solid rgba(226, 235, 231, .95);
    border-radius: 26px;
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}
.brand-mark, .operator-avatar, .visitor-avatar, .list-avatar {
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 800;
}
.brand-mark {
    width: 52px;
    height: 52px;
    margin-bottom: 22px;
    color: #fff;
    background: linear-gradient(160deg, #14968c, #0f766e);
    box-shadow: 0 10px 22px rgba(15, 118, 110, .28);
}
.login-card h1 { margin: 0; font-size: clamp(24px, 5vw, 28px); letter-spacing: -.035em; font-weight: 800; }
.login-card > p { margin: 8px 0 26px; color: var(--muted); line-height: 1.55; }
.login-form label { display: block; margin-top: 17px; font-size: 13px; font-weight: 700; }
.login-form input {
    width: 100%;
    margin-top: 7px;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #d0ddd8;
    border-radius: var(--radius-sm);
    background: #fbfcfb;
    outline: none;
    font-size: 16px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-form input:focus, .reply-form textarea:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .12);
}
.alert {
    margin: 18px 0 4px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 14px;
}
.primary-button, .secondary-button {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-weight: 700;
}
.primary-button { color: #fff; background: var(--accent); box-shadow: 0 8px 16px rgba(15, 118, 110, .18); }
.primary-button:hover { background: var(--accent-hover); }
.primary-button:active { transform: scale(.99); }
.secondary-button { color: #334843; background: #eef3f1; }
.secondary-button:hover { background: #e2ebe7; }
.login-form .primary-button { width: 100%; margin-top: 24px; min-height: 48px; padding: 12px; }

.dashboard-page { min-height: 100vh; min-height: 100dvh; overflow: hidden; background: var(--surface); }
.dashboard {
    display: grid;
    grid-template-columns: var(--nav-width) var(--list-width) minmax(420px, 1fr);
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background: var(--agent-bg);
}
.main-nav {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 14px 10px 12px;
    color: #c5d4cf;
    background: linear-gradient(180deg, #152420 0%, var(--nav) 100%);
    border-right: 1px solid rgba(255, 255, 255, .04);
}
.nav-brand {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    align-self: center;
    margin-bottom: 22px;
    overflow: hidden;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(160deg, #14968c, #0f766e);
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 8px 16px rgba(0, 0, 0, .18);
}
.nav-brand.has-photo { background: #1a2925; }
.nav-brand img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.nav-menu { display: grid; gap: 6px; }
.nav-item {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    min-height: 52px;
    padding: 8px 6px;
    border: 0;
    border-radius: 13px;
    color: #9bb0a9;
    background: transparent;
    text-decoration: none;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-item:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .55);
    outline-offset: 2px;
}
.nav-item.active {
    color: #fff;
    background: rgba(15, 118, 110, .28);
    box-shadow: inset 3px 0 0 #2dd4bf, inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.1;
}
.nav-unread-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
}
.nav-unread-badge[hidden] { display: none !important; }
.nav-icon {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.nav-account {
    display: grid;
    justify-items: stretch;
    gap: 8px;
    margin-top: auto;
    margin-bottom: 40px; /* clear fixed realtime-status pill */
}
.nav-account form { width: 100%; }
.nav-logout { margin-top: 0; opacity: .85; }
.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.inbox-availability {
    flex: 0 0 auto;
    max-width: min(148px, 42vw);
}
.sidebar {
    display: flex;
    height: 100%;
    min-height: 0;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--line);
    background: var(--panel-bg);
}
.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 16px 12px;
}
.inbox-sidebar-header { align-items: stretch; }
.sidebar-inbox-copy {
    display: grid;
    width: 100%;
    gap: 10px;
    min-width: 0;
}
.sidebar-inbox-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.sidebar-inbox-heading { min-width: 0; }
.sidebar-list-count {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}
.eyebrow {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.sidebar-header h1 {
    margin: 4px 0 0;
    overflow: hidden;
    font-size: 22px;
    letter-spacing: -.03em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.availability-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    padding: 6px 10px 6px 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    user-select: none;
}
.availability-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.availability-switch {
    position: relative;
    width: 32px;
    height: 18px;
    flex: 0 0 32px;
    border-radius: 999px;
    background: #c5d0cc;
    transition: background .18s ease;
}
.availability-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 25, 23, .2);
    transition: transform .18s ease;
}
.availability-toggle.is-on {
    border-color: rgba(15, 118, 110, .28);
    background: var(--accent-soft);
}
.availability-toggle.is-on .availability-switch { background: var(--accent); }
.availability-toggle.is-on .availability-switch::after { transform: translateX(14px); }
.availability-toggle.is-busy { opacity: .65; pointer-events: none; }
.availability-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.availability-toggle.is-on .availability-label { color: var(--accent-ink); }
.header-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.icon-button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: #4d615b;
    background: #fff;
    font-size: 20px;
}
.icon-button:hover { border-color: #c3d4ce; background: var(--canvas); }
.icon-button.is-spinning {
    pointer-events: none;
    animation: refresh-spin .7s linear;
}
@keyframes refresh-spin {
    to { transform: rotate(360deg); }
}
.sidebar-archive {
    background: var(--panel-bg, #fff);
    border-right-color: var(--line);
}
.archive-sidebar-header {
    align-items: stretch;
    background:
        radial-gradient(circle at 0% 0%, rgba(15, 118, 110, .07), transparent 48%),
        transparent;
}
.sidebar-archive-copy {
    display: grid;
    width: 100%;
    gap: 10px;
    min-width: 0;
}
.sidebar-archive-heading { min-width: 0; }
.sidebar-archive-copy h1 {
    margin: 4px 0 0;
    overflow: hidden;
    font-size: 22px;
    letter-spacing: -.03em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-archive .conversation-search input {
    border-color: #c9d6d1;
    background: #fff;
}
.sidebar-archive .conversation-item:hover { background: #f3f8f6; }
.sidebar-archive .conversation-item.selected {
    background: linear-gradient(90deg, rgba(15, 118, 110, .14), rgba(15, 118, 110, .06));
    box-shadow: inset 3px 0 0 var(--accent);
}
.conversation-search {
    margin: 0 16px 12px;
}
.conversation-search input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #c9d6d1;
    border-radius: 11px;
    background: #fff;
    outline: none;
    font-size: 13px;
}
.conversation-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.conversation-search input::placeholder { color: #8a9b95; }
.filters {
    display: flex;
    gap: 4px;
    margin: 0 16px 10px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #eef3f1;
}
.filters[hidden] { display: none !important; }
.filter {
    position: relative;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 0;
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--muted);
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.2;
}
.filter.active {
    color: var(--accent-ink);
    background: #fff;
    box-shadow: var(--shadow-soft);
}
.filter-unread-badge {
    display: inline-grid;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    place-items: center;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    box-shadow: 0 0 0 1.5px #eef3f1;
}
.filter.active .filter-unread-badge {
    box-shadow: 0 0 0 1.5px #fff;
}
.filter-unread-badge[hidden] { display: none !important; }
.sidebar-header[hidden],
#inbox-filters[hidden] { display: none !important; }
.conversation-list {
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
}
.conversation-section {
    margin: 2px 0 8px;
}
.conversation-section-toggle {
    position: sticky;
    top: 0;
    z-index: 2;
    width: 100%;
    min-height: 38px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(244, 247, 246, .98) 70%, rgba(244, 247, 246, .88));
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.conversation-section-toggle:hover {
    background: var(--hover-bg);
}
.conversation-section-toggle:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: -2px;
}
.conversation-section-toggle.queue {
    color: var(--warning-text);
}
.conversation-section-toggle.handled {
    color: var(--accent-ink);
}
.section-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 14px;
    line-height: 1;
    transition: transform .16s ease;
    transform-origin: center;
}
.conversation-section-toggle[aria-expanded="false"] .section-chevron {
    transform: rotate(-90deg);
}
.section-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.section-count-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.section-count,
.conversation-section-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--muted-bg);
    color: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}
.conversation-section-toggle.queue .section-count,
.conversation-section-toggle.queue .conversation-section-count {
    background: #ffedd5;
    color: var(--warning-text);
}
.conversation-section-toggle.handled .section-count,
.conversation-section-toggle.handled .conversation-section-count {
    background: var(--accent-soft);
    color: var(--accent-ink);
}
.section-dirty-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #dc2626;
    box-shadow: 0 0 0 2px #f4f7f6;
    opacity: .95;
}
.section-dirty-dot.is-pulsed {
    animation: section-dirty-pulse .7s ease-out 1;
}
@keyframes section-dirty-pulse {
    0% { transform: scale(.6); opacity: .35; }
    40% { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(1); opacity: .95; }
}
.conversation-section-body {
    min-width: 0;
}
.conversation-section-body[hidden] {
    display: none !important;
}
.conversation-section-empty {
    margin: 2px 8px 10px;
    padding: 8px 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}
.conversation-item.queue-item {
    border-left: 3px solid var(--warning-color);
    background: rgba(255, 247, 237, .35);
}
.conversation-item.queue-item:hover {
    background: rgba(255, 237, 213, .55);
}
.conversation-item.queue-item.selected {
    background: linear-gradient(90deg, rgba(245, 158, 11, .16), rgba(15, 118, 110, .06));
    box-shadow: inset 3px 0 0 var(--warning-color);
}
.conversation-item.queue-item.has-unread {
    border-left: 3px solid #dc2626;
}
.conversation-item.queue-item-long-wait:not(.has-unread) {
    border-left-color: var(--warning);
    background: rgba(255, 237, 213, .55);
}
.conversation-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.conversation-top strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conversation-queue-tag {
    flex: 0 0 auto;
    padding: 2px 7px;
    border-radius: 999px;
    background: #ffedd5;
    color: var(--warning-text);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
    line-height: 1.3;
    white-space: nowrap;
}
.conversation-item {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    padding: 13px 10px 13px 12px;
    border: 0;
    border-radius: 16px;
    color: inherit;
    background: transparent;
    text-align: left;
    transition: background .15s ease, box-shadow .15s ease;
}
.conversation-item:hover { background: #f3f8f6; }
.conversation-item.selected {
    background: linear-gradient(90deg, rgba(15, 118, 110, .14), rgba(15, 118, 110, .06));
    box-shadow: inset 3px 0 0 var(--accent);
}
.conversation-item.has-unread {
    border-left: 3px solid #dc2626;
    box-shadow: none;
}
.conversation-item.has-unread.selected {
    border-left: 3px solid #dc2626;
    box-shadow: 0 0 0 1px rgba(15, 118, 110, .16);
}
.conversation-aside {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    min-width: 28px;
    align-self: stretch;
}
.conversation-aside time {
    color: #8a9c96;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    margin-top: auto;
}
.conversation-close-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, .08);
    color: #334155;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
}
.conversation-item:hover .conversation-close-btn,
.conversation-item:focus-within .conversation-close-btn,
.conversation-close-btn:focus {
    opacity: 1;
    pointer-events: auto;
}
.conversation-item .unread {
    align-self: center;
}
.chat-overflow {
    position: relative;
}
.chat-overflow-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 40;
    min-width: 220px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
    display: grid;
    gap: 2px;
}
.chat-overflow-menu[hidden] { display: none !important; }
.chat-overflow-menu button {
    border: 0;
    background: transparent;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    font: inherit;
    cursor: pointer;
    color: var(--ink);
}
.chat-overflow-menu button:hover,
.chat-overflow-menu button:focus {
    background: #f1f5f4;
    outline: none;
}
.chat-overflow-menu button.is-danger { color: #b91c1c; }
.archive-filters {
    margin: 0 16px 12px;
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line-soft, var(--line));
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-soft, 0 1px 2px rgba(15, 31, 28, .04));
}
.archive-filters[hidden] { display: none !important; }
.conversation-filter-field {
    display: block;
    width: 100%;
    min-width: 0;
}
.conversation-filter-select {
    width: 100%;
    min-height: 40px;
    padding: 7px 34px 7px 11px;
    border: 1px solid var(--panel-border, var(--line));
    border-radius: 9px;
    background: var(--panel-bg, #fff);
    color: var(--text-primary, var(--ink));
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-secondary, #5a6f69) 50%),
        linear-gradient(135deg, var(--text-secondary, #5a6f69) 50%, transparent 50%);
    background-position:
        calc(100% - 16px) calc(50% - 2px),
        calc(100% - 11px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.conversation-filter-select:hover {
    border-color: var(--accent, #0f766e);
}
.conversation-filter-select:focus-visible {
    outline: 2px solid var(--focus-color, var(--accent));
    outline-offset: 1px;
}
.archive-filter-fields {
    display: grid;
    gap: 8px;
}
.archive-filter-agent,
.archive-filter-dates label {
    display: grid;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}
.archive-filter-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.archive-filter-fields input,
.archive-filter-fields select {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 8px;
    background: #fbfcfb;
    font: inherit;
}
.archive-filter-fields input:focus,
.archive-filter-fields select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
    background: #fff;
}
.end-chat-visitor-line {
    margin: 0 0 8px;
    font-weight: 700;
}
@media (max-width: 900px) {
    .conversation-close-btn {
        opacity: 1;
        pointer-events: auto;
    }
    .archive-filter-dates {
        grid-template-columns: 1fr;
    }
}
.conversation-item.is-unread .conversation-top strong,
.conversation-item.is-unread .preview,
.conversation-item.has-unread .conversation-top strong,
.conversation-item.has-unread .preview {
    color: var(--ink);
    font-weight: 800;
}
.list-avatar, .visitor-avatar {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    color: var(--accent-ink);
    background: linear-gradient(160deg, #e7f8f4, #d3efe9);
}
.conversation-copy { min-width: 0; flex: 1; padding-right: 4px; }
.conversation-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conversation-top strong { overflow: hidden; font-size: 14px; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.preview { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.unread {
    display: grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    color: #fff;
    background: #dc2626;
    font-size: 10px;
    font-weight: 800;
}
.end-chat-button {
    width: 38px;
    min-width: 38px;
    flex: 0 0 38px;
    padding: 0;
    overflow: hidden;
}
.empty-list { padding: 38px 18px; color: #8a9c96; font-size: 13px; text-align: center; }
.operator-footer { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.operator-avatar { width: 36px; height: 36px; color: #4d615b; background: #e2ebe7; }
.operator-copy { min-width: 0; flex: 1; }
.operator-copy strong, .operator-copy span { display: block; }
.operator-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.operator-copy span { margin-top: 2px; color: #8a9c96; font-size: 11px; }
.logout-button { border: 0; color: var(--muted); background: transparent; font-size: 12px; }

.chat-area {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: var(--canvas);
}
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.empty-state[hidden], .chat-panel[hidden] { display: none !important; }
.empty-state { display: grid; height: 100%; place-content: center; justify-items: center; padding: 24px; text-align: center; }
.empty-icon {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    border-radius: 22px;
    color: var(--accent);
    background: linear-gradient(160deg, #ffffff, #e7f5f1);
    box-shadow: var(--shadow-soft);
}
.empty-icon svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.empty-state h2 { margin: 18px 0 6px; font-size: 24px; letter-spacing: -.03em; }
.empty-state p { margin: 0; max-width: 320px; color: var(--muted); line-height: 1.55; }
.chat-panel {
    position: relative;
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    animation: panel-in .22s ease;
}
.chat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: 72px minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
    flex: 1;
}
.chat-layout.details-hidden,
.chat-panel.details-collapsed .chat-layout {
    grid-template-columns: minmax(0, 1fr);
}
.chat-layout.details-hidden .conversation-header,
.chat-layout.details-hidden .conversation-main,
.chat-panel.details-collapsed .chat-layout .conversation-header,
.chat-panel.details-collapsed .chat-layout .conversation-main {
    grid-column: 1;
}
.chat-layout.details-hidden .visitor-panel,
.chat-panel.details-collapsed .visitor-panel {
    display: none !important;
}
.reply-drop-overlay {
    position: absolute;
    z-index: 40;
    inset: 12px;
    display: grid;
    place-items: center;
    border: 2px dashed var(--accent);
    border-radius: 18px;
    background: rgba(238, 248, 245, .94);
    pointer-events: none;
}
.reply-drop-overlay[hidden] { display: none !important; }
.reply-drop-overlay-card {
    display: grid;
    max-width: 320px;
    gap: 6px;
    padding: 18px;
    text-align: center;
}
.reply-drop-overlay-card strong { color: var(--accent-ink); font-size: 15px; }
.reply-drop-overlay-card span { color: var(--muted); font-size: 12px; line-height: 1.45; }
@keyframes panel-in {
    from { opacity: .55; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
.chat-header,
.conversation-header {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    min-height: 72px;
    height: 72px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border, var(--line));
    background: var(--panel-bg, #fff);
}
.conversation-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}
.conversation-header-actions,
.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.visitor-info { min-width: 0; flex: 1; }
.visitor-info h2 { margin: 0; overflow: hidden; font-size: 16px; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.visitor-info span { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.header-icon-button {
    display: inline-grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: #4d615b;
    background: #eef3f1;
}
.header-icon-button:hover { background: #e2ebe7; border-color: #c3d4ce; }
.header-icon-button[hidden] { display: none !important; }
.header-icon-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.header-icon-button svg[hidden],
.header-icon-button .icon-details-show,
.header-icon-button .icon-unarchive {
    display: none !important;
}
.header-icon-button.is-alt .icon-details-hide,
.header-icon-button.is-alt .icon-archive {
    display: none !important;
}
.header-icon-button.is-alt .icon-details-show,
.header-icon-button.is-alt .icon-unarchive {
    display: block !important;
}
.header-icon-button.is-danger { color: var(--danger); }
.header-icon-button.is-danger:hover {
    background: var(--danger-soft);
    border-color: #f0c2bd;
}
.back-button { display: none; border: 0; background: transparent; font-size: 24px; }
.transfer-picker { position: relative; flex: 0 0 auto; }
.transfer-picker[hidden] { display: none !important; }
.transfer-picker .header-icon-button:disabled { opacity: .55; }
.transfer-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    width: min(280px, calc(100vw - 40px));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.transfer-menu[hidden] { display: none !important; }
.transfer-menu-title {
    padding: 10px 13px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.transfer-agent-list { max-height: 260px; overflow-y: auto; }
.transfer-agent-item {
    display: grid;
    width: 100%;
    gap: 2px;
    padding: 11px 13px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink);
    background: #fff;
    text-align: left;
}
.transfer-agent-item:last-child { border-bottom: 0; }
.transfer-agent-item:hover { background: var(--accent-soft); }
.transfer-agent-item strong { font-size: 13px; }
.transfer-agent-item small { color: var(--muted); font-size: 11px; }
.transfer-empty {
    padding: 16px 13px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}
.ban-picker { position: relative; }
.ban-picker[hidden] { display: none !important; }
.danger-button { color: var(--danger) !important; }
.ban-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    width: min(320px, calc(100vw - 40px));
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.ban-menu[hidden] { display: none !important; }
.ban-menu-title {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.ban-menu label { display: grid; gap: 6px; color: #334843; font-size: 12px; font-weight: 700; }
.ban-menu input, .ban-menu select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #c9d6d1;
    border-radius: 8px;
    font: inherit;
}
.ban-duration-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px; }
.attach-button {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: #4d615b;
    background: #fff;
    cursor: pointer;
}
.attach-button[hidden] { display: none !important; }
.attach-button input { display: none; }
.attach-button svg { width: 18px; height: 18px; }
.attach-button:hover { background: var(--canvas); }
.file-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f6faf8;
    font-size: 12px;
}
.file-chip[hidden] { display: none !important; }
.reply-file-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}
.reply-file-copy strong,
.reply-file-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reply-file-copy small { color: var(--muted); font-size: 10px; font-weight: 600; }
.file-chip button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
}
.chat-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
    word-break: break-word;
}
.admin-message.operator .chat-link {
    color: #fff;
    text-decoration-color: rgba(255, 255, 255, .75);
}
.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(221, 231, 227, .95);
    border-radius: 10px;
    color: inherit;
    background: rgba(255, 255, 255, .55);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}
.operator .message-attachment,
.admin-message.operator .message-attachment {
    border-color: rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .14);
}
.message-attachment small { opacity: .75; font-weight: 500; }
.message-attachment-media {
    display: block;
    margin-top: 8px;
    max-width: min(360px, 100%);
    overflow: hidden;
    border: 1px solid rgba(221, 231, 227, .95);
    border-radius: 14px;
    background: rgba(15, 31, 28, .04);
    text-decoration: none;
    color: inherit;
}
.admin-message.operator .message-attachment-media {
    border-color: rgba(255, 255, 255, .22);
    background: rgba(0, 0, 0, .14);
}
.message-attachment-image {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    cursor: pointer;
}
.message-attachment-video {
    display: block;
    width: 100%;
    max-height: 320px;
    background: #000;
}
.message-attachment-caption {
    display: block;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 600;
    opacity: .8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conversation-main,
.chat-thread {
    grid-column: 1;
    grid-row: 2;
    position: relative;
    display: flex;
    min-height: 0;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
}
.message-list {
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 22px 24px;
    background:
        radial-gradient(circle at 12% 8%, rgba(15, 118, 110, .05), transparent 28%),
        linear-gradient(180deg, #f7faf9 0%, #eef3f1 100%);
}
.reply-composer,
.reply-form {
    flex: 0 0 auto;
}
.scroll-bottom-button {
    position: absolute;
    z-index: 6;
    left: 50%;
    bottom: 118px;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    color: var(--accent-ink);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 20px rgba(15, 31, 28, .12);
    font-size: 12px;
    font-weight: 700;
}
.scroll-bottom-button[hidden] { display: none !important; }
.visitor-details-backdrop {
    position: absolute;
    z-index: 15;
    inset: 0;
    border: 0;
    background: rgba(15, 31, 28, .28);
}
.visitor-details-backdrop[hidden] { display: none !important; }
.visitor-details,
.visitor-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid var(--panel-border, var(--line));
    background: var(--panel-bg, #fff);
}
.visitor-panel-header,
.visitor-details > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
    height: 72px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border, var(--line));
    background: var(--panel-bg, #fff);
    flex: 0 0 auto;
}
.visitor-panel-heading { min-width: 0; }
.visitor-panel-eyebrow,
.visitor-details > header .eyebrow {
    display: block;
}
.visitor-panel-header h2,
.visitor-panel-header h3,
.visitor-details > header h2,
.visitor-details > header h3 {
    margin: 4px 0 0;
    font-size: 16px;
    letter-spacing: -.02em;
}
.visitor-panel-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    margin: 0;
}
.visitor-details-content,
.visitor-panel-content {
    min-height: 0;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
}
.visitor-details-empty { margin: 8px 0; color: #8a9c96; font-size: 13px; }
.visitor-detail-group {
    padding: 0;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}
.visitor-detail-group + .visitor-detail-group { margin-top: 10px; }
.visitor-detail-group > h4 {
    margin: 0;
    padding: 11px 12px;
    border: 0;
    background: #f8fbfa;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}
.visitor-detail-group > h4::after {
    content: '▾';
    float: right;
    color: var(--muted);
    font-weight: 700;
}
.visitor-detail-group.is-collapsed > h4::after { content: '▸'; }
.visitor-detail-group > dl,
.visitor-detail-group > .visitor-history-list,
.visitor-detail-group > .visitor-tool-row,
.visitor-detail-group > .visitor-tag-list,
.visitor-detail-group > .visitor-note-list,
.visitor-detail-group > .visitor-tool-input,
.visitor-detail-group > .secondary-button,
.visitor-detail-group > #visitor-identity-summary,
.visitor-detail-group > .customer-search-results {
    padding-left: 12px;
    padding-right: 12px;
}
.visitor-detail-group > dl { margin: 0; padding: 4px 12px 10px; }
.visitor-detail-group.is-collapsed > *:not(h4) { display: none !important; }
.visitor-detail-group:not(.is-collapsed) > .visitor-tool-input,
.visitor-detail-group:not(.is-collapsed) > .secondary-button,
.visitor-detail-group:not(.is-collapsed) > .visitor-tool-row,
.visitor-detail-group:not(.is-collapsed) > .visitor-history-list,
.visitor-detail-group:not(.is-collapsed) > .visitor-tag-list,
.visitor-detail-group:not(.is-collapsed) > .visitor-note-list,
.visitor-detail-group:not(.is-collapsed) > .customer-search-results {
    margin: 0 0 10px;
}
.visitor-detail-group h4 {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.visitor-detail-row {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 12px;
    line-height: 1.45;
}
.visitor-detail-row:last-child { border-bottom: 0; }
.visitor-history-list { display: grid; gap: 8px; }
.visitor-history-summary {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
}
.visitor-history-hint { margin: 0; }
.conversation-session-separator {
    display: grid;
    justify-items: center;
    gap: 4px;
    margin: 22px 0 16px;
    padding: 0 8px;
    color: var(--muted);
    text-align: center;
}
.conversation-session-separator::before {
    content: "";
    width: 100%;
    height: 1px;
    background: var(--panel-border, var(--line));
}
.conversation-session-separator .session-label {
    margin-top: -12px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef3f1;
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.conversation-session-separator .session-date {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
}
.conversation-session-separator .session-meta {
    font-size: 11px;
    line-height: 1.4;
}
.admin-message.is-history { opacity: .92; }
.timeline-status {
    margin: 8px auto 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    width: fit-content;
    max-width: 92%;
}
.timeline-status.is-error {
    color: #9a3412;
    border-color: #f0c2bd;
    background: #fff7ed;
}
.visitor-tool-input {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-size: 12px;
}
.visitor-tool-input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.visitor-tool-row { display: flex; align-items: center; gap: 6px; }
.visitor-note-input { min-height: 76px; margin-bottom: 7px; resize: vertical; }
.customer-search-results,
.visitor-note-list { display: grid; gap: 7px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.customer-search-result,
.visitor-note {
    display: grid;
    gap: 2px;
    padding: 9px;
    border: 1px solid var(--line-soft);
    border-radius: 9px;
    background: #f8fbfa;
}
.customer-search-result strong { color: var(--ink); font-size: 12px; }
.customer-search-result span,
.customer-search-result small,
.visitor-note small { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.visitor-note p { margin: 0; color: var(--ink); font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.visitor-tag-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.visitor-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 7px;
    border-radius: 999px;
    color: #9f1239;
    background: #ffe4e6;
    font-size: 10px;
    font-weight: 800;
}
.visitor-tag button { padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; }
.visitor-history-item .history-tags { color: #9f1239; font-weight: 700; }
.history-load-more { width: 100%; margin-top: 8px; }
.feature-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; }
.feature-modal[hidden] { display: none !important; }
.feature-modal-backdrop { position: absolute; inset: 0; border: 0; background: rgba(15, 31, 28, .5); }
.feature-modal-card {
    position: relative;
    display: flex;
    width: min(760px, 100%);
    max-height: min(760px, calc(100dvh - 36px));
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}
.feature-modal-card.compact { width: min(440px, 100%); }
.feature-modal-card > header,
.feature-modal-card > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.feature-modal-card > footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.feature-modal-card h3 { margin: 3px 0 0; }
.feature-modal-body { display: grid; gap: 14px; padding: 16px; }
.feature-modal-body p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.feature-modal-body label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; }
.feature-modal-body select, .feature-modal-body input, .feature-modal-body textarea {
    padding: 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit;
}
.history-message-list { min-height: 240px; overflow-y: auto; padding: 20px; background: var(--canvas); }
.history-message-list .admin-message { margin-bottom: 10px; }
.visitor-detail-row dt { color: #8a9c96; }
.visitor-detail-row dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.visitor-detail-row a { color: var(--accent); text-decoration: none; font-weight: 600; }
.visitor-detail-row a:hover { text-decoration: underline; }
.visitor-detail-muted { color: #8a9c96; }
.admin-message { display: flex; margin: 12px 0; animation: bubble-in .18s ease; }
@keyframes bubble-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
.admin-message.operator { justify-content: flex-end; }
.admin-message { word-break: break-word; overflow-wrap: anywhere; }
.admin-message.is-grouped { margin-top: 4px; }
.admin-message.is-grouped .message-meta { opacity: .55; }
.admin-bubble {
    max-width: min(78%, 640px);
    padding: 12px 14px;
    border: 1px solid rgba(226, 235, 231, .95);
    border-radius: 18px 18px 18px 7px;
    background: #fff;
    box-shadow: var(--shadow-soft);
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.operator .admin-bubble {
    border-color: transparent;
    border-radius: 18px 18px 7px 18px;
    color: #fff;
    background: linear-gradient(155deg, #14968c, #0f766e);
    box-shadow: 0 8px 18px rgba(15, 118, 110, .18);
}
.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
    opacity: .7;
    font-size: 10px;
    font-weight: 600;
}
.admin-message.visitor .message-meta,
.admin-message.system .message-meta { justify-content: flex-start; }
.receipts {
    display: inline-flex;
    align-items: center;
    letter-spacing: -3px;
    font-size: 12px;
    line-height: 1;
    opacity: .78;
    color: rgba(255, 255, 255, .78);
}
.receipts.is-read {
    color: #53bdeb;
    opacity: 1;
}
.typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0 max(20px, calc((100% - 850px) / 2)) 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}
.typing-indicator.show { display: flex; }
.typing-indicator[hidden] { display: none !important; }
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 16px 16px 16px 7px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}
.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 70%, #94a3b8);
    animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
    0%, 80%, 100% { opacity: .35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}
.reply-form,
.reply-composer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--panel-border, var(--line));
    background: var(--panel-bg, rgba(255, 255, 255, .96));
    backdrop-filter: blur(12px);
}
.reply-input-wrap {
    position: relative;
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}
.reply-form textarea {
    width: 100%;
    min-height: 46px;
    max-height: 140px;
    flex: 1;
    resize: none;
    padding: 12px 14px;
    border: 1px solid #d0ddd8;
    border-radius: 16px;
    background: #fbfcfb;
    outline: none;
    font-size: 15px;
    line-height: 1.4;
}
.reply-send-button {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 8px 16px rgba(15, 118, 110, .22);
}
.reply-send-button:hover:not(:disabled) { background: var(--accent-hover); }
.reply-send-button:active:not(:disabled) { transform: scale(.96); }
.reply-send-button:disabled { opacity: .55; box-shadow: none; }
.reply-send-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.canned-suggest[hidden] { display: none !important; }
.canned-suggest {
    position: absolute;
    z-index: 14;
    right: 0;
    bottom: calc(100% + 8px);
    left: 0;
    max-height: 280px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.canned-suggest-title {
    padding: 10px 13px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
#canned-suggest-list { overflow-y: auto; }
.canned-suggest-item {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 8px;
    padding: 11px 13px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink);
    background: #fff;
    text-align: left;
}
.canned-suggest-item:last-child { border-bottom: 0; }
.canned-suggest-item:hover,
.canned-suggest-item.active { background: var(--accent-soft); }
.canned-suggest-item strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.canned-suggest-item span { color: var(--accent); font-family: Consolas, monospace; font-size: 10px; }
.canned-suggest-item small {
    grid-column: 1 / -1;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.canned-suggest-empty { padding: 18px 13px; color: #8a9c96; font-size: 12px; text-align: center; }
.canned-picker { position: relative; flex: 0 0 auto; }
.canned-picker-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid #c9d6d1;
    border-radius: 12px;
    color: #4d615b;
    background: #fff;
}
.canned-picker-button:hover { color: var(--accent); border-color: #9fd0c8; background: var(--accent-soft); }
.canned-picker-button:disabled { opacity: .45; cursor: not-allowed; }
.canned-picker-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.canned-picker-menu[hidden] { display: none !important; }
.canned-picker-menu {
    position: absolute;
    z-index: 12;
    bottom: calc(100% + 10px);
    left: 0;
    width: min(330px, calc(100vw - 28px));
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}
.canned-picker-title { position: sticky; top: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; font-size: 12px; font-weight: 800; }
.canned-option { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; padding: 11px 13px; border: 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); background: #fff; text-align: left; }
.canned-option:hover { background: #f4f8f6; }
.canned-option strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.canned-option span { color: var(--accent); font-family: Consolas, monospace; font-size: 10px; }
.canned-option small { grid-column: 1 / -1; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.canned-picker-empty { padding: 20px 13px; color: #8a9c96; font-size: 12px; text-align: center; }
.toast {
    position: fixed;
    z-index: 20;
    right: 22px;
    bottom: 22px;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 12px;
    color: #fff;
    background: var(--nav);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: .2s ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

.realtime-status {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 40;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: rgba(15, 35, 31, 0.88);
    color: #d7efe8;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}
.realtime-status[data-mode="live"] { background: rgba(15, 118, 110, 0.92); }
.realtime-status[data-mode="fallback"] { background: rgba(146, 104, 16, 0.92); }
.realtime-status[data-mode="reconnect"] { background: rgba(55, 65, 81, 0.92); }
.realtime-status[hidden] { display: none !important; }

.dashboard.settings-view { grid-template-columns: var(--nav-width) minmax(0, 1fr); }
.dashboard.settings-view .sidebar { display: none; }
.settings-page[hidden] { display: none !important; }
.settings-page { height: 100%; overflow-y: auto; background: var(--canvas); }
.settings-page-header {
    padding: 30px clamp(22px, 4vw, 52px) 23px;
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(circle at 90% 0%, rgba(15, 118, 110, .08), transparent 34%),
        #fff;
}
.settings-page-header h2 { margin: 5px 0 6px; font-size: 30px; letter-spacing: -.03em; }
.settings-page-header p { margin: 0; color: var(--muted); font-size: 14px; }
.reports-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.reports-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}
.reports-filter label {
    display: grid;
    gap: 6px;
    color: #334843;
    font-size: 12px;
    font-weight: 700;
}
.reports-filter input[type="date"] {
    min-width: 150px;
    padding: 9px 11px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    background: #fff;
    outline: none;
}
.reports-filter input[type="date"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.reports-filter-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reports-body { padding: 22px clamp(22px, 4vw, 52px) 32px; display: grid; gap: 18px; }
.reports-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.report-metric {
    padding: 16px 16px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(216, 243, 238, .45), rgba(255, 255, 255, .96) 42%),
        #fff;
    box-shadow: var(--shadow-soft);
}
.report-metric span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.report-metric strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
    letter-spacing: -.03em;
    line-height: 1.1;
}
.report-metric em {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}
.report-metric.is-warn {
    background:
        linear-gradient(180deg, rgba(254, 243, 242, .7), rgba(255, 255, 255, .96) 42%),
        #fff;
}
.report-metric.is-warn strong { color: var(--danger); }
.reports-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 18px;
}
.reports-panel { margin: 0; }
.reports-table-wrap { overflow: auto; }
.reports-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.reports-table th,
.reports-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}
.reports-table th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: #f7faf8;
}
.reports-table tbody tr:hover { background: #f8fbfa; }
.reports-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.reports-table .muted { color: var(--muted); }
.report-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-soft);
    color: var(--accent-ink);
}
.report-pill.is-warn { background: var(--danger-soft); color: var(--danger); }
.report-pill.is-ok { background: var(--success-soft); color: var(--success); }
.report-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}
.report-bar-track {
    flex: 1;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eeeb;
}
.report-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #14968c, var(--accent));
}
.report-agent-name { display: grid; gap: 2px; }
.report-agent-name strong { font-size: 13px; }
.report-agent-name span { color: var(--muted); font-size: 12px; }
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 115px); }
.settings-subnav {
    position: sticky;
    top: 0;
    display: flex;
    min-height: calc(100vh - 115px);
    flex-direction: column;
    gap: 16px;
    align-self: start;
    padding: 20px 12px;
    border-right: 1px solid var(--line);
    background: #fff;
}
.settings-nav-group { display: grid; gap: 4px; }
.settings-nav-label {
    padding: 0 12px 4px;
    color: #8a9c96;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.settings-tab {
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--muted);
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
}
.settings-tab:hover { color: var(--accent-ink); background: #f4f8f6; }
.settings-tab.active { color: var(--accent-ink); background: var(--accent-soft); }
.settings-content { display: grid; width: min(1180px, calc(100% - 36px)); gap: 22px; margin: 25px auto 50px; }
.settings-section[hidden] { display: none !important; }
.settings-section {
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-soft);
}
.settings-section-split { padding: 26px 22px; }
.section-heading { margin-bottom: 20px; }
.section-heading h3 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.settings-section .settings-form { padding: 0; }
.widget-settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 22px;
    align-items: stretch;
}
.widget-settings-main { display: grid; gap: 16px; min-width: 0; }
.settings-block {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fbfa;
}
.settings-block-spaced { margin-top: 16px; }
.timeout-rule {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.timeout-rule:first-of-type { margin-top: 4px; padding-top: 0; border-top: 0; }
.timeout-minutes-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}
.timeout-minutes-field input {
    width: 84px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #c9d6d1;
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    font-weight: 700;
}
.conversation-item[data-status="inactive"] { opacity: .9; }
.conversation-item[data-status="inactive"] .list-avatar {
    background: #fef0c7;
    color: #93370d;
}
.admin-message.system { justify-content: center; }
.admin-message.system .admin-bubble {
    max-width: min(86%, 520px);
    border-radius: 12px;
    color: var(--muted);
    background: #eef3f1;
    text-align: center;
    font-size: 12px;
}
.settings-block-head { margin-bottom: 14px; }
.settings-block-head h4 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.settings-block-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.widget-preview-aside {
    position: relative;
    min-width: 0;
    align-self: stretch;
}
.widget-preview-sticky {
    position: sticky;
    top: 16px;
    display: grid;
    gap: 10px;
    max-height: calc(100vh - 32px);
    overflow: auto;
    overscroll-behavior: contain;
}
.widget-preview-toolbar strong {
    display: block;
    margin-top: 3px;
    font-size: 14px;
}
.widget-preview-note {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}
.assignment-mode-label { display: block; color: #334843; font-size: 13px; font-weight: 700; }
.assignment-mode-label select {
    display: block;
    width: min(430px, 100%);
    margin-top: 7px;
    padding: 11px 12px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    color: var(--ink);
    background: #fff;
    font: inherit;
    outline: none;
}
.assignment-mode-label select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.auto-limit-label { display: block; width: min(430px, 100%); margin-top: 16px; color: #334843; font-size: 13px; font-weight: 700; }
.auto-limit-label[hidden] { display: none !important; }
.auto-limit-label input {
    display: block;
    width: 100%;
    margin-top: 7px;
    padding: 11px 12px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    font: inherit;
    outline: none;
}
.auto-limit-label input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.auto-limit-label small { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; line-height: 1.45; }
.setting-help { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.assignment-actions { margin-top: 16px; }
.color-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
}
.color-field input[type="color"] {
    width: 44px;
    height: 42px;
    padding: 3px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    background: #fff;
}
.color-field input[type="text"],
.color-field input:not([type="color"]) {
    margin-top: 0 !important;
}
.widget-switch { margin-top: 22px; }
#widget-settings-form select {
    width: 100%;
    margin-top: 7px;
    padding: 10px 11px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    background: #fff;
    font: inherit;
    outline: none;
}
#widget-settings-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.welcome-screen-fields { margin-top: 14px; }
.welcome-screen-fields[hidden] { display: none !important; }
.settings-block .settings-footer { margin-top: 4px; }
.widget-settings-main > .settings-footer {
    position: sticky;
    bottom: 0;
    margin: 0;
    padding: 12px 0 0;
    background: linear-gradient(180deg, transparent, #fff 28%);
}
.welcome-links-block { margin-top: 18px; }
.welcome-links-list { display: grid; gap: 8px; margin-top: 10px; }
.welcome-link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fbfa;
}
.welcome-link-row label { margin: 0; }
.welcome-link-row input {
    width: 100%;
    margin-top: 6px;
    padding: 9px 10px;
    border: 1px solid #c9d6d1;
    border-radius: 8px;
    font: inherit;
    font-size: 12px;
    outline: none;
}
.welcome-link-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.widget-preview-stage {
    padding: 18px 16px 20px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background:
        radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--widget-preview-color, #0f766e) 12%, transparent), transparent 40%),
        linear-gradient(180deg, #eef4f1, #f7faf8);
}
.widget-preview-card {
    --widget-preview-color: #0f766e;
    --widget-preview-font: #12231f;
    --widget-preview-on: #fff;
    position: relative;
    min-height: 560px;
    padding: 0 0 72px;
}
.widget-preview-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 520px;
    max-height: 620px;
    overflow: hidden;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 28px 60px rgba(15, 31, 28, .16), 0 0 0 1px rgba(15, 31, 28, .04);
}
.widget-preview-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 14px;
    overflow: hidden;
    color: var(--widget-preview-on, #fff);
    background: linear-gradient(155deg, color-mix(in srgb, var(--widget-preview-color, #0f766e) 78%, #fff), var(--widget-preview-color, #0f766e) 55%, color-mix(in srgb, var(--widget-preview-color, #0f766e) 88%, #000));
}
.widget-preview-header:before {
    content: "";
    position: absolute;
    right: -24px;
    top: -30px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    pointer-events: none;
}
.widget-preview-avatar {
    position: relative;
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--widget-preview-on, #fff) 18%, transparent);
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--widget-preview-on, #fff) 22%, transparent);
}
.widget-preview-headcopy { position: relative; min-width: 0; flex: 1; }
.widget-preview-header strong,
.widget-preview-header small { display: block; }
.widget-preview-header strong {
    overflow: hidden;
    font-size: 14px;
    letter-spacing: -.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.widget-preview-header small {
    margin-top: 3px;
    opacity: .9;
    font-size: 11px;
    font-weight: 500;
}
.widget-preview-close {
    position: relative;
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--widget-preview-on, #fff) 16%, transparent);
    font-size: 20px;
    line-height: 1;
}
.widget-preview-welcome-screen {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    isolation: isolate;
    background:
        radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--widget-preview-color, #0f766e) 22%, transparent), transparent 55%),
        radial-gradient(90% 70% at 100% 10%, color-mix(in srgb, var(--widget-preview-color, #0f766e) 14%, transparent), transparent 50%),
        linear-gradient(165deg, #f7fbf9 0%, #fff 42%, color-mix(in srgb, var(--widget-preview-color, #0f766e) 6%, #fff) 100%);
}
.widget-preview-welcome-screen:before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .45;
    background-image: radial-gradient(rgba(15, 31, 28, .05) 1px, transparent 1px);
    background-size: 18px 18px;
    mask-image: linear-gradient(180deg, #000 20%, transparent 85%);
}
.widget-preview-welcome-hero {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 22px 18px 14px;
    overflow: auto;
}
.widget-preview-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.widget-preview-mark {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    place-items: center;
    overflow: hidden;
    border-radius: 16px;
    color: var(--widget-preview-on, #fff);
    background: linear-gradient(155deg, color-mix(in srgb, var(--widget-preview-color, #0f766e) 78%, #fff), var(--widget-preview-color, #0f766e) 55%, color-mix(in srgb, var(--widget-preview-color, #0f766e) 88%, #000));
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.03em;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--widget-preview-color, #0f766e) 28%, transparent), 0 1px 0 rgba(255, 255, 255, .28) inset;
}
.widget-preview-mark.has-logo {
    background: #fff;
    box-shadow: 0 10px 20px rgba(15, 31, 28, .12), 0 0 0 1px rgba(15, 31, 28, .06);
}
.widget-preview-mark-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.widget-preview-mark-image[hidden],
.widget-preview-mark-fallback[hidden] { display: none !important; }
.brand-logo-field {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.brand-logo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}
.brand-logo-preview {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    overflow: hidden;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(155deg, #14968c, var(--accent));
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(15, 118, 110, .22);
}
.brand-logo-preview.has-logo {
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 31, 28, .1), 0 0 0 1px var(--line);
}
.brand-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.brand-logo-preview img[hidden],
.brand-logo-preview span[hidden] { display: none !important; }
.brand-logo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.brand-logo-upload { cursor: pointer; }
.widget-preview-brand-copy { display: grid; gap: 3px; min-width: 0; }
.widget-preview-eyebrow {
    overflow: hidden;
    color: var(--widget-preview-font, #12231f);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.widget-preview-brand-sub {
    color: color-mix(in srgb, var(--widget-preview-font, #12231f) 58%, #fff);
    font-size: 11px;
    font-weight: 600;
}
.widget-preview-welcome-title {
    margin: 0;
    max-width: 16ch;
    color: var(--widget-preview-font, #12231f);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1.12;
}
.widget-preview-welcome-message {
    margin: 12px 0 0;
    max-width: 34ch;
    color: color-mix(in srgb, var(--widget-preview-font, #12231f) 58%, #fff);
    font-size: 13px;
    line-height: 1.6;
}
.widget-preview-links {
    display: grid;
    gap: 8px;
    margin-top: 20px;
}
.widget-preview-links:empty { display: none; margin: 0; }
.widget-preview-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--widget-preview-color, #0f766e) 18%, #e2ebe7);
    border-radius: 14px;
    color: var(--widget-preview-font, #12231f);
    background: rgba(255, 255, 255, .72);
    font-size: 12.5px;
    font-weight: 700;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset;
}
.widget-preview-link:after {
    content: "";
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-right: 2px solid color-mix(in srgb, var(--widget-preview-font, #12231f) 45%, transparent);
    border-top: 2px solid color-mix(in srgb, var(--widget-preview-font, #12231f) 45%, transparent);
    transform: rotate(45deg);
    opacity: .7;
}
.widget-preview-welcome-actions {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 14px 16px 16px;
    border-top: 1px solid color-mix(in srgb, #e2ebe7 80%, transparent);
    background: linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .96));
    backdrop-filter: blur(10px);
}
.widget-preview-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    padding: 12px 16px;
    border: 0;
    border-radius: 14px;
    color: var(--widget-preview-on, #fff);
    background: linear-gradient(155deg, color-mix(in srgb, var(--widget-preview-color, #0f766e) 82%, #fff), var(--widget-preview-color, #0f766e));
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -.01em;
    box-shadow: 0 10px 20px color-mix(in srgb, var(--widget-preview-color, #0f766e) 26%, transparent);
    cursor: default;
}
.widget-preview-footnote {
    display: block;
    margin-top: 10px;
    color: color-mix(in srgb, var(--widget-preview-font, #12231f) 58%, #fff);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
}
.widget-preview-footnote[hidden] { display: none !important; }
.widget-preview-chat-body {
    display: none;
    flex: 1;
    padding: 16px 14px;
    background: linear-gradient(180deg, #f6faf8, #eef4f1);
}
.widget-preview-chat-intro {
    margin: 4px auto 0;
    max-width: 280px;
    padding: 14px 15px;
    border: 1px solid color-mix(in srgb, var(--widget-preview-color, #0f766e) 14%, transparent);
    border-radius: 18px;
    color: color-mix(in srgb, var(--widget-preview-font, #12231f) 62%, #fff);
    background: rgba(255, 255, 255, .92);
    font-size: 12.5px;
    line-height: 1.55;
    text-align: center;
    box-shadow: 0 1px 2px rgba(15, 31, 28, .04);
}
.widget-preview-card.welcome-off .widget-preview-welcome-screen { display: none; }
.widget-preview-card.welcome-off .widget-preview-chat-body { display: block; }
.widget-preview-launcher {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 0;
    border-radius: 18px;
    color: var(--widget-preview-on, #fff);
    background: linear-gradient(160deg, color-mix(in srgb, var(--widget-preview-color, #0f766e) 82%, #fff), var(--widget-preview-color, #0f766e));
    box-shadow: 0 12px 28px color-mix(in srgb, var(--widget-preview-color, #0f766e) 32%, transparent), 0 2px 0 rgba(255, 255, 255, .18) inset;
    cursor: default;
}
.widget-preview-launcher svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.widget-preview-card.left .widget-preview-launcher { right: auto; left: 8px; }
.widget-preview-prechat {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 22px 18px 18px;
    overflow: auto;
    background: #fff;
    color: var(--widget-preview-font, #12231f);
}
.widget-preview-prechat-title {
    margin: 0 0 8px;
    color: var(--widget-preview-font, #12231f);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.25;
}
.widget-preview-prechat-description {
    margin: 0 0 16px;
    color: color-mix(in srgb, var(--widget-preview-font, #12231f) 58%, #fff);
    font-size: 12.5px;
    line-height: 1.55;
}
.widget-preview-prechat-description[hidden] { display: none !important; }
.widget-preview-prechat-field {
    display: block;
    margin-top: 12px;
    color: var(--widget-preview-font, #12231f);
    font-size: 12.5px;
    font-weight: 700;
}
.widget-preview-prechat-field span .req {
    margin-left: 2px;
    color: color-mix(in srgb, var(--widget-preview-color, #0f766e) 70%, #b91c1c);
    font-weight: 800;
}
.widget-preview-prechat-field input {
    width: 100%;
    margin-top: 6px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #d0ddd8;
    border-radius: 12px;
    background: #fbfcfb;
    color: var(--widget-preview-font, #12231f);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
}
.widget-preview-prechat-field[hidden] { display: none !important; }
.widget-preview-prechat-submit {
    width: 100%;
    margin-top: 18px;
    min-height: 44px;
    padding: 11px 14px;
    border: 0;
    border-radius: 12px;
    color: var(--widget-preview-on, #fff);
    background: linear-gradient(155deg, color-mix(in srgb, var(--widget-preview-color, #0f766e) 82%, #fff), var(--widget-preview-color, #0f766e));
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 10px 20px color-mix(in srgb, var(--widget-preview-color, #0f766e) 26%, transparent);
    cursor: default;
    pointer-events: none;
}
.widget-preview-prechat-off {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 24px 20px;
    background:
        radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--widget-preview-color, #0f766e) 16%, transparent), transparent 55%),
        #fff;
    text-align: center;
}
.widget-preview-prechat-off[hidden] { display: none !important; }
.widget-preview-prechat-off p {
    margin: 0;
    max-width: 240px;
    color: color-mix(in srgb, var(--widget-preview-font, #12231f) 62%, #fff);
    font-size: 13px;
    line-height: 1.55;
    font-weight: 600;
}
.widget-preview-card.prechat-off .widget-preview-prechat { display: none; }
.widget-preview-card.prechat-off .widget-preview-prechat-off { display: flex; }
.shortcut-list { display: grid; gap: 10px; margin-top: 18px; }
.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fbfa;
}
.shortcut-row > div:first-child { min-width: 0; }
.shortcut-row strong { display: block; font-size: 13px; }
.shortcut-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.shortcut-controls { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.shortcut-badge {
    display: inline-flex;
    min-width: 92px;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid #c9d6d1;
    border-radius: 8px;
    color: var(--accent-ink);
    background: #fff;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    font-weight: 700;
}
.shortcut-row.recording .shortcut-badge {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent);
}
.shortcut-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.embed-url-list { display: grid; gap: 12px; }
.embed-url-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.embed-url-row label {
    flex: 1;
    min-width: 0;
    color: #334843;
    font-size: 13px;
    font-weight: 700;
}
.embed-url-row input {
    width: 100%;
    margin-top: 7px;
    padding: 11px 12px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    color: var(--ink);
    background: #fff;
    font: inherit;
    outline: none;
}
.embed-url-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.embed-url-row input[readonly] { background: #f6faf8; color: #243833; }
.embed-url-row .secondary-button {
    align-self: end;
    margin-bottom: 1px;
    white-space: nowrap;
}
.allowed-origin-list {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}
.allowed-origin-empty {
    margin: 0;
    padding: 12px 14px;
    border: 1px dashed #d5e0dc;
    border-radius: 12px;
    color: var(--muted);
    font-size: 12px;
    background: #f7faf8;
}
.allowed-origin-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.allowed-origin-item code {
    overflow: hidden;
    color: var(--accent-ink);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.allowed-origin-item .secondary-button {
    flex: 0 0 auto;
    padding: 7px 10px;
    font-size: 12px;
}
.embed-url-row .embed-copy-button {
    margin-bottom: 1px;
    color: #4d615b;
    background: #eef3f1;
    border-color: var(--line);
}
.embed-url-row .embed-copy-button:hover {
    color: var(--accent-ink);
    background: var(--accent-soft);
    border-color: rgba(15, 118, 110, .28);
}
.embed-url-row .embed-copy-button.is-copied {
    color: var(--success);
    background: var(--success-soft);
    border-color: rgba(6, 118, 71, .28);
}
.embed-install-hint {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}
.embed-install-hint code {
    color: var(--accent-ink);
    font-size: 11px;
}
.embed-code-block {
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid #1a2925;
    border-radius: 14px;
    background: #101917;
}
.embed-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: #15211e;
}
.embed-code-label {
    color: #9bb0a9;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.embed-copy-button {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    color: #d8f3ee;
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .16);
}
.embed-copy-button:hover {
    color: #fff;
    background: rgba(15, 118, 110, .4);
    border-color: rgba(15, 118, 110, .6);
}
.embed-copy-button .icon-copied { display: none !important; }
.embed-copy-button.is-copied {
    color: #ecfdf3;
    background: rgba(6, 118, 71, .4);
    border-color: rgba(6, 118, 71, .6);
}
.embed-copy-button.is-copied .icon-copy { display: none !important; }
.embed-copy-button.is-copied .icon-copied { display: block !important; }
.embed-copy-button:disabled { opacity: .45; }
.embed-code {
    display: block;
    width: 100%;
    min-height: 128px;
    margin: 0;
    padding: 14px 14px 16px;
    border: 0;
    border-radius: 0;
    resize: vertical;
    color: #d8f3ee;
    background: transparent;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
    outline: none;
}
.embed-actions { display: flex; gap: 9px; margin-top: 13px; }
.preview-link { display: inline-flex; align-items: center; text-decoration: none; }
.agent-editor-modal[hidden] { display: none !important; }
.agent-editor-modal { position: fixed; z-index: 45; inset: 0; display: grid; place-items: center; padding: 20px; }
.agent-editor-backdrop { position: absolute; inset: 0; background: rgba(16, 25, 23, .58); backdrop-filter: blur(4px); }
.agent-editor-card {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: min(90vh, 860px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}
.agent-editor-card > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.agent-editor-card > header h3 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.02em; }
.agent-form { padding: 22px; border: 0; border-radius: 0; background: #fff; }
.agent-form label { display: block; color: #334843; font-size: 13px; font-weight: 700; }
.agent-form input:not([type="hidden"]) {
    width: 100%;
    margin-top: 7px;
    padding: 10px 11px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    font: inherit;
    outline: none;
}
.agent-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.agent-form label > small { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; }
.agent-list-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.password-field {
    position: relative;
    display: block;
    margin-top: 7px;
}
.password-field input {
    width: 100%;
    margin-top: 0 !important;
    padding-right: 44px !important;
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
    transform: translateY(-50%);
}
.password-toggle:hover { color: var(--accent-ink); background: #eef3f1; }
.password-toggle svg { width: 18px; height: 18px; display: block; }
.password-toggle .icon-eye-off[hidden],
.password-toggle .icon-eye[hidden] { display: none !important; }
.agent-photo-field { margin-top: 16px; }
.agent-photo-title { display: block; color: #334843; font-size: 13px; font-weight: 700; }
.agent-photo-control { display: flex; align-items: center; gap: 13px; margin-top: 8px; }
.agent-photo-preview {
    display: grid;
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    color: var(--accent-ink);
    background: var(--accent-soft);
    font-weight: 800;
}
.agent-photo-preview img, .agent-avatar img { width: 100%; height: 100%; object-fit: cover; }
.agent-photo-control input[type="file"] { margin: 0; padding: 7px; background: #fff; font-size: 12px; }
.agent-photo-control small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.remove-avatar-label { display: block; margin-top: 7px; color: var(--muted) !important; font-size: 11px !important; font-weight: 500 !important; }
.remove-avatar-label[hidden] { display: none !important; }
.remove-avatar-label input { width: auto !important; margin: 0 5px 0 0 !important; padding: 0 !important; }
.adjust-avatar-button { margin-top: 12px; }
.adjust-avatar-button[hidden] { display: none !important; }
.agent-form-actions { display: flex; gap: 9px; margin-top: 17px; }
.agent-form-actions [hidden] { display: none !important; }
.agent-list-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 24px 0 10px; }
.agent-list-header h4 { margin: 0; font-size: 15px; }
.agent-list { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.agent-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; align-items: center; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.agent-row:last-child { border-bottom: 0; }
.agent-availability-toggle {
    margin: 0;
    justify-self: end;
}
.agent-availability-toggle.is-disabled {
    opacity: .55;
    cursor: not-allowed;
    background: #f3f6f5;
}
.agent-avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    color: var(--accent-ink);
    background: var(--accent-soft);
    font-size: 12px;
    font-weight: 800;
}
.agent-copy { min-width: 0; }
.agent-copy strong, .agent-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-copy strong { font-size: 13px; }
.agent-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.agent-status { padding: 4px 8px; border-radius: 8px; font-size: 10px; font-weight: 800; }
.agent-status.active { color: var(--success); background: var(--success-soft); }
.agent-status.inactive { color: var(--muted); background: #eef3f1; }
.agent-actions { display: flex; gap: 6px; }
.compact-button { padding: 7px 9px; font-size: 11px; }
.canned-editor-modal[hidden] { display: none !important; }
.canned-editor-modal { position: fixed; z-index: 45; inset: 0; display: grid; place-items: center; padding: 20px; }
.canned-editor-backdrop { position: absolute; inset: 0; background: rgba(16, 25, 23, .58); backdrop-filter: blur(4px); }
.canned-editor-card {
    position: relative;
    width: min(640px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}
.canned-editor-card > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.canned-editor-card > header h3 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.02em; }
.canned-form { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #f6faf8; }
.canned-editor-card .canned-form { padding: 22px; border: 0; border-radius: 0; background: #fff; }
.canned-form label { display: block; color: #334843; font-size: 13px; font-weight: 700; }
.canned-form input:not([type="hidden"]), .canned-form textarea {
    width: 100%;
    margin-top: 7px;
    padding: 10px 11px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    font: inherit;
    outline: none;
    resize: vertical;
}
.canned-form input:focus, .canned-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.canned-form [hidden] { display: none !important; }
.canned-list-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.canned-list-tools input {
    width: min(300px, 34vw);
    padding: 8px 10px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 12px;
    outline: none;
}
.canned-list-tools input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.canned-list-tools select {
    padding: 8px 9px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    color: #334843;
    background: #fff;
    font: inherit;
    font-size: 12px;
    outline: none;
}
.canned-list-tools select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.canned-template-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
}
.canned-list { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.canned-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line-soft); }
.canned-row:last-child { border-bottom: 0; }
.canned-copy { min-width: 0; }
.canned-copy > div { display: flex; align-items: center; gap: 8px; }
.canned-copy strong { font-size: 13px; }
.canned-copy code { padding: 2px 5px; border-radius: 6px; color: var(--accent-ink); background: var(--accent-soft); font-size: 10px; }
.canned-copy p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.avatar-position-modal[hidden] { display: none !important; }
.avatar-position-modal { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; }
.avatar-position-backdrop { position: absolute; inset: 0; background: rgba(16, 25, 23, .62); backdrop-filter: blur(4px); }
.avatar-position-card {
    position: relative;
    width: min(460px, 100%);
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}
.avatar-position-card > header { display: flex; align-items: center; justify-content: space-between; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.avatar-position-card > header h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.02em; }
.avatar-editor-body { padding: 20px; text-align: center; }
.avatar-editor-body > p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.avatar-editor-body > small { display: block; margin-top: 13px; color: var(--muted); }
.avatar-crop-area {
    position: relative;
    width: min(300px, 78vw);
    aspect-ratio: 1;
    margin: auto;
    overflow: hidden;
    border-radius: 50%;
    background: #e2ebe7;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.avatar-crop-area.dragging { cursor: grabbing; }
.avatar-crop-area img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.avatar-crop-ring { position: absolute; inset: 0; border: 3px solid #fff; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(16, 25, 23, .18); pointer-events: none; }
.avatar-position-card > footer { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); background: #f6faf8; }

.modal[hidden] { display: none; }
.modal { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 25, 23, .55); backdrop-filter: blur(3px); }
.settings-card {
    position: relative;
    width: min(620px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}
.settings-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.settings-header h2 { margin: 4px 0 0; font-size: 21px; }
.modal-close { border: 0; color: var(--muted); background: transparent; font-size: 28px; line-height: 1; }
.settings-form { padding: 20px 24px 24px; }
.settings-form > label, .settings-grid label { display: block; color: #334843; font-size: 13px; font-weight: 700; }
.settings-form input[type="text"], .settings-form input:not([type]), .settings-form textarea {
    width: 100%;
    margin-top: 7px;
    padding: 10px 11px;
    border: 1px solid #c9d6d1;
    border-radius: var(--radius-sm);
    outline: none;
    resize: vertical;
}
.settings-form input:focus, .settings-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.switch-row { display: flex !important; align-items: center; justify-content: space-between; gap: 20px; padding: 14px; border-radius: 12px; background: #f6faf8; }
.switch-row span, .switch-row small { display: block; }
.switch-row small { margin-top: 4px; color: var(--muted); font-weight: 400; line-height: 1.4; }
.switch-row input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--accent); }
.check-options { display: grid; gap: 9px; margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.check-options label { color: #4d615b; font-size: 13px; }
.check-options input { margin-right: 7px; accent-color: var(--accent); }
.settings-footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

/* Laptop / smaller desktop: visitor details as right drawer */
@media (max-width: 1279px) {
    .dashboard {
        grid-template-columns: 72px minmax(280px, 320px) minmax(0, 1fr);
        --details-width: 0px;
    }
    .chat-layout,
    .chat-layout.details-hidden,
    .chat-panel.details-collapsed .chat-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .visitor-details,
    .visitor-panel {
        position: fixed;
        z-index: 40;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(360px, 92vw);
        grid-column: auto;
        grid-row: auto;
        border-left: 1px solid var(--line);
        box-shadow: -16px 0 36px rgba(15, 31, 28, .16);
    }
    .chat-layout.details-hidden .visitor-panel,
    .chat-panel.details-collapsed .visitor-panel,
    .chat-panel.details-collapsed .visitor-details {
        display: none !important;
    }
    .conversation-header,
    .conversation-main {
        grid-column: 1;
    }
}

@media (max-width: 1280px) {
    .header-secondary-action { display: none !important; }
}

@media (max-width: 1100px) {
    .dashboard {
        grid-template-columns: 72px minmax(260px, 300px) minmax(0, 1fr);
    }
    .nav-label { display: none; }
    .nav-item { min-height: 44px; }
}

@media (max-width: 760px) {
    .dashboard {
        display: block;
        height: 100vh;
        height: 100dvh;
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
        overflow-x: hidden;
    }
    .main-nav {
        position: fixed;
        z-index: 10;
        right: 0;
        bottom: 0;
        left: 0;
        height: calc(64px + env(safe-area-inset-bottom));
        flex-direction: row;
        align-items: center;
        padding: 6px 10px max(6px, env(safe-area-inset-bottom));
        border-top: 1px solid #1a2925;
        border-right: 0;
        background: rgba(13, 22, 20, .96);
        backdrop-filter: blur(14px);
    }
    .nav-brand { display: none; }
    .nav-menu { display: flex; flex: 1; justify-content: space-around; gap: 2px; }
    .nav-item { min-width: 48px; min-height: 44px; padding: 8px 10px; border-radius: 12px; }
    .nav-account { display: block; margin: 0; }
    .nav-account form { width: auto; }
    .nav-logout { margin: 0; }
    .sidebar {
        position: relative;
        z-index: 6;
        width: 100%;
        height: calc(100vh - 64px - env(safe-area-inset-bottom));
        height: calc(100dvh - 64px - env(safe-area-inset-bottom));
        border: 0;
        padding-top: env(safe-area-inset-top);
        background: var(--surface);
    }
    .sidebar.mobile-hidden { display: none; }
    .chat-area {
        position: fixed;
        z-index: 5;
        inset: 0 0 calc(64px + env(safe-area-inset-bottom));
        height: auto;
        background: transparent;
        pointer-events: none;
    }
    /* Saat chat dibuka, panel menutupi daftar. Saat list, chat-area transparan agar inbox terlihat. */
    .chat-area:has(.chat-panel.mobile-visible),
    .dashboard.settings-view .chat-area {
        z-index: 8;
        background: var(--canvas);
        pointer-events: auto;
    }
    .empty-state { display: none !important; }
    .chat-panel {
        display: none;
        height: 100%;
        background: var(--canvas);
        pointer-events: auto;
    }
    .chat-panel.mobile-visible { display: flex !important; }
    .settings-page { height: 100%; }
    .settings-page-header { padding: max(18px, env(safe-area-inset-top)) 16px 16px; }
    .reports-body { padding: 16px 16px 28px; }
    .reports-grid { grid-template-columns: 1fr; }
    .reports-filter { width: 100%; }
    .reports-filter input[type="date"] { width: 100%; min-width: 0; }
    .settings-layout { display: block; min-height: 0; }
    .settings-subnav {
        z-index: 2;
        min-height: 0;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 10px 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        scrollbar-width: none;
    }
    .settings-subnav::-webkit-scrollbar { display: none; }
    .settings-nav-group {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 4px;
    }
    .settings-nav-label { display: none; }
    .settings-tab { width: auto; flex: 0 0 auto; padding: 9px 12px; font-size: 12px; min-height: 38px; }
    .settings-content { width: calc(100% - 20px); margin: 12px auto 28px; }
    .settings-section { padding: 16px; border-radius: 16px; }
    .widget-settings-layout { grid-template-columns: 1fr; }
    .widget-preview-sticky { position: static; }
    .widget-preview-card { min-height: 0; padding-bottom: 68px; }
    .widget-preview-panel { min-height: 480px; max-height: none; }
    .shortcut-row { align-items: stretch; flex-direction: column; }
    .shortcut-controls { flex-wrap: wrap; }
    .shortcut-badge { min-width: 0; flex: 1; }
    .welcome-link-row { grid-template-columns: 1fr; }
    .embed-url-row { align-items: stretch; }
    .embed-url-row .embed-copy-button { align-self: flex-end; margin-bottom: 0; }
    .embed-code-toolbar { padding: 10px; }
    .embed-actions { flex-wrap: wrap; }
    .agent-row { grid-template-columns: 38px minmax(0, 1fr); }
    .agent-availability-toggle { justify-self: start; grid-column: 2; }
    .agent-actions { grid-column: 2; }
    .canned-row { grid-template-columns: minmax(0, 1fr) auto; }
    .canned-row .agent-actions { grid-column: 1 / -1; }
    .agent-list-header { align-items: stretch; flex-direction: column; gap: 9px; }
    .canned-list-tools input { width: 100%; }
    .canned-list-tools { align-items: stretch; flex-wrap: wrap; }
    .canned-list-tools input { flex: 1 0 100%; }
    .canned-editor-modal { padding: 0; }
    .canned-editor-card {
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
    }
    .agent-editor-modal { padding: 0; }
    .agent-editor-card {
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
    }
    .agent-list-tools { width: 100%; }
    .agent-list-tools .primary-button,
    .agent-list-tools .secondary-button { flex: 1; min-height: 42px; }
    .back-button { display: block; min-width: 40px; min-height: 40px; }
    .chat-header {
        padding: max(10px, env(safe-area-inset-top)) 12px 10px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .chat-header .secondary-button { padding: 8px 10px; font-size: 11px; min-height: 36px; }
    .chat-header .header-icon-button { width: 38px; height: 38px; flex-basis: 38px; }
    .chat-layout,
    .chat-layout.details-hidden,
    .chat-panel.details-collapsed .chat-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .chat-header-actions { flex-wrap: wrap; justify-content: flex-end; }
    .header-secondary-action { display: none !important; }
    .nav-label { display: none; }
    .nav-account {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .inbox-availability .availability-label { font-size: 11px; }
    .sidebar-header-actions { gap: 6px; }
    .visitor-details,
    .visitor-panel {
        position: fixed;
        z-index: 50;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: none;
        min-width: 0;
        box-shadow: none;
        border-left: 0;
    }
    .chat-layout.details-hidden .visitor-panel,
    .chat-panel.details-collapsed .visitor-panel,
    .chat-panel.details-collapsed .visitor-details {
        display: none !important;
    }
    .message-list { padding: 14px 12px; }
    .scroll-bottom-button { bottom: 104px; }
    .admin-bubble { max-width: 78%; }
    .reply-form {
        gap: 8px;
        padding: 10px 12px max(12px, env(safe-area-inset-bottom));
    }
    .reply-form textarea { font-size: 16px; min-height: 46px; }
    .modal { padding: 0; }
    .settings-card {
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
    }
    .settings-grid { grid-template-columns: 1fr; }
    .toast { bottom: calc(78px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(92vw, 360px); }
}
