:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #030712;
    color: #f8fafc;
    --bg: #030712;
    --surface: rgba(15, 23, 42, 0.92);
    --surface-strong: #0f172a;
    --surface-soft: #111827;
    --border: rgba(148, 163, 184, 0.22);
    --border-strong: rgba(148, 163, 184, 0.36);
    --text: #f8fafc;
    --muted: #cbd5e1;
    --muted-soft: #94a3b8;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #fca5a5;
    --success: #86efac;
    --warning: #f59e0b;
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    background: var(--bg);
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: #dbeafe;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
input,
textarea,
select {
    font-size: 16px;
}

button,
a,
input,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button {
    touch-action: manipulation;
}

.auth-shell {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: calc(24px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left));
    background:
        radial-gradient(circle at 50% 20%, rgba(37, 99, 235, 0.18), transparent 34%),
        linear-gradient(135deg, #020617 0%, #030712 48%, #0b1220 100%);
}

.auth-card {
    width: min(94vw, 460px);
    padding: clamp(28px, 5vw, 44px);
    border: 1px solid var(--border);
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.94));
    box-shadow: var(--shadow);
}

.auth-copy {
    margin-bottom: 28px;
    text-align: center;
}

.auth-copy h1 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(34px, 7vw, 46px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.055em;
}

.auth-copy p {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.field-group {
    display: grid;
    gap: 8px;
}

.field-group label,
label {
    color: #f8fafc;
    font-size: 14px;
    font-weight: 700;
}

.input-shell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.76);
    padding: 0 14px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-shell:focus-within {
    border-color: rgba(96, 165, 250, 0.9);
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.input-shell > span {
    flex: 0 0 auto;
    opacity: 0.86;
}

.input-shell input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: #ffffff;
    padding: 16px 0;
    font-size: 16px;
    line-height: 1.4;
}

.input-shell input::placeholder,
input::placeholder,
textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.password-toggle {
    width: auto;
    min-width: 58px;
    border: 0;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.13);
    color: #dbeafe;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.password-toggle:hover {
    background: rgba(148, 163, 184, 0.22);
}

.primary-button,
.auth-form > button[type="submit"] {
    width: 100%;
    min-height: 58px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    padding: 15px 18px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.25);
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover,
.auth-form > button[type="submit"]:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 20px 44px rgba(37, 99, 235, 0.32);
    transform: translateY(-1px);
}

.primary-button:active,
.auth-form > button[type="submit"]:active {
    transform: translateY(0);
}

.auth-message h1 {
    margin-top: 0;
    font-size: 24px;
}

.admin-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 0%, rgba(37, 99, 235, 0.12), transparent 30%),
        #070b14;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(3, 7, 18, 0.88);
    backdrop-filter: blur(14px);
}

.brand {
    color: #ffffff;
    font-size: 22px;
    font-weight: 850;
    text-decoration: none;
    letter-spacing: -0.045em;
}

.topbar nav {
    display: flex;
    gap: 16px;
    flex: 1;
}

.topbar nav a,
.muted-link,
.panel-heading a {
    color: var(--muted);
    text-decoration: none;
}

.topbar nav a:hover,
.muted-link:hover,
.panel-heading a:hover {
    color: #ffffff;
}

.container {
    width: min(1120px, calc(100vw - 32px));
    margin: 32px auto;
}

.hero-panel,
.panel,
.stat-card {
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.74);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.22);
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 32px;
    margin-bottom: 20px;
}

.hero-panel h1 {
    margin: 4px 0 10px;
    font-size: clamp(28px, 5vw, 48px);
    letter-spacing: -0.06em;
}

.hero-panel p {
    max-width: 680px;
    color: var(--muted);
}

.eyebrow,
.muted {
    color: var(--muted-soft);
}

.stat-card {
    min-width: 180px;
    padding: 22px;
}

.stat-card span {
    display: block;
    color: var(--muted-soft);
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.panel {
    padding: 24px;
    margin-bottom: 20px;
}

.panel.narrow {
    max-width: 720px;
}

.panel h1,
.panel h2 {
    margin-top: 0;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.form-stack {
    display: grid;
    gap: 12px;
}

.form-stack input,
.form-stack textarea,
.form-stack select,
.form-stack button:not(.link-button) {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: rgba(2, 6, 23, 0.8);
    color: #ffffff;
    padding: 12px 14px;
}

.form-stack input:focus,
.form-stack textarea:focus,
.form-stack select:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.9);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

textarea {
    resize: vertical;
}

.form-stack button:not(.link-button) {
    cursor: pointer;
    border-color: transparent;
    background: #ffffff;
    color: #020617;
    font-weight: 800;
}

.form-section-title {
    margin: 18px 0 0;
    color: #ffffff;
    font-size: 18px;
    letter-spacing: -0.025em;
}

.compact {
    margin: -4px 0 2px;
    font-size: 13px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.color-field {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.46);
    padding: 12px;
}

.color-field span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.form-stack .color-field input[type="color"] {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    padding: 6px;
    cursor: pointer;
}

@media (max-width: 680px) {
    .color-grid {
        grid-template-columns: 1fr;
    }
}

.link-button {
    width: auto;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 0;
    cursor: pointer;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: auto;
}

.validation,
.field-validation-error {
    color: var(--danger);
    font-size: 13px;
    line-height: 1.4;
}

.validation:not(:empty) {
    border: 1px solid rgba(252, 165, 165, 0.38);
    border-radius: 14px;
    background: rgba(127, 29, 29, 0.22);
    padding: 10px 12px;
}

.notice {
    margin-bottom: 16px;
    border: 1px solid rgba(134, 239, 172, 0.34);
    border-radius: 16px;
    background: rgba(20, 83, 45, 0.22);
    color: #dcfce7;
    padding: 12px 14px;
}

pre {
    overflow: auto;
    border-radius: 16px;
    background: #020617;
    padding: 16px;
    color: #f8fafc;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted-soft);
    font-weight: 700;
}

.json-editor,
.config-editor {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 620px;
    box-sizing: border-box;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.55;
}

.production-env-template {
    min-height: 320px;
    height: min(42vh, 440px);
    resize: vertical;
    overflow: auto;
}

.details {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 18px;
    margin-bottom: 24px;
}

.details dt {
    color: var(--muted-soft);
}

.details dd {
    margin: 0;
}

.message-list {
    display: grid;
    gap: 14px;
}

.message-row {
    max-width: 760px;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
}

.message-row.ai {
    margin-left: auto;
    background: rgba(15, 23, 42, 0.94);
}

.message-row.visitor {
    background: rgba(2, 6, 23, 0.74);
}

.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--muted-soft);
    font-size: 13px;
}

.message-body {
    white-space: pre-wrap;
}

@media (max-width: 760px) {
    .topbar,
    .hero-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar nav,
    .grid {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .auth-shell {
        align-items: stretch;
        padding: 16px;
    }

    .auth-card {
        align-self: center;
        width: 100%;
        border-radius: 22px;
    }
}


@supports (height: 100dvh) {
    .admin-shell,
    .auth-shell {
        min-height: 100dvh;
    }
}

@media (max-width: 640px) {
    .auth-shell {
        align-items: stretch;
        place-items: center;
        padding-top: calc(18px + env(safe-area-inset-top));
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }

    .auth-card {
        width: 100%;
        max-width: 460px;
        border-radius: 24px;
        padding: 28px 20px;
    }

    .auth-copy {
        margin-bottom: 24px;
    }

    .input-shell,
    .primary-button,
    .auth-form > button[type="submit"] {
        min-height: 56px;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 10;
        flex-wrap: wrap;
        padding-top: calc(14px + env(safe-area-inset-top));
        padding-left: calc(14px + env(safe-area-inset-left));
        padding-right: calc(14px + env(safe-area-inset-right));
    }

    .topbar nav {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .container {
        width: 100%;
        padding-left: calc(14px + env(safe-area-inset-left));
        padding-right: calc(14px + env(safe-area-inset-right));
        padding-bottom: calc(28px + env(safe-area-inset-bottom));
    }
}


.plain-rules-editor {
    width: 100%;
    min-height: min(68vh, 760px);
    resize: vertical;
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    background: #f8fafc;
    color: #0f172a;
    padding: 18px;
    font: 500 16px/1.62 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.06);
}

.plain-rules-editor:focus {
    border-color: rgba(96, 165, 250, 0.95);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.helper-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.helper-grid > div {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.62);
    padding: 14px;
}

.helper-grid strong,
.helper-grid span {
    display: block;
}

.helper-grid strong {
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 5px;
}

.helper-grid span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.helper-grid code {
    color: #bfdbfe;
    font-size: 12px;
}

@media (max-width: 760px) {
    .plain-rules-editor {
        min-height: 66vh;
        padding: 14px;
        border-radius: 14px;
        font-size: 16px;
        line-height: 1.55;
    }

    .helper-grid {
        grid-template-columns: 1fr;
    }
}


.settings-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 450px);
    gap: 20px;
    align-items: start;
}

.settings-form-panel {
    min-width: 0;
}

.widget-live-preview-panel {
    position: sticky;
    top: 92px;
    overflow: hidden;
}

.preview-heading {
    margin-bottom: 14px;
}

.preview-status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #bfdbfe;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
}

.widget-preview-stage {
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.18), transparent 36%),
        #020617;
    padding: 16px;
}

.widget-preview-root,
.widget-preview-root * {
    box-sizing: border-box;
}

.widget-preview-root {
    --preview-primary: #2563eb;
    --preview-accent: #22c55e;
    --preview-dark-panel: #0f172a;
    --preview-dark-text: #f8fafc;
    --preview-light-panel: #ffffff;
    --preview-light-text: #0f172a;
    position: relative;
    min-height: 660px;
    color: var(--preview-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.widget-preview-root[data-theme="light"] {
    --preview-panel: var(--preview-light-panel);
    --preview-text: var(--preview-light-text);
    --preview-panel-soft: #f8fafc;
    --preview-panel-strong: #eff6ff;
    --preview-border: rgba(15, 23, 42, 0.12);
    --preview-border-strong: rgba(15, 23, 42, 0.18);
    --preview-muted: #475569;
    --preview-muted-soft: #64748b;
    --preview-ai-bg: #f1f5f9;
    --preview-ai-text: #0f172a;
    --preview-input-bg: #ffffff;
    --preview-input-text: #0f172a;
    --preview-notice-bg: #eff6ff;
    --preview-notice-text: #1e3a8a;
    --preview-shadow: 0 22px 60px rgba(15, 23, 42, 0.20);
}

.widget-preview-root[data-theme="dark"] {
    --preview-panel: var(--preview-dark-panel);
    --preview-text: var(--preview-dark-text);
    --preview-panel-soft: #111827;
    --preview-panel-strong: #020617;
    --preview-border: rgba(148, 163, 184, 0.22);
    --preview-border-strong: rgba(148, 163, 184, 0.34);
    --preview-muted: #cbd5e1;
    --preview-muted-soft: #94a3b8;
    --preview-ai-bg: #172033;
    --preview-ai-text: #f8fafc;
    --preview-input-bg: #f8fafc;
    --preview-input-text: #0f172a;
    --preview-notice-bg: rgba(37, 99, 235, 0.12);
    --preview-notice-text: #dbeafe;
    --preview-shadow: 0 22px 60px rgba(0, 0, 0, 0.46);
}

.widget-preview-root[data-enabled="false"] {
    opacity: 0.52;
    filter: grayscale(0.35);
}

.preview-chat {
    position: relative;
    width: 100%;
    max-width: 390px;
    height: 590px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--preview-border);
    border-radius: 22px;
    background: var(--preview-panel);
    color: var(--preview-text);
    box-shadow: var(--preview-shadow);
}

.preview-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid var(--preview-border);
    background: linear-gradient(180deg, var(--preview-panel), var(--preview-panel-soft));
}

.preview-title strong {
    display: block;
    color: var(--preview-text);
    font-size: 20px;
    font-weight: 850;
    line-height: 1.1;
    letter-spacing: -0.045em;
}

.preview-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin-top: 8px;
    border: 1px solid var(--preview-border);
    border-radius: 999px;
    background: var(--preview-notice-bg);
    color: var(--preview-notice-text);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 850;
    line-height: 1.15;
}

.preview-actions {
    display: inline-flex;
    align-items: flex-start;
    gap: 7px;
}

.preview-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    border: 1px solid var(--preview-border);
    border-radius: 12px;
    background: var(--preview-panel);
    color: var(--preview-muted);
    padding: 0;
    cursor: pointer;
    font-weight: 900;
}

.preview-info-button {
    border-radius: 999px;
    background: var(--preview-notice-bg);
    color: var(--preview-primary);
}

.preview-icon-button svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.preview-messages {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: var(--preview-panel);
}

.preview-row {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    max-width: 100%;
}

.preview-row.visitor {
    justify-content: flex-end;
}

.preview-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: 1px solid var(--preview-border);
    border-radius: 999px;
    background: var(--preview-panel-strong);
    color: var(--preview-muted);
}

.preview-avatar svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.preview-bubble-wrap {
    max-width: min(300px, 84%);
}

.preview-msg {
    width: fit-content;
    max-width: 100%;
    border-radius: 17px;
    padding: 11px 13px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.48;
}

.preview-msg.ai {
    border-top-left-radius: 8px;
    border: 1px solid var(--preview-border);
    background: var(--preview-ai-bg);
    color: var(--preview-ai-text);
}

.preview-msg.visitor {
    margin-left: auto;
    border-top-right-radius: 8px;
    background: var(--preview-primary);
    color: #ffffff;
}

.preview-time {
    margin-top: 5px;
    color: var(--preview-muted-soft);
    font-size: 12px;
}

.preview-row.visitor .preview-time {
    text-align: right;
}

.preview-composer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid var(--preview-border);
    background: var(--preview-panel-soft);
}

.preview-input {
    flex: 1;
    min-height: 50px;
    display: flex;
    align-items: center;
    border: 1px solid var(--preview-border-strong);
    border-radius: 16px;
    background: var(--preview-input-bg);
    color: #64748b;
    padding: 0 14px;
    font-size: 15px;
    font-weight: 700;
}

.preview-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border: 0;
    border-radius: 16px;
    background: var(--preview-primary);
    color: #ffffff;
    cursor: pointer;
}

.preview-send svg,
.preview-launcher svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.preview-launcher {
    position: absolute;
    right: 2px;
    bottom: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 104px;
    min-height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: var(--preview-primary);
    color: #ffffff;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 850;
    box-shadow: 0 18px 42px rgba(37, 99, 235, 0.30);
}

.preview-modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(8px);
}

.preview-modal-backdrop[hidden] {
    display: none;
}

.preview-modal {
    position: relative;
    width: min(100%, 330px);
    border: 1px solid var(--preview-border);
    border-radius: 20px;
    background: var(--preview-panel);
    color: var(--preview-text);
    padding: 18px;
    box-shadow: var(--preview-shadow);
}

.preview-modal h3 {
    margin: 0 40px 8px 0;
    color: var(--preview-text);
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: -0.035em;
}

.preview-modal p {
    margin: 0 0 12px;
    color: var(--preview-muted);
    font-size: 14px;
    line-height: 1.45;
}

.preview-modal ul {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
    padding-left: 18px;
    color: var(--preview-text);
    font-size: 13px;
    line-height: 1.45;
}

.preview-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--preview-border);
    border-radius: 12px;
    background: var(--preview-panel-soft);
    color: var(--preview-muted);
    cursor: pointer;
    font-size: 20px;
    font-weight: 900;
}

.preview-modal-primary {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 14px;
    background: var(--preview-primary);
    color: #ffffff;
    cursor: pointer;
    font-weight: 850;
}

@media (max-width: 1060px) {
    .settings-page {
        grid-template-columns: 1fr;
    }

    .widget-live-preview-panel {
        position: static;
    }

    .widget-preview-root {
        min-height: 640px;
    }

    .preview-chat {
        max-width: none;
    }
}

@media (max-width: 520px) {
    .widget-preview-stage {
        padding: 10px;
        margin-left: -8px;
        margin-right: -8px;
    }

    .preview-chat {
        height: 560px;
        border-radius: 20px;
    }

    .preview-head {
        padding: 14px;
    }

    .preview-theme-button {
        display: none;
    }

    .preview-launcher {
        min-width: 52px;
        width: 52px;
        padding: 0;
    }

    .preview-launcher span {
        display: none;
    }
}


.rule-test-panel {
    border-color: rgba(96, 165, 250, 0.28);
    background:
        radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.12), transparent 34%),
        rgba(15, 23, 42, 0.74);
}

.rule-test-form textarea {
    min-height: 92px;
}

.rule-test-result {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.48);
    padding: 16px;
}

.rule-test-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.rule-test-summary > div {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.70);
    padding: 13px;
}

.rule-test-summary span,
.rule-response-box span {
    display: block;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 6px;
}

.rule-test-summary strong {
    display: block;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.rule-test-details {
    display: grid;
    grid-template-columns: minmax(150px, 0.35fr) minmax(0, 1fr);
    gap: 10px 14px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.42);
    padding: 14px;
}

.rule-test-details dt {
    color: var(--muted-soft);
    font-size: 13px;
    font-weight: 800;
}

.rule-test-details dd {
    margin: 0;
    color: #f8fafc;
    overflow-wrap: anywhere;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 850;
}

.status-pill.success {
    border: 1px solid rgba(134, 239, 172, 0.32);
    background: rgba(20, 83, 45, 0.22);
    color: #bbf7d0;
}

.status-pill.danger {
    border: 1px solid rgba(252, 165, 165, 0.36);
    background: rgba(127, 29, 29, 0.28);
    color: #fecaca;
}

.status-pill-open {
    border: 1px solid color-mix(in srgb, var(--success) 42%, transparent);
    background: color-mix(in srgb, var(--success) 14%, var(--surface-soft));
    color: var(--success);
}

.status-pill-closed {
    border: 1px solid color-mix(in srgb, var(--muted-soft) 38%, transparent);
    background: color-mix(in srgb, var(--muted-soft) 12%, var(--surface-soft));
    color: var(--muted);
}

.status-pill-archived {
    border: 1px solid color-mix(in srgb, var(--warning) 42%, transparent);
    background: color-mix(in srgb, var(--warning) 12%, var(--surface-soft));
    color: var(--warning);
}

.status-pill-channel {
    border: 1px solid color-mix(in srgb, var(--primary) 36%, transparent);
    background: color-mix(in srgb, var(--primary) 10%, var(--surface-soft));
    color: var(--primary-strong);
}

.banned-hit-list {
    margin: 8px 0 0;
    padding-left: 18px;
    color: #fecaca;
}

.rule-response-box {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.62);
    padding: 14px;
}

.rule-response-box.warning {
    border-color: rgba(250, 204, 21, 0.36);
    background: rgba(113, 63, 18, 0.22);
}

.rule-response-box p {
    margin: 0;
    color: #ffffff;
    line-height: 1.55;
    white-space: pre-wrap;
}

@media (max-width: 760px) {
    .rule-test-summary,
    .rule-test-details {
        grid-template-columns: 1fr;
    }
}


.learning-hero {
    border-color: rgba(95, 196, 139, 0.28);
    background:
        radial-gradient(circle at 100% 0%, rgba(95, 196, 139, 0.11), transparent 36%),
        rgba(15, 23, 42, 0.74);
}

.learning-list {
    display: grid;
    gap: 18px;
}

.learning-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
    gap: 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(2, 6, 23, 0.42);
    padding: 18px;
}

.learning-card-main {
    min-width: 0;
    display: grid;
    gap: 14px;
}

.learning-message span,
.learning-meta-grid span {
    display: block;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
    margin-bottom: 6px;
}

.learning-message strong {
    display: block;
    color: #ffffff;
    font-size: 20px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.learning-meta-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.learning-meta-grid > div {
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(15, 23, 42, 0.68);
    padding: 12px;
}

.learning-meta-grid strong {
    display: block;
    color: #ffffff;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.learning-details {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.38);
    padding: 12px 14px;
}

.learning-details summary,
.learning-action-box summary {
    color: #dbeafe;
    cursor: pointer;
    font-weight: 850;
}

.learning-details dl {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 8px 12px;
    margin: 14px 0 0;
}

.learning-details dt {
    color: var(--muted-soft);
    font-size: 13px;
    font-weight: 800;
}

.learning-details dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.learning-actions {
    display: grid;
    gap: 12px;
    align-content: start;
}

.learning-action-box {
    display: grid;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.62);
    padding: 14px;
}

.learning-action-box h3 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
}

.learning-action-box input,
.learning-action-box textarea,
.learning-action-box select,
.learning-action-box button,
.learning-secondary-actions button {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    background: rgba(2, 6, 23, 0.86);
    color: #ffffff;
    padding: 11px 12px;
}

.learning-action-box button {
    border-color: transparent;
    background: #ffffff;
    color: #020617;
    cursor: pointer;
    font-weight: 850;
}

.compact-stack {
    margin-top: 12px;
}

.learning-secondary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.learning-secondary-actions form {
    margin: 0;
}

.learning-secondary-actions .secondary-button {
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    cursor: pointer;
    font-weight: 850;
}

.learning-secondary-actions .danger-button {
    border-color: rgba(252, 165, 165, 0.34);
    background: rgba(127, 29, 29, 0.32);
    color: #fecaca;
    cursor: pointer;
    font-weight: 850;
}

@media (max-width: 980px) {
    .learning-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .learning-meta-grid,
    .learning-details dl,
    .learning-secondary-actions {
        grid-template-columns: 1fr;
    }
}


.learning-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}

.learning-filter-heading {
    align-items: flex-start;
    gap: 18px;
}

.learning-filter-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(190px, 1fr) auto;
    gap: 10px;
    align-items: end;
    min-width: min(100%, 520px);
}

.learning-filter-form label {
    display: grid;
    gap: 7px;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
}

.learning-filter-form select,
.learning-filter-form button {
    min-height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    background: rgba(2, 6, 23, 0.86);
    color: #ffffff;
    padding: 9px 12px;
}

.learning-filter-form button {
    border-color: transparent;
    background: #ffffff;
    color: #020617;
    cursor: pointer;
    font-weight: 850;
}

.learning-ai-suggestion {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 16px;
    background:
        radial-gradient(circle at 100% 0%, rgba(96, 165, 250, 0.12), transparent 38%),
        rgba(15, 23, 42, 0.58);
    padding: 12px;
}

.learning-ai-suggestion span {
    display: block;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
    margin-bottom: 6px;
}

.learning-ai-suggestion strong {
    display: block;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.learning-ai-wide {
    grid-column: 1 / -1;
}

.learning-ai-empty {
    border: 1px dashed rgba(148, 163, 184, 0.28);
    border-radius: 15px;
    background: rgba(15, 23, 42, 0.36);
    color: var(--muted-soft);
    font-size: 13px;
    font-weight: 750;
    padding: 12px;
}

@media (max-width: 980px) {
    .learning-stat-grid,
    .learning-filter-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .learning-ai-suggestion {
        grid-template-columns: 1fr;
    }
}


.stat-link-card {
    color: inherit;
    text-decoration: none;
}

.stat-link-card:hover {
    border-color: rgba(147, 197, 253, 0.54);
    transform: translateY(-1px);
}

.secondary-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.58);
    color: #dbeafe;
    padding: 0 14px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 850;
}

.learning-regenerate-box {
    border-color: rgba(96, 165, 250, 0.30);
    background:
        radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.12), transparent 40%),
        rgba(15, 23, 42, 0.72);
}

.learning-report-list {
    display: grid;
    gap: 14px;
}

.learning-report-card {
    display: grid;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.66);
    padding: 18px;
}

.learning-report-card span,
.learning-report-grid span {
    display: block;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
    margin-bottom: 6px;
}

.learning-report-card strong,
.learning-report-grid strong {
    display: block;
    color: #ffffff;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.learning-report-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.learning-report-grid > div {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.36);
    padding: 13px;
}

@media (max-width: 760px) {
    .learning-report-grid {
        grid-template-columns: 1fr;
    }

    .secondary-link-button {
        width: 100%;
    }
}


.learning-regenerate-box .secondary-button {
    border-color: rgba(147, 197, 253, 0.34);
    background: rgba(37, 99, 235, 0.16);
    color: #dbeafe;
}

.learning-regenerate-box .secondary-button:hover {
    background: rgba(37, 99, 235, 0.24);
}


.learning-report-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.learning-revert-form {
    margin: 0;
}

.learning-revert-form button {
    min-height: 38px;
    border: 1px solid rgba(248, 113, 113, 0.38);
    border-radius: 999px;
    background: rgba(127, 29, 29, 0.22);
    color: #fecaca;
    cursor: pointer;
    font-size: 13px;
    font-weight: 850;
    padding: 0 14px;
}

.learning-revert-form button:hover {
    background: rgba(127, 29, 29, 0.34);
}

.learning-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    padding: 0 12px;
}

.learning-status-reverted {
    border: 1px solid rgba(148, 163, 184, 0.30);
    background: rgba(100, 116, 139, 0.18);
    color: #cbd5e1;
}

.learning-report-card-reverted {
    opacity: 0.72;
}

.learning-report-card-reverted .learning-report-grid > div {
    background: rgba(15, 23, 42, 0.30);
}

@media (max-width: 760px) {
    .learning-report-card-head {
        display: grid;
    }

    .learning-revert-form button {
        width: 100%;
    }
}




.learning-report-section {
    margin-top: 22px;
}

.learning-report-summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.learning-report-summary-pills span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-soft) 74%, transparent);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    padding: 0 12px;
}

.learning-lesson-list {
    display: grid;
    gap: 14px;
}

.learning-lesson-card {
    display: grid;
    gap: 12px;
    border: 1px solid color-mix(in srgb, var(--warning) 32%, var(--border));
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface-soft) 76%, transparent);
    padding: 18px;
}

.learning-lesson-card span {
    display: block;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
    margin-bottom: 6px;
}

.learning-lesson-card strong {
    display: block;
    color: var(--text);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.learning-report-details-table {
    margin-top: 16px;
}

.learning-report-details-table summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 850;
}

html[data-admin-theme="dark"] .learning-lesson-card {
    background: rgba(120, 53, 15, 0.16);
}


/* Corporate admin theme */
html[data-admin-theme="light"] {
    color-scheme: light;
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --surface-soft: #f8fafc;
    --border: #d7dee8;
    --border-strong: #b6c2d2;
    --text: #0f172a;
    --muted: #334155;
    --muted-soft: #475569;
    --accent: #1d4ed8;
    --accent-hover: #1e40af;
    --primary: #1d4ed8;
    --primary-strong: #1e40af;
    --danger: #b91c1c;
    --success: #047857;
    --warning: #92400e;
    --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

html[data-admin-theme="dark"] {
    color-scheme: dark;
    --bg: #070b14;
    --surface: rgba(15, 23, 42, 0.92);
    --surface-strong: #0f172a;
    --surface-soft: #111827;
    --border: rgba(148, 163, 184, 0.22);
    --border-strong: rgba(148, 163, 184, 0.36);
    --text: #f8fafc;
    --muted: #cbd5e1;
    --muted-soft: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --primary: #60a5fa;
    --primary-strong: #bfdbfe;
    --danger: #fca5a5;
    --success: #86efac;
    --warning: #f59e0b;
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
}

html[data-admin-theme] body.admin-shell {
    color: var(--text);
    background:
        radial-gradient(circle at 14% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 30%),
        linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 92%, #ffffff));
}

html[data-admin-theme="light"] body.admin-shell {
    background:
        radial-gradient(circle at 14% -4%, rgba(37, 99, 235, 0.10), transparent 30%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

html[data-admin-theme="dark"] body.admin-shell {
    background:
        radial-gradient(circle at 14% -4%, rgba(59, 130, 246, 0.16), transparent 30%),
        linear-gradient(180deg, #070b14 0%, #030712 100%);
}

html[data-admin-theme] .topbar {
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

html[data-admin-theme="light"] .topbar {
    backdrop-filter: blur(18px);
}

html[data-admin-theme] .brand,
html[data-admin-theme] .panel h1,
html[data-admin-theme] .panel h2,
html[data-admin-theme] .hero-panel h1,
html[data-admin-theme] .form-section-title {
    color: var(--text);
}

html[data-admin-theme] .topbar nav a,
html[data-admin-theme] .muted-link,
html[data-admin-theme] .panel-heading a,
html[data-admin-theme] .muted,
html[data-admin-theme] .eyebrow {
    color: var(--muted);
}

html[data-admin-theme] .topbar nav a:hover,
html[data-admin-theme] .muted-link:hover,
html[data-admin-theme] .panel-heading a:hover {
    color: var(--accent);
}

html[data-admin-theme] .hero-panel,
html[data-admin-theme] .panel,
html[data-admin-theme] .stat-card,
html[data-admin-theme] .learning-report-card,
html[data-admin-theme] .learning-candidate-card,
html[data-admin-theme] .conversation-card {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

html[data-admin-theme="light"] .hero-panel,
html[data-admin-theme="light"] .panel,
html[data-admin-theme="light"] .stat-card,
html[data-admin-theme="light"] .learning-report-card,
html[data-admin-theme="light"] .learning-candidate-card,
html[data-admin-theme="light"] .conversation-card {
    background: rgba(255, 255, 255, 0.92);
}

html[data-admin-theme] .form-stack input,
html[data-admin-theme] .form-stack textarea,
html[data-admin-theme] .form-stack select,
html[data-admin-theme] .input-shell,
html[data-admin-theme] .color-field,
html[data-admin-theme] .learning-test-box textarea,
html[data-admin-theme] .learning-test-box input,
html[data-admin-theme] .learning-test-box select {
    border-color: var(--border-strong);
    background: var(--surface-soft);
    color: var(--text);
}

html[data-admin-theme="light"] .form-stack input,
html[data-admin-theme="light"] .form-stack textarea,
html[data-admin-theme="light"] .form-stack select,
html[data-admin-theme="light"] .input-shell,
html[data-admin-theme="light"] .color-field {
    background: #ffffff;
}

html[data-admin-theme] .form-stack input:focus,
html[data-admin-theme] .form-stack textarea:focus,
html[data-admin-theme] .form-stack select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

html[data-admin-theme] .field-group label,
html[data-admin-theme] label,
html[data-admin-theme] .color-field span,
html[data-admin-theme] .stat-card span,
html[data-admin-theme] .learning-report-grid span {
    color: var(--muted);
}

html[data-admin-theme] .stat-card strong,
html[data-admin-theme] .learning-report-grid strong,
html[data-admin-theme] .learning-report-card-head strong,
html[data-admin-theme] .learning-details dd {
    color: var(--text);
}

html[data-admin-theme] .notice {
    border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    color: var(--text);
}

.admin-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.admin-theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.admin-theme-toggle-icon {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
}

.learning-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.inline-action-form {
    margin: 0;
}

.danger-outline-button,
.success-action-button,
.secondary-action-button,
.danger-action-button {
    min-height: 40px;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}

.danger-outline-button {
    border: 1px solid color-mix(in srgb, #dc2626 42%, var(--border));
    background: transparent;
    color: #dc2626;
}

.danger-outline-button:hover {
    background: rgba(220, 38, 38, 0.08);
}

.success-action-button {
    border: 1px solid color-mix(in srgb, #16a34a 48%, var(--border));
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
}

html[data-admin-theme="light"] .success-action-button {
    color: #047857;
}

.secondary-action-button {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
}

.danger-action-button {
    border: 1px solid #dc2626;
    background: #dc2626;
    color: #ffffff;
}

.admin-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(8px);
}

.admin-modal-backdrop[hidden] {
    display: none;
}

.admin-modal {
    width: min(96vw, 560px);
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.admin-modal-head,
.admin-modal-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.admin-modal-head h2 {
    margin: 2px 0 0;
    color: var(--text);
}

.admin-modal-body {
    display: grid;
    gap: 12px;
    padding: 20px;
}

.admin-modal-actions {
    align-items: center;
    border-top: 1px solid var(--border);
    border-bottom: 0;
}

.admin-modal-close {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.revert-preview-card {
    display: grid;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
    padding: 14px;
}

.revert-preview-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.revert-preview-card strong {
    color: var(--text);
    font-size: 15px;
    line-height: 1.45;
}

@media (max-width: 900px) {
    html[data-admin-theme] .topbar {
        align-items: stretch;
    }

    .admin-theme-toggle {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .admin-modal {
        border-radius: 20px;
    }

    .admin-modal-head,
    .admin-modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-modal-actions form,
    .admin-modal-actions button {
        width: 100%;
    }
}


/* Admin dashboard sidebar */
.admin-dashboard-layout {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    border-right: 1px solid var(--border);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-soft) 96%, transparent));
    box-shadow: 18px 0 60px rgba(15, 23, 42, 0.08);
}

html[data-admin-theme="dark"] .admin-sidebar {
    background:
        radial-gradient(circle at 10% 0%, rgba(59, 130, 246, 0.14), transparent 34%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
    box-shadow: 18px 0 70px rgba(0, 0, 0, 0.22);
}

.admin-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 88px;
    padding: 22px 22px 16px;
}

.admin-sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.admin-sidebar-brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 26%, transparent);
}

.admin-sidebar-brand strong {
    display: block;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.045em;
}

.admin-sidebar-brand small {
    display: block;
    margin-top: 2px;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.admin-sidebar-close,
.sidebar-open-button {
    display: none;
}

.admin-sidebar-nav {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: var(--muted);
    padding: 11px 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 850;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.admin-sidebar-link:hover {
    border-color: var(--border);
    background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
    color: var(--text);
    transform: translateX(2px);
}

.admin-sidebar-link.active {
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

.admin-sidebar-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--muted-soft) 12%, transparent);
    color: currentColor;
    font-size: 14px;
    line-height: 1;
}

.admin-sidebar-link.active .admin-sidebar-icon {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.admin-sidebar-footer {
    display: grid;
    gap: 12px;
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.admin-logout-form {
    margin: 0;
}

.admin-logout-button {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--muted);
    font-weight: 850;
    cursor: pointer;
}

.admin-logout-button:hover {
    border-color: color-mix(in srgb, #dc2626 40%, var(--border));
    color: #dc2626;
}

.admin-main-shell {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-content-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 88px;
    padding: 18px 32px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    backdrop-filter: blur(18px);
}

.admin-content-topbar h1 {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 24px;
    line-height: 1.1;
    letter-spacing: -0.05em;
}

.admin-page-kicker {
    margin: 0;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-content {
    width: min(1280px, 100%);
    margin: 0 auto;
    padding: 28px 32px 48px;
}

.admin-content .notice {
    margin-top: 0;
}

.admin-theme-toggle {
    justify-content: center;
}

.admin-theme-toggle-mobile,
.admin-time-toggle-mobile {
    display: none;
}

html[data-admin-theme] .admin-content pre {
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--border);
}

html[data-admin-theme="light"] .admin-content pre {
    background: #f1f5f9;
}

html[data-admin-theme] .admin-content table {
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
}

html[data-admin-theme] .admin-content th {
    background: var(--surface-soft);
}

@media (max-width: 1180px) {
    .admin-dashboard-layout {
        grid-template-columns: 260px minmax(0, 1fr);
    }

    .admin-content {
        padding-inline: 24px;
    }
}

@media (max-width: 980px) {
    .admin-dashboard-layout {
        display: block;
    }

    .admin-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(88vw, 320px);
        transform: translateX(-104%);
        transition: transform 220ms ease;
    }

    .admin-sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(15, 23, 42, 0.48);
        backdrop-filter: blur(6px);
    }

    .admin-sidebar-overlay[hidden] {
        display: none;
    }

    .admin-sidebar-close,
    .sidebar-open-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 40px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface-soft);
        color: var(--text);
        padding: 8px 12px;
        font-weight: 850;
        cursor: pointer;
    }

    .admin-sidebar-close {
        width: 40px;
        padding: 0;
        font-size: 22px;
    }

    .admin-content-topbar {
        min-height: 76px;
        padding: 14px 18px;
    }

    .admin-content-topbar h1,
    .admin-page-kicker {
        display: none;
    }

    .admin-theme-toggle-mobile,
    .admin-time-toggle-mobile {
        display: inline-flex;
    }

    .admin-sidebar-footer .admin-theme-toggle,
    .admin-sidebar-footer .admin-time-toggle {
        display: none;
    }

    .admin-content {
        padding: 20px 16px 36px;
    }
}

@media (max-width: 760px) {
    .admin-content .hero-panel,
    .admin-content .panel-heading,
    .learning-filter-heading {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-content .grid,
    .learning-stat-grid,
    .rule-test-summary {
        grid-template-columns: 1fr;
    }

    .admin-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .admin-content .panel,
    .admin-content .hero-panel {
        border-radius: 20px;
        padding: 18px;
    }
}

@media (max-width: 420px) {
    .admin-content {
        padding-inline: 12px;
    }

    .admin-content-topbar {
        padding-inline: 12px;
    }

    .admin-theme-toggle-text {
        display: none;
    }
}


/* Dashboard metrics */
.dashboard-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border: 1px solid var(--border);
    border-radius: 28px;
    background:
        radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 32%),
        var(--surface);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
}

html[data-admin-theme="dark"] .dashboard-hero {
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.dashboard-hero h1 {
    margin: 4px 0 10px;
    color: var(--text);
    font-size: clamp(28px, 4vw, 46px);
    letter-spacing: -0.06em;
    line-height: 1.04;
}

.dashboard-hero p {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.6;
}

.dashboard-hero-meta {
    min-width: min(100%, 220px);
    align-self: stretch;
    display: grid;
    align-content: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-soft);
    padding: 20px;
}

.dashboard-hero-meta span,
.dashboard-hero-meta small,
.dashboard-stat-card span,
.dashboard-stat-card small,
.dashboard-mini-card span {
    color: var(--muted-soft);
    font-weight: 800;
}

.dashboard-hero-meta span,
.dashboard-stat-card span,
.dashboard-mini-card span {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dashboard-hero-meta strong {
    color: var(--text);
    font-size: 24px;
    line-height: 1.1;
    word-break: break-word;
}

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-stat-card,
.dashboard-mini-card {
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 18px 52px rgba(15, 23, 42, 0.08);
}

html[data-admin-theme="dark"] .dashboard-stat-card,
html[data-admin-theme="dark"] .dashboard-mini-card {
    box-shadow: 0 18px 58px rgba(0, 0, 0, 0.18);
}

.dashboard-stat-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    min-height: 142px;
    padding: 20px;
}

.dashboard-stat-card strong {
    display: block;
    margin: 8px 0 5px;
    color: var(--text);
    font-size: 34px;
    line-height: 1;
    letter-spacing: -0.05em;
}

.dashboard-stat-card small {
    display: block;
    font-size: 13px;
    line-height: 1.4;
}

.dashboard-stat-icon {
    display: grid;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 12%, var(--surface-soft));
    color: var(--accent);
    font-size: 20px;
}

.dashboard-stats-grid-secondary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-mini-card {
    padding: 18px;
}

.dashboard-mini-card strong {
    display: block;
    margin-top: 8px;
    color: var(--text);
    font-size: 20px;
    line-height: 1.15;
    letter-spacing: -0.035em;
}

@media (max-width: 1180px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .dashboard-hero {
        flex-direction: column;
        border-radius: 22px;
        padding: 20px;
    }

    .dashboard-stats-grid,
    .dashboard-stats-grid-secondary {
        grid-template-columns: 1fr;
    }

    .dashboard-stat-card {
        min-height: auto;
    }
}


.dashboard-stat-body {
    flex: 1;
    min-width: 0;
}

.dashboard-stat-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dashboard-stat-title-row a {
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--accent);
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 850;
    text-decoration: none;
    white-space: nowrap;
}

.dashboard-stat-title-row a:hover {
    border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.dashboard-trend-bars {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 44px;
    margin-top: 14px;
    padding: 6px 0 0;
}

.dashboard-trend-bar {
    flex: 1;
    min-width: 5px;
    border-radius: 999px 999px 5px 5px;
    background: color-mix(in srgb, var(--accent) 34%, var(--surface-soft));
    opacity: 0.72;
    transition: height 160ms ease, opacity 160ms ease, background 160ms ease;
}

.dashboard-trend-bar.is-today,
.dashboard-trend-bar.is-current {
    background: var(--accent);
    opacity: 1;
}

.dashboard-trend-bar:hover {
    opacity: 1;
}

.fallback-report-list {
    display: grid;
    gap: 14px;
}

.fallback-report-card {
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-soft);
    padding: 18px;
}

html[data-admin-theme="light"] .fallback-report-card {
    background: #ffffff;
}

.fallback-report-head,
.fallback-report-grid,
.fallback-message-grid {
    display: grid;
    gap: 12px;
}

.fallback-report-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    margin-bottom: 14px;
}

.fallback-report-head span,
.fallback-report-grid span,
.fallback-message-grid span {
    display: block;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.fallback-report-head strong,
.fallback-report-grid strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 15px;
    word-break: break-word;
}

.fallback-report-head a {
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--accent);
    padding: 8px 11px;
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
    white-space: nowrap;
}

.fallback-report-head a:hover {
    border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.fallback-report-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 12px;
}

.fallback-report-grid > div,
.fallback-message-grid > div {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    padding: 13px;
}

.fallback-message-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fallback-message-grid p {
    margin: 7px 0 0;
    color: var(--text);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.fallback-page-url {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 13px;
    word-break: break-word;
}

@media (max-width: 760px) {
    .dashboard-stat-title-row,
    .fallback-report-head {
        grid-template-columns: 1fr;
    }

    .fallback-report-grid,
    .fallback-message-grid {
        grid-template-columns: 1fr;
    }

    .fallback-report-head a {
        width: fit-content;
    }
}


.dashboard-time-note {
    margin-top: 10px;
    color: var(--muted-soft);
    font-size: 13px;
}

.dashboard-hero-stack {
    min-width: min(100%, 260px);
    display: grid;
    gap: 12px;
}

.dashboard-control-card {
    display: grid;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-soft);
    padding: 16px;
}

.dashboard-control-card > span,
.dashboard-control-card small {
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    padding: 5px;
}

.segmented-control.range-control {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-control-card .segmented-control + span {
    margin-top: 4px;
}

.dashboard-trend-bars {
    overflow: hidden;
}

.dashboard-trend-bars .dashboard-trend-bar {
    max-width: 16px;
}


.segmented-control a {
    border-radius: 999px;
    color: var(--muted);
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 850;
    text-align: center;
    text-decoration: none;
}

.segmented-control a.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 24%, transparent);
}

.segmented-control a:not(.active):hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--text);
}

.admin-filter-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 0.7fr)) minmax(140px, 0.55fr) minmax(260px, 1.5fr) auto;
    gap: 14px;
    align-items: end;
}

.admin-filter-form label {
    display: grid;
    gap: 8px;
    color: var(--text);
}

.admin-filter-form label > span {
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-filter-form input[type="date"],
.admin-filter-form input[type="search"],
.admin-filter-form select {
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--text);
    padding: 0 12px;
    outline: none;
}

.admin-filter-form select {
    cursor: pointer;
}

.admin-filter-form input[type="search"] {
    width: 100%;
}

.admin-filter-form input[type="date"]:focus,
.admin-filter-form input[type="search"]:focus,
.admin-filter-form select:focus {
    border-color: color-mix(in srgb, var(--accent) 64%, var(--border));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

.compact-button {
    width: auto;
    min-width: 132px;
    min-height: 46px;
    padding: 10px 18px;
}

@media (max-width: 900px) {
    .admin-filter-form {
        grid-template-columns: 1fr;
    }

    .compact-button {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .dashboard-hero-stack {
        min-width: 0;
    }
}


.admin-time-toggle {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 0 14px;
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.admin-time-toggle:hover {
    border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
    background: color-mix(in srgb, var(--accent) 7%, var(--surface-soft));
    color: var(--text);
}

.admin-time-toggle-icon {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 9px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-size: 13px;
}

.admin-topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.filter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.filter-summary span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 8px 11px;
    font-size: 13px;
    font-weight: 750;
}

.filter-summary strong {
    color: var(--text);
}

@media (max-width: 760px) {
    .admin-filter-form {
        grid-template-columns: 1fr;
    }

    .admin-topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .admin-time-toggle-mobile,
    .admin-theme-toggle-mobile {
        min-height: 40px;
    }
}


.conversation-detail-heading {
    gap: 18px;
}

.conversation-detail-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.conversation-detail-actions form {
    margin: 0;
}

.conversation-state-button {
    min-width: 132px;
}

.danger-outline-button {
    min-height: 46px;
    border: 1px solid color-mix(in srgb, #ef4444 48%, var(--border));
    border-radius: 999px;
    background: color-mix(in srgb, #ef4444 8%, var(--surface-soft));
    color: #ef4444;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.danger-outline-button:hover {
    border-color: color-mix(in srgb, #ef4444 72%, var(--border));
    background: color-mix(in srgb, #ef4444 14%, var(--surface-soft));
    transform: translateY(-1px);
}

.conversation-detail-grid dd {
    overflow-wrap: anywhere;
}

.conversation-state-note {
    margin: 18px 0;
    border: 1px solid color-mix(in srgb, var(--muted-soft) 34%, var(--border));
    border-radius: 16px;
    background: color-mix(in srgb, var(--muted-soft) 8%, var(--surface-soft));
    color: var(--muted);
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 750;
}

@media (max-width: 760px) {
    .conversation-detail-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .conversation-detail-actions form,
    .conversation-detail-actions .secondary-link-button,
    .conversation-state-button {
        width: 100%;
    }

    .conversation-detail-actions .status-pill {
        width: fit-content;
    }
}


.storage-file-badge {
    display: inline-flex;
    align-items: center;
    max-width: min(280px, 42vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.10);
    color: var(--text);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800;
}

.storage-file-badge.archive {
    background: rgba(245, 158, 11, 0.13);
    color: var(--warning);
}

.storage-file-badge.active {
    background: rgba(37, 99, 235, 0.10);
    color: var(--primary);
}

@media (max-width: 760px) {
    .storage-file-badge {
        max-width: 72vw;
    }
}


.livechat-operation-list,
.livechat-transcript-list {
    display: grid;
    gap: 18px;
}

.livechat-operation-card,
.livechat-transcript-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.48);
    padding: 18px;
}

.livechat-operation-head,
.livechat-transcript-card summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.livechat-operation-head > div,
.livechat-transcript-card summary > span {
    display: grid;
    gap: 8px;
}

.livechat-transcript-card summary {
    cursor: pointer;
}

.livechat-transcript-card summary small {
    display: block;
    color: var(--muted-soft);
    margin-top: 4px;
}

.livechat-error-message {
    margin: 12px 0 0;
    color: var(--danger);
    overflow-wrap: anywhere;
}

.livechat-status-dot {
    display: inline-flex;
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border-radius: 999px;
    vertical-align: middle;
    background: var(--danger);
}

.livechat-status-dot.ok {
    background: var(--success);
}

.livechat-status-dot.missing {
    background: var(--danger);
}

.inline-form {
    margin-top: 14px;
}

@media (max-width: 760px) {
    .livechat-operation-head,
    .livechat-transcript-card summary {
        display: grid;
    }
}


.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.livechat-warning-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 16px;
    background: rgba(245, 158, 11, 0.08);
    padding: 12px 14px;
}

.livechat-warning-list p {
    margin: 0;
    color: var(--warning);
    overflow-wrap: anywhere;
}


.livechat-settings-form {
    display: grid;
    gap: 18px;
}

.livechat-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.livechat-settings-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.livechat-settings-grid label,
.livechat-settings-wide {
    display: grid;
    gap: 7px;
}

.livechat-settings-grid span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.livechat-settings-grid input,
.livechat-settings-grid select,
.livechat-settings-grid textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--text);
    padding: 11px 12px;
    font: inherit;
}

.livechat-settings-wide {
    grid-column: 1 / -1;
}

.livechat-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px 14px;
}

.livechat-checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 10px 12px;
    font-weight: 750;
}

.livechat-checkbox-grid input[type="checkbox"] {
    width: 17px;
    height: 17px;
}

.livechat-settings-divider {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2px 0;
}

.panel-heading.compact {
    margin-bottom: -4px;
}

.panel-heading.compact h3 {
    margin: 0;
}


.livechat-setup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.livechat-setup-card {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
    padding: 14px;
}

.livechat-setup-card.done {
    border-color: color-mix(in srgb, var(--success) 46%, var(--border));
    background: color-mix(in srgb, var(--success) 10%, var(--surface-soft));
}

.livechat-setup-card strong {
    color: var(--text);
}

.livechat-setup-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.livechat-secret-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.livechat-secret-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 850;
}

.livechat-secret-chip.ok {
    border-color: color-mix(in srgb, var(--success) 48%, var(--border));
    color: var(--success);
}

.livechat-secret-chip.missing {
    border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
    color: var(--danger);
}

.livechat-env-preview {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
    padding: 12px 14px;
}

.livechat-env-preview summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 850;
}

.livechat-env-preview pre {
    overflow: auto;
    margin: 12px 0 0;
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.42);
    padding: 14px;
}

.livechat-scope-guide {
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
    border-radius: 16px;
    background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft));
    padding: 14px 16px;
}

.livechat-scope-guide strong {
    display: block;
    margin-bottom: 8px;
}

.livechat-scope-guide ol {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}

.livechat-scope-guide li {
    margin: 6px 0;
    line-height: 1.5;
}


.livechat-connection-alert {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 13px 15px;
    background: var(--surface-soft);
}

.livechat-connection-alert strong {
    color: var(--text);
}

.livechat-connection-alert p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.livechat-connection-alert ul {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
}

.livechat-connection-alert li {
    margin: 4px 0;
    line-height: 1.45;
}

.livechat-connection-alert.danger {
    border-color: color-mix(in srgb, var(--danger) 48%, var(--border));
    background: color-mix(in srgb, var(--danger) 12%, var(--surface-soft));
}

.livechat-connection-alert.warning {
    border-color: color-mix(in srgb, var(--warning) 48%, var(--border));
    background: color-mix(in srgb, var(--warning) 12%, var(--surface-soft));
}

.livechat-connection-alert.success {
    border-color: color-mix(in srgb, var(--success) 48%, var(--border));
    background: color-mix(in srgb, var(--success) 10%, var(--surface-soft));
}

.livechat-connection-alert.info {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft));
}


.livechat-widget-code-card {
    display: grid;
    gap: 12px;
    margin: 16px 0;
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
    border-radius: 18px;
    background: color-mix(in srgb, var(--primary) 7%, var(--surface-soft));
    padding: 14px;
}

.livechat-widget-code-card strong {
    color: var(--text);
}

.livechat-widget-code-card p {
    margin: 0;
    line-height: 1.55;
}

.livechat-widget-code-textarea {
    width: 100%;
    min-height: 92px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.42);
    color: var(--text);
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.5;
}


.json-center-hero {
    border-color: rgba(96, 165, 250, 0.28);
    background:
        radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.12), transparent 34%),
        rgba(15, 23, 42, 0.74);
}

.json-center-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.json-center-list-panel,
.json-center-editor-panel {
    min-width: 0;
}

.json-file-list {
    display: grid;
    gap: 10px;
}

.json-file-card {
    display: grid;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.44);
    color: var(--text);
    padding: 12px;
    text-decoration: none;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.json-file-card:hover,
.json-file-card.active {
    border-color: rgba(96, 165, 250, 0.72);
    background: rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.json-file-card-head,
.json-file-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.json-file-name {
    color: #bfdbfe;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.json-file-meta {
    color: var(--muted-soft);
    font-size: 12px;
}

.json-editor-heading,
.config-editor-heading {
    align-items: center;
}

.json-file-details {
    margin-bottom: 14px;
}

.json-file-details code {
    color: #bfdbfe;
    overflow-wrap: anywhere;
}

.json-center-warning,
.json-center-info,
.json-center-readonly-note {
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 14px;
    line-height: 1.5;
}

.json-center-warning {
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
    color: var(--warning);
}

.json-center-info,
.json-center-readonly-note {
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.62);
    color: var(--muted);
}

.json-management-editor {
    min-height: min(68vh, 760px);
    background: #020617;
    color: #f8fafc;
}

.json-format-option {
    justify-content: flex-start;
}

.json-center-form .button-row button {
    width: auto;
    min-width: 220px;
}

.secondary-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.74);
    color: #dbeafe;
    padding: 11px 14px;
    text-decoration: none;
    font-weight: 800;
}

.secondary-action-link:hover {
    border-color: rgba(96, 165, 250, 0.72);
    color: #ffffff;
}

@media (max-width: 980px) {
    .json-center-layout {
        grid-template-columns: 1fr;
    }
}


.ai-management-page {
    display: grid;
    gap: 20px;
}

.ai-management-hero {
    background:
        radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.10), transparent 32%),
        rgba(15, 23, 42, 0.74);
}

.ai-management-help-grid,
.ai-editor-grid {
    display: grid;
    gap: 12px;
}

.ai-management-help-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-management-help-grid > div,
.check-card,
.ai-task-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.46);
}

.ai-management-help-grid > div {
    padding: 14px;
}

.ai-management-help-grid strong,
.ai-management-help-grid span,
.check-card strong,
.check-card small,
.field-hint {
    display: block;
}

.ai-management-help-grid strong,
.check-card strong {
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 5px;
}

.ai-management-help-grid span,
.check-card small,
.field-hint {
    color: var(--muted-soft);
    font-size: 13px;
    line-height: 1.45;
}

.ai-editor-section {
    display: grid;
    gap: 14px;
}

.ai-editor-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-editor-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-editor-grid.four {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.ai-tab-shell {
    display: grid;
    gap: 16px;
}

.ai-tab-nav-panel {
    padding: 12px;
}

.ai-tab-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.ai-tab-button {
    width: 100%;
    min-height: 76px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.58);
    color: #e2e8f0;
    padding: 13px 14px;
    text-align: left;
    cursor: pointer;
    font-weight: 900;
}

.ai-tab-button span {
    display: block;
    margin-top: 6px;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
}

.ai-tab-button.active,
.ai-tab-button[aria-selected="true"] {
    border-color: rgba(96, 165, 250, 0.76);
    background:
        radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.20), transparent 36%),
        rgba(30, 41, 59, 0.72);
    color: #ffffff;
}

.ai-tab-button.active span,
.ai-tab-button[aria-selected="true"] span {
    color: #bfdbfe;
}

.ai-tab-button:focus-visible {
    outline: 2px solid rgba(147, 197, 253, 0.78);
    outline-offset: 3px;
}

.ai-tab-panel {
    display: grid;
    gap: 16px;
}

.ai-tab-panel[hidden] {
    display: none !important;
}

.ai-tab-actions {
    display: flex;
    justify-content: flex-end;
}

.check-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
}

.check-card input[type="checkbox"],
.check-row input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
}

.field-hint {
    margin-top: 6px;
}

.ai-task-list {
    display: grid;
    gap: 16px;
}

.ai-task-card {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.ai-task-card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.ai-task-card h3 {
    margin: 0;
    color: #ffffff;
}

.ai-task-advanced {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.44);
    padding: 12px;
}

.ai-task-advanced summary {
    color: #dbeafe;
    cursor: pointer;
    font-weight: 800;
}

.ai-task-advanced[open] summary {
    margin-bottom: 12px;
}

.secondary-button,
.settings-inline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 850;
}

.secondary-button:hover,
.settings-inline-link:hover {
    border-color: rgba(191, 219, 254, 0.56);
    color: #ffffff;
}

.danger-link {
    color: #fecaca;
}

.danger-link:hover {
    color: #ffffff;
}

.rule-response-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.rule-response-box {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.58);
    padding: 14px;
}

.rule-response-box p {
    margin: 0;
    color: #f8fafc;
    line-height: 1.55;
}

.warning-box {
    border: 1px solid rgba(245, 158, 11, 0.38);
    border-radius: 16px;
    background: rgba(120, 53, 15, 0.22);
    color: #fde68a;
    padding: 12px 14px;
}

@media (max-width: 1120px) {
    .ai-editor-grid.four,
    .ai-editor-grid.three,
    .ai-tab-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .ai-management-help-grid,
    .ai-editor-grid.two,
    .ai-editor-grid.three,
    .ai-editor-grid.four,
    .ai-tab-nav,
    .rule-response-grid {
        grid-template-columns: 1fr;
    }

    .ai-task-card-head,
    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .secondary-button,
    .settings-inline-link,
    .ai-tab-actions button {
        width: 100%;
    }
}


.form-stack .secondary-button {
    width: auto;
    border-color: rgba(148, 163, 184, 0.34);
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
}

.form-stack .secondary-button:hover {
    border-color: rgba(191, 219, 254, 0.56);
    color: #ffffff;
}


.hero-actions,
.ai-management-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}


.status-message {
    margin: 16px 0;
    border: 1px solid color-mix(in srgb, var(--accent) 44%, var(--border));
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-soft));
    color: var(--text);
    padding: 13px 15px;
    font-size: 14px;
    font-weight: 750;
}

.admin-transcript-search-form {
    grid-template-columns: minmax(280px, 1.4fr) repeat(2, minmax(150px, 0.7fr)) repeat(2, minmax(150px, 0.75fr)) auto;
}

.transcript-search-results {
    display: grid;
    gap: 14px;
}

.transcript-search-result {
    max-width: none;
}

.transcript-search-result.system {
    background: color-mix(in srgb, var(--muted-soft) 8%, var(--surface-soft));
}

.transcript-search-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    color: var(--muted-soft);
    font-size: 13px;
}

.transcript-search-footer a {
    color: #dbeafe;
    text-decoration: none;
    font-weight: 850;
}

.transcript-search-footer form {
    margin: 0;
}

.transcript-learning-button {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 12px;
}

.learning-reject-box {
    border: 1px solid color-mix(in srgb, #f87171 32%, var(--border));
    border-radius: 14px;
    background: color-mix(in srgb, #f87171 7%, var(--surface-soft));
    padding: 10px;
}

.learning-reject-box summary {
    color: #fecaca;
    cursor: pointer;
    font-size: 13px;
    font-weight: 850;
}

.learning-reject-box form {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.learning-reject-box textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    background: rgba(2, 6, 23, 0.86);
    color: #ffffff;
    padding: 11px 12px;
}

@media (max-width: 1100px) {
    .admin-transcript-search-form {
        grid-template-columns: 1fr;
    }
}


.livechat-settings-tabs {
    display: grid;
    gap: 16px;
}

.livechat-settings-tab-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.livechat-settings-save-panel {
    position: sticky;
    bottom: 0;
    z-index: 5;
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
    backdrop-filter: blur(12px);
}

@media (max-width: 1120px) {
    .livechat-settings-tab-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .livechat-settings-tab-nav {
        grid-template-columns: 1fr;
    }
}


.livechat-channel-tabs {
    display: grid;
    gap: 16px;
}

.livechat-channel-tab-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1120px) {
    .livechat-channel-tab-nav {
        grid-template-columns: 1fr;
    }
}


.livechat-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.livechat-status-card {
    display: grid;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
    padding: 13px 14px;
}

.livechat-status-card span {
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
}

.livechat-status-card strong {
    color: var(--text);
    font-size: 15px;
}

.livechat-status-card.ok {
    border-color: color-mix(in srgb, var(--success) 42%, var(--border));
    background: color-mix(in srgb, var(--success) 9%, var(--surface-soft));
}

.livechat-status-card.ok strong {
    color: #bbf7d0;
}

.livechat-status-card.missing {
    border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
    background: color-mix(in srgb, var(--warning) 9%, var(--surface-soft));
}

.livechat-status-card.missing strong {
    color: #fde68a;
}

.livechat-settings-save-panel[hidden] {
    display: none !important;
}

.livechat-setup-card .warning-box {
    margin: 4px 0 8px;
}

.livechat-setup-card .secondary-button {
    min-height: 52px;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 13px 16px;
}


.livechat-setup-confirmations {
    margin: 0 0 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.46);
    padding: 12px 14px;
}

.livechat-setup-confirmations summary {
    cursor: pointer;
    color: var(--muted);
    font-weight: 850;
}

.livechat-setup-confirmations .livechat-checkbox-grid {
    margin-top: 12px;
}



.livechat-setup-check-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.54);
    padding: 18px;
    margin-bottom: 18px;
}

.livechat-setup-check-header h3 {
    margin: 0 0 6px;
}

.livechat-setup-check-header .primary-button {
    min-width: 220px;
    min-height: 50px;
}

.livechat-setup-check-result {
    display: grid;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 18px;
}

.livechat-setup-check-result.ready {
    border-color: color-mix(in srgb, var(--success) 42%, var(--border));
    background: color-mix(in srgb, var(--success) 7%, var(--surface));
}

.livechat-setup-check-result.needs-work {
    border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
    background: color-mix(in srgb, var(--warning) 6%, var(--surface));
}

.livechat-setup-check-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.livechat-setup-check-summary span,
.livechat-setup-check-summary small {
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
}

.livechat-setup-check-summary strong {
    display: block;
    margin: 4px 0;
    font-size: 20px;
}

.livechat-setup-check-counts {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.livechat-setup-check-counts span {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 10px;
    background: rgba(15, 23, 42, 0.62);
}

.livechat-setup-check-counts .ok {
    color: #bbf7d0;
    border-color: color-mix(in srgb, var(--success) 42%, var(--border));
}

.livechat-setup-check-counts .warning {
    color: #fde68a;
    border-color: color-mix(in srgb, var(--warning) 42%, var(--border));
}

.livechat-setup-check-counts .error {
    color: #fecaca;
    border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
}

.livechat-setup-check-list {
    display: grid;
    gap: 10px;
}

.livechat-setup-check-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.58);
    padding: 13px 14px;
}

.livechat-setup-check-item strong {
    display: block;
    margin-bottom: 4px;
}

.livechat-setup-check-item p {
    margin: 0;
    color: var(--muted);
}

.livechat-setup-check-item.ok {
    border-color: color-mix(in srgb, var(--success) 36%, var(--border));
}

.livechat-setup-check-item.warning,
.livechat-setup-check-item.info {
    border-color: color-mix(in srgb, var(--warning) 36%, var(--border));
}

.livechat-setup-check-item.error {
    border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
}

.livechat-api-preview {
    overflow: auto;
    max-height: 220px;
    margin: 12px 0 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.72);
    color: var(--text);
    padding: 12px;
    white-space: pre-wrap;
}

@media (max-width: 860px) {
    .livechat-setup-check-header,
    .livechat-setup-check-summary,
    .livechat-setup-check-item {
        display: grid;
    }

    .livechat-setup-check-counts {
        justify-content: flex-start;
    }

    .livechat-setup-check-header .primary-button {
        width: 100%;
    }
}


.livechat-manual-webhook-box {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: rgba(148, 163, 184, 0.07);
    padding: 12px;
}

.livechat-manual-webhook-box h4 {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 900;
}

.ghost-button {
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    color: var(--text);
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 900;
}

.ghost-button:hover {
    border-color: rgba(96, 165, 250, 0.75);
    background: rgba(37, 99, 235, 0.15);
}


.json-preview {
    width: 100%;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    padding: 1rem;
    color: var(--text-primary);
}


.livechat-inline-status-row {
    display: grid;
    grid-template-columns: minmax(0, 360px);
    gap: 12px;
    margin: 14px 0;
}

.livechat-status-card small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

@media (max-width: 760px) {
    .livechat-inline-status-row {
        grid-template-columns: 1fr;
    }
}


/* WebChat integrated representative panel styles */
.representative-panel {
    display: grid;
    gap: 16px;
    margin: 18px 0;
    border: 1px solid color-mix(in srgb, #38bdf8 34%, var(--border));
    border-radius: 20px;
    background:
        radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.12), transparent 34%),
        color-mix(in srgb, #38bdf8 8%, var(--surface-soft));
    padding: 18px;
}

.representative-panel h2 {
    margin: 0 0 6px;
}

.representative-reply-form {
    display: grid;
    gap: 12px;
}

.representative-reply-form label {
    display: grid;
    gap: 8px;
}

.representative-reply-form input,
.representative-reply-form textarea {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--surface-soft);
    color: var(--text);
    padding: 12px 14px;
}

.representative-state-actions {
    justify-content: flex-start;
}

.message-row.system {
    background: color-mix(in srgb, #f59e0b 10%, var(--surface-soft));
    border-color: color-mix(in srgb, #f59e0b 30%, var(--border));
}

.representative-submit-status {
    margin: 0;
}

.representative-reply-form button[disabled] {
    opacity: 0.62;
    cursor: wait;
}


@media (max-width: 760px) {
    .conversation-detail-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .conversation-detail-actions form,
    .conversation-detail-actions .secondary-link-button,
    .conversation-state-button {
        width: 100%;
    }

    .conversation-detail-actions .status-pill {
        width: fit-content;
    }
}


.storage-file-badge {
    display: inline-flex;
    align-items: center;
    max-width: min(280px, 42vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.10);
    color: var(--text);
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800;
}

.storage-file-badge.archive {
    background: rgba(245, 158, 11, 0.13);
    color: var(--warning);
}

.storage-file-badge.active {
    background: rgba(37, 99, 235, 0.10);
    color: var(--primary);
}

@media (max-width: 760px) {
    .storage-file-badge {
        max-width: 72vw;
    }
}

.status-pill-ai-unsure {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

.status-pill-new-message {
    margin-left: 6px;
    border: 1px solid rgba(248, 113, 113, 0.44);
    background: rgba(127, 29, 29, 0.28);
    color: #fecaca;
}

.conversation-row-has-new-message {
    box-shadow: inset 4px 0 0 rgba(248, 113, 113, 0.82);
}

.conversation-row-has-new-message td {
    background: rgba(127, 29, 29, 0.10);
}


.admin-notification-count[hidden] {
    display: none !important;
}

.admin-notification-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    margin-left: auto;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    padding: 0 7px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.admin-notification-sound-toggle {
    width: 100%;
}

.admin-topbar-actions .admin-notification-sound-toggle {
    width: auto;
}

.admin-browser-notification-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: 100%;
}

.admin-topbar-actions .admin-browser-notification-toggle {
    width: auto;
}

.admin-browser-notification-toggle.is-enabled {
    border-color: color-mix(in srgb, var(--success) 50%, var(--border));
    color: var(--success);
}

.admin-browser-notification-toggle.is-enabled .admin-browser-notification-icon {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    color: var(--success);
}

.admin-browser-notification-toggle:disabled,
.js-admin-browser-notification-test:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.webchat-live-toolbar {
    align-items: center;
}

.webchat-browser-notification-status {
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 750;
}

.webchat-browser-notification-status[data-notification-permission="granted"] {
    color: var(--success);
}

.webchat-browser-notification-status[data-notification-permission="denied"] {
    color: var(--danger);
}



.admin-notification-sound-toggle.is-enabled {
    border-color: color-mix(in srgb, var(--success) 50%, var(--border));
    color: var(--success);
}

.admin-notification-sound-toggle.is-enabled .admin-notification-sound-icon {
    background: color-mix(in srgb, var(--success) 14%, transparent);
    color: var(--success);
}

.admin-notification-toasts {
    position: fixed;
    right: calc(22px + env(safe-area-inset-right));
    bottom: calc(22px + env(safe-area-inset-bottom));
    z-index: 2147482500;
    display: grid;
    gap: 12px;
    width: min(380px, calc(100vw - 28px));
    pointer-events: none;
}

.admin-notification-toast {
    pointer-events: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 94%, #020617);
    color: var(--text);
    padding: 14px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
    animation: admin-notification-toast-in 180ms ease-out;
}

.admin-notification-toast-head,
.admin-notification-toast-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.admin-notification-toast-head strong {
    color: var(--text);
    font-size: 14px;
    letter-spacing: -0.01em;
}

.admin-notification-toast-head button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
}

.admin-notification-toast-visitor {
    margin: 8px 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.admin-notification-toast-body {
    margin: 0 0 12px;
    color: var(--text);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.admin-notification-toast-footer a {
    color: #dbeafe;
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}

.admin-notification-toast-footer a:hover {
    color: var(--accent);
}

@keyframes admin-notification-toast-in {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@media (max-width: 980px) {
    .admin-notification-sound-toggle,
    .admin-browser-notification-toggle {
        width: auto;
    }
}

@media (max-width: 640px) {
    .admin-notification-toasts {
        right: calc(14px + env(safe-area-inset-right));
        bottom: calc(14px + env(safe-area-inset-bottom));
        width: calc(100vw - 28px);
    }
}


.conversation-flow {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.conversation-flow-header,
.representative-suggestions-head,
.conversation-search-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.conversation-flow-header h2 {
    margin: 0;
}

.message-row.representative {
    margin-left: auto;
    border-color: color-mix(in srgb, #22c55e 34%, var(--border));
    background: color-mix(in srgb, #22c55e 12%, var(--surface-soft));
}

.representative-composer-panel {
    position: sticky;
    bottom: 14px;
    margin-top: 20px;
    backdrop-filter: blur(12px);
    z-index: 2;
}

.representative-suggestions {
    display: grid;
    gap: 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 6%, var(--surface-soft));
    padding: 12px;
}

.quick-reply-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-reply-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    padding: 8px 11px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.quick-reply-chip:hover {
    border-color: color-mix(in srgb, var(--accent) 54%, var(--border));
    color: var(--accent);
}

.conversation-search-results {
    display: grid;
    gap: 14px;
}

.conversation-search-result {
    max-width: none;
}

.conversation-search-footer {
    margin-top: 12px;
    color: var(--muted-soft);
    font-size: 13px;
}

.conversation-search-footer a {
    color: var(--accent);
    font-weight: 850;
}

@media (max-width: 900px) {
    .admin-filter-form .admin-filter-search,
    .admin-message-search-form .admin-filter-search {
        grid-column: auto;
    }

    .admin-message-search-form {
        grid-template-columns: 1fr;
    }

    .representative-composer-panel {
        position: static;
    }
}


.admin-visitor-typing {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    gap: 8px;
    border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-soft));
    color: var(--muted);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 750;
}

.admin-visitor-typing[hidden] {
    display: none;
}

.admin-typing-dots {
    display: inline-flex;
    gap: 3px;
}

.admin-typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.42;
    animation: adminTypingPulse 1s ease-in-out infinite;
}

.admin-typing-dots span:nth-child(2) {
    animation-delay: 120ms;
}

.admin-typing-dots span:nth-child(3) {
    animation-delay: 240ms;
}

@keyframes adminTypingPulse {
    0%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    50% {
        opacity: 0.95;
        transform: translateY(-2px);
    }
}


.ai-management-page {
    display: grid;
    gap: 20px;
}

.ai-management-hero {
    background:
        radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.10), transparent 32%),
        rgba(15, 23, 42, 0.74);
}

.ai-management-help-grid,
.ai-editor-grid {
    display: grid;
    gap: 12px;
}

.ai-management-help-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-management-help-grid > div,
.check-card,
.ai-task-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.46);
}

.ai-management-help-grid > div {
    padding: 14px;
}

.ai-management-help-grid strong,
.ai-management-help-grid span,
.check-card strong,
.check-card small,
.field-hint {
    display: block;
}

.ai-management-help-grid strong,
.check-card strong {
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 5px;
}

.ai-management-help-grid span,
.check-card small,
.field-hint {
    color: var(--muted-soft);
    font-size: 13px;
    line-height: 1.45;
}

.ai-editor-section {
    display: grid;
    gap: 14px;
}

.ai-editor-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-editor-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-editor-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.check-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
}

.check-card input[type="checkbox"],
.check-row input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
}

.field-hint {
    margin-top: 6px;
}

.ai-task-list {
    display: grid;
    gap: 16px;
}

.ai-task-card {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.ai-task-card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.ai-task-card h3 {
    margin: 0;
    color: #ffffff;
}

.ai-task-advanced {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.44);
    padding: 12px;
}

.ai-task-advanced summary {
    color: #dbeafe;
    cursor: pointer;
    font-weight: 800;
}

.ai-task-advanced[open] summary {
    margin-bottom: 12px;
}

.secondary-button,
.settings-inline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 850;
}

.secondary-button:hover,
.settings-inline-link:hover {
    border-color: rgba(191, 219, 254, 0.56);
    color: #ffffff;
}

.danger-link {
    color: #fecaca;
}

.danger-link:hover {
    color: #ffffff;
}

.rule-response-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.rule-response-box {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.58);
    padding: 14px;
}

.rule-response-box p {
    margin: 0;
    color: #f8fafc;
    line-height: 1.55;
}

.warning-box {
    border: 1px solid rgba(245, 158, 11, 0.38);
    border-radius: 16px;
    background: rgba(120, 53, 15, 0.22);
    color: #fde68a;
    padding: 12px 14px;
}

@media (max-width: 1120px) {
    .ai-editor-grid.four,
    .ai-editor-grid.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .ai-management-help-grid,
    .ai-editor-grid.two,
    .ai-editor-grid.three,
    .ai-editor-grid.four,
    .rule-response-grid {
        grid-template-columns: 1fr;
    }

    .ai-task-card-head,
    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .secondary-button,
    .settings-inline-link {
        width: 100%;
    }
}


.form-stack .secondary-button {
    width: auto;
    border-color: rgba(148, 163, 184, 0.34);
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
}

.form-stack .secondary-button:hover {
    border-color: rgba(191, 219, 254, 0.56);
    color: #ffffff;
}


/* Representative chat layout: keep messages visible while writing. */
.conversation-live-shell {
    display: grid;
    grid-template-rows: minmax(280px, 1fr) auto;
    gap: 12px;
    height: clamp(560px, 72dvh, 860px);
    min-height: 560px;
    margin-top: 18px;
}

.conversation-live-shell .conversation-flow {
    min-height: 0;
    margin-top: 0;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.conversation-live-shell .message-list {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-soft) 80%, transparent);
    padding: 14px;
    scroll-behavior: smooth;
}

.conversation-live-shell .message-row {
    max-width: min(760px, 92%);
}

.conversation-live-shell .representative-composer-panel {
    position: sticky;
    bottom: 10px;
    margin: 0;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(2, 6, 23, 0.26);
}

.conversation-live-shell .representative-composer-panel > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.conversation-live-shell .representative-composer-panel > div:first-child h2 {
    margin: 0;
    font-size: 17px;
}

.conversation-live-shell .representative-composer-panel > div:first-child .compact {
    display: none;
}

.conversation-live-shell .representative-suggestions {
    gap: 8px;
    padding: 9px;
}

.conversation-live-shell .quick-reply-list {
    max-height: 76px;
    overflow: auto;
    padding-right: 2px;
}

.conversation-live-shell .quick-reply-chip {
    padding: 6px 9px;
    font-size: 12px;
}

.conversation-live-shell .representative-reply-form {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr auto;
    align-items: end;
    gap: 10px;
}

.conversation-live-shell .representative-reply-form .representative-suggestions {
    grid-column: 1 / -1;
}

.conversation-live-shell .representative-reply-form label {
    gap: 6px;
}

.conversation-live-shell .representative-body-field {
    min-width: 0;
}

.conversation-live-shell .representative-reply-form input,
.conversation-live-shell .representative-reply-form textarea {
    padding: 10px 12px;
}

.conversation-live-shell .representative-reply-form textarea {
    min-height: 82px;
    max-height: 132px;
    resize: vertical;
}

.conversation-live-shell .representative-reply-form button[type="submit"] {
    min-height: 44px;
    white-space: nowrap;
}

.conversation-live-shell .representative-submit-status {
    grid-column: 1 / -1;
}

.conversation-live-shell .representative-state-actions {
    margin-top: -2px;
}

@media (max-width: 1080px) {
    .conversation-live-shell {
        height: clamp(560px, 76dvh, 820px);
    }

    .conversation-live-shell .representative-reply-form {
        grid-template-columns: 1fr;
    }

    .conversation-live-shell .representative-reply-form button[type="submit"] {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .conversation-live-shell {
        height: auto;
        min-height: 0;
    }

    .conversation-live-shell .conversation-flow {
        min-height: 420px;
    }

    .conversation-live-shell .message-list {
        max-height: 58dvh;
    }

    .conversation-live-shell .representative-composer-panel {
        position: sticky;
        bottom: 8px;
    }
}

@media (max-width: 640px) {
    .conversation-live-shell .quick-reply-list {
        max-height: 92px;
    }

    .conversation-live-shell .representative-composer-panel > div:first-child {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* WebChat + LiveChat live console */
.webchat-live-console {
    overflow: hidden;
}

.webchat-live-heading {
    align-items: flex-start;
    gap: 16px;
}

.webchat-live-summary {
    margin-top: 14px;
}

.webchat-live-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.webchat-live-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    background: var(--surface);
    text-decoration: none;
    font-size: 0.9rem;
}

.webchat-live-tabs a.active {
    border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
    color: var(--primary-strong);
    font-weight: 700;
}

.webchat-live-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 16px;
    min-height: 680px;
}

.webchat-live-inbox {
    min-height: 0;
    max-height: 78dvh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: color-mix(in srgb, var(--surface-soft) 76%, transparent);
}

.webchat-live-card {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.webchat-live-card:hover,
.webchat-live-card.active {
    border-color: color-mix(in srgb, var(--primary) 52%, var(--border));
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.webchat-live-card.conversation-row-has-new-message {
    border-color: color-mix(in srgb, #f97316 54%, var(--border));
}

.webchat-live-card-top,
.webchat-live-card-bottom,
.webchat-live-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.webchat-live-card-top {
    justify-content: space-between;
}

.webchat-live-card-snippet {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.webchat-live-card-bottom {
    color: var(--muted);
    font-size: 0.82rem;
}

.webchat-live-pane {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    padding: 14px;
}

.webchat-live-pane-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.webchat-live-pane-head h2 {
    margin: 0;
}

.webchat-live-details {
    grid-template-columns: max-content minmax(0, 1fr);
    margin-bottom: 12px;
}

.webchat-live-details dd {
    word-break: break-word;
}

.webchat-live-shell {
    height: clamp(560px, 72dvh, 920px);
    margin-top: 0;
}

.webchat-live-composer-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.webchat-live-empty {
    display: grid;
    place-items: center;
    min-height: 160px;
    padding: 24px;
    color: var(--muted);
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.webchat-live-empty.large {
    min-height: 520px;
}

@media (max-width: 1100px) {
    .webchat-live-layout {
        grid-template-columns: 1fr;
    }

    .webchat-live-inbox {
        max-height: 360px;
    }

    .webchat-live-pane-head {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .webchat-live-pane,
    .webchat-live-inbox {
        border-radius: 16px;
    }

    .webchat-live-shell {
        height: auto;
        min-height: 560px;
    }
}


.ai-suggestion-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-suggestion-actions .compact-button {
    min-height: 36px;
}

.ai-representative-suggestion-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--primary) 42%, var(--border));
    border-radius: 16px;
    background: color-mix(in srgb, var(--primary) 7%, var(--surface));
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.07);
}

.ai-representative-suggestion-card[hidden] {
    display: none;
}

.ai-representative-suggestion-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-representative-suggestion-card p {
    margin: 0;
    color: var(--text);
    line-height: 1.45;
    white-space: pre-wrap;
}

.message-row.ai-suggestion {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}


.embed-code-block {
    display: grid;
    gap: 8px;
    margin: 14px 0;
}

.embed-code-block span {
    color: var(--muted, #64748b);
    font-size: 0.9rem;
    font-weight: 700;
}

.embed-code-block textarea {
    width: 100%;
    min-height: 74px;
    resize: vertical;
    border: 1px solid var(--border, rgba(15, 23, 42, 0.12));
    border-radius: 14px;
    background: var(--surface-soft, #f8fafc);
    color: inherit;
    padding: 12px 14px;
    font: 600 0.92rem/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.widget-embed-callout {
    display: grid;
    gap: 12px;
    margin: 16px 0 22px;
    border: 1px solid var(--border, rgba(15, 23, 42, 0.12));
    border-radius: 18px;
    background: var(--surface-soft, #f8fafc);
    padding: 16px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
    font-size: 0.78rem;
    font-weight: 800;
}

.status-pill.ok {
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
}

.status-pill.muted {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}


/* Live console redesign: keep conversation stream visible above composer */
.webchat-live-console.panel {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 148px);
    min-height: 720px;
    max-height: calc(100dvh - 112px);
    overflow: hidden;
    padding: 18px;
}

.webchat-live-heading {
    flex-shrink: 0;
    margin-bottom: 10px;
}

.webchat-live-heading h1 {
    margin-bottom: 4px;
}

.webchat-live-heading .dashboard-time-note {
    margin: 4px 0 0;
}

.webchat-live-summary {
    flex-shrink: 0;
    margin-top: 0;
}

.webchat-live-tabs {
    flex-shrink: 0;
    margin: 10px 0 12px;
}

.webchat-live-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 14px;
}

.webchat-live-inbox {
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.webchat-live-pane {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 14px;
}

.webchat-live-pane-head {
    flex-shrink: 0;
    align-items: center;
    margin-bottom: 10px;
}

.webchat-live-pane-head h2 {
    margin-bottom: 2px;
}

.webchat-live-meta-collapsible {
    flex-shrink: 0;
    margin: 0 0 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.webchat-live-meta-collapsible summary {
    cursor: pointer;
    list-style: none;
    padding: 9px 12px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 800;
}

.webchat-live-meta-collapsible summary::-webkit-details-marker {
    display: none;
}

.webchat-live-meta-collapsible summary::after {
    content: "▾";
    float: right;
    color: var(--muted-soft);
}

.webchat-live-meta-collapsible[open] summary::after {
    content: "▴";
}

.webchat-live-details {
    margin: 0;
    padding: 0 12px 12px;
    font-size: 0.9rem;
}

.webchat-live-shell {
    flex: 1;
    min-height: 0;
    height: auto;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
    overflow: hidden;
}

.webchat-live-flow {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-soft) 66%, transparent);
    padding: 12px;
}

.webchat-live-flow .conversation-flow-header {
    flex-shrink: 0;
}

.webchat-live-flow .conversation-flow-header h2 {
    font-size: 1rem;
}

.webchat-live-flow .admin-visitor-typing {
    flex-shrink: 0;
}

.webchat-live-shell .message-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
    scroll-behavior: smooth;
}

.webchat-live-shell .message-row {
    max-width: min(780px, 86%);
    padding: 12px;
    border-radius: 16px;
}

.webchat-live-shell .message-meta {
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
}

.webchat-live-shell .representative-composer-panel {
    position: static;
    z-index: auto;
    flex-shrink: 0;
    margin: 0;
    max-height: min(38dvh, 340px);
    overflow-y: auto;
    padding: 12px;
    border-radius: 18px;
}

.webchat-live-shell .representative-composer-panel > div:first-child {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.webchat-live-shell .representative-composer-panel h2 {
    margin: 0;
    font-size: 1rem;
}

.webchat-live-shell .representative-composer-panel p.compact {
    margin: 2px 0 0;
}

.webchat-live-shell .representative-reply-form {
    gap: 10px;
}

.webchat-live-shell .representative-suggestions {
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
}

.webchat-live-shell .representative-suggestions-head strong {
    font-size: 0.92rem;
}

.webchat-live-shell .ai-representative-suggestion-card {
    padding: 10px;
    border-radius: 14px;
}

.webchat-live-shell .ai-representative-suggestion-card p {
    max-height: 96px;
    overflow-y: auto;
    margin: 8px 0;
}

.webchat-live-shell .representative-reply-form input,
.webchat-live-shell .representative-reply-form textarea {
    padding: 10px 12px;
}

.webchat-live-shell .representative-body-field textarea {
    min-height: 86px;
    max-height: 160px;
    resize: vertical;
}

.quick-reply-disclosure {
    border: 1px dashed color-mix(in srgb, var(--accent) 28%, var(--border));
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
}

.quick-reply-disclosure summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 10px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.quick-reply-disclosure summary::-webkit-details-marker {
    display: none;
}

.quick-reply-disclosure summary::after {
    content: "▾";
    float: right;
    color: var(--muted-soft);
}

.quick-reply-disclosure[open] summary::after {
    content: "▴";
}

.quick-reply-disclosure .quick-reply-list {
    max-height: 104px;
    overflow-y: auto;
    padding: 0 10px 10px;
}

.webchat-live-empty.large {
    min-height: 0;
    flex: 1;
}

@media (max-width: 1200px) {
    .webchat-live-console.panel {
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: visible;
    }

    .webchat-live-layout {
        grid-template-columns: 1fr;
    }

    .webchat-live-inbox {
        max-height: 280px;
    }

    .webchat-live-pane {
        overflow: visible;
    }

    .webchat-live-shell {
        height: min(880px, 82dvh);
        min-height: 640px;
    }
}

@media (max-width: 700px) {
    .webchat-live-console.panel {
        padding: 14px;
    }

    .webchat-live-toolbar,
    .webchat-live-pane-head,
    .webchat-live-shell .representative-composer-panel > div:first-child {
        align-items: stretch;
        flex-direction: column;
    }

    .webchat-live-shell {
        height: auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: visible;
    }

    .webchat-live-flow {
        min-height: 420px;
    }

    .webchat-live-shell .representative-composer-panel {
        max-height: none;
    }

    .webchat-live-shell .message-row {
        max-width: 94%;
    }
}


.livechat-advanced-settings {
    margin: 16px 0;
    border: 1px dashed color-mix(in srgb, var(--accent) 24%, var(--border));
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.livechat-advanced-settings summary {
    cursor: pointer;
    list-style: none;
    padding: 10px 12px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.livechat-advanced-settings summary::-webkit-details-marker {
    display: none;
}

.livechat-advanced-settings summary::after {
    content: "▾";
    float: right;
    color: var(--muted-soft);
}

.livechat-advanced-settings[open] summary::after {
    content: "▴";
}

.livechat-advanced-settings .livechat-settings-grid {
    padding: 0 12px 12px;
}


/* Chat AI live console detail-style redesign
   Keeps the live screen close to the simple "Sohbet detayı" layout. */
.webchat-live-console.panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 22px !important;
}

.webchat-live-heading {
    align-items: flex-start;
    gap: 16px;
}

.webchat-live-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.webchat-live-summary {
    margin-top: 14px;
}

.webchat-live-tabs {
    margin: 18px 0 14px;
}

.webchat-live-layout {
    display: grid !important;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 18px !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
}

.webchat-live-inbox {
    position: sticky;
    top: 18px;
    max-height: calc(100dvh - 150px) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    border-radius: 22px;
}

.webchat-live-card {
    padding: 14px;
}

.webchat-live-card-top,
.webchat-live-card-meta {
    gap: 8px;
}

.webchat-live-pane {
    display: block !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 20px !important;
    border-radius: 24px;
}

.webchat-live-pane-head {
    align-items: flex-start !important;
    margin-bottom: 14px !important;
}

.webchat-live-meta-collapsible {
    margin-bottom: 14px;
}

.webchat-live-shell {
    display: grid !important;
    grid-template-rows: auto auto !important;
    gap: 14px !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
}

.webchat-live-flow {
    min-height: 360px !important;
    max-height: none !important;
    overflow: visible !important;
}

.webchat-live-flow .message-list {
    max-height: min(52dvh, 560px) !important;
    min-height: 300px !important;
    overflow-y: auto !important;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-soft) 80%, transparent);
    padding: 14px !important;
}

.webchat-live-shell .representative-composer-panel {
    max-height: none !important;
    overflow: visible !important;
    padding: 16px !important;
    margin: 0 !important;
    border-radius: 20px;
}

.webchat-live-shell .representative-composer-panel > div:first-child {
    display: flex;
    align-items: center !important;
    justify-content: space-between;
    gap: 12px;
}

.webchat-live-shell .representative-composer-panel > div:first-child .compact {
    display: none;
}

.webchat-live-shell .representative-reply-form {
    display: grid !important;
    grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) auto !important;
    align-items: end !important;
    gap: 12px !important;
}

.webchat-live-shell .representative-reply-form .representative-suggestions,
.webchat-live-shell .representative-submit-status {
    grid-column: 1 / -1;
}

.webchat-live-shell .representative-suggestions {
    padding: 10px !important;
}

.webchat-live-shell .ai-representative-suggestion-card p {
    max-height: 110px;
    overflow-y: auto;
}

.webchat-live-shell .representative-body-field textarea {
    min-height: 84px !important;
    max-height: 150px !important;
    resize: vertical;
}

.webchat-live-shell .webchat-live-composer-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

.webchat-live-shell .representative-reply-form > .webchat-live-composer-actions {
    align-self: end;
}

.webchat-live-shell .representative-reply-form button[type="submit"] {
    min-height: 46px;
    white-space: nowrap;
}

.webchat-live-shell .representative-state-actions {
    margin-top: 8px;
}

.webchat-ai-state-note {
    margin: 10px 0 0;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

@media (max-width: 980px) {
    .webchat-live-layout {
        grid-template-columns: 1fr !important;
    }

    .webchat-live-inbox {
        position: static;
        max-height: 340px !important;
    }

    .webchat-live-shell .representative-reply-form {
        grid-template-columns: 1fr !important;
    }

    .webchat-live-shell .representative-reply-form button[type="submit"] {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .webchat-live-console.panel {
        padding: 14px !important;
    }

    .webchat-live-toolbar,
    .webchat-live-pane-head,
    .webchat-live-shell .representative-composer-panel > div:first-child {
        align-items: stretch !important;
        flex-direction: column;
    }

    .webchat-live-flow .message-list {
        min-height: 260px !important;
        max-height: 58dvh !important;
    }
}


/* Chat list card view */
.chat-list-page {
    display: grid;
    gap: 18px;
}

.chat-list-heading {
    align-items: flex-start;
}

.chat-list-filter-form {
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
    align-items: end;
}

.chat-list-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-list-summary span,
.chat-list-refresh-notice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.58);
    color: var(--muted);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 780;
}

.chat-list-summary strong {
    color: var(--text);
}

.chat-list-refresh-notice {
    width: fit-content;
    border-color: color-mix(in srgb, var(--warning) 38%, var(--border));
    background: color-mix(in srgb, var(--warning) 9%, var(--surface-soft));
    color: #fde68a;
}

.chat-list-refresh-notice[hidden] {
    display: none !important;
}

.empty-state-card {
    display: grid;
    gap: 6px;
    border: 1px dashed var(--border-strong);
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.54);
    color: var(--muted);
    padding: 28px;
}

.empty-state-card strong {
    color: var(--text);
    font-size: 18px;
}

.chat-card-list {
    display: grid;
    gap: 14px;
}

.chat-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 26px;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.74)),
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.13), transparent 32%);
    padding: 14px;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.chat-card:hover {
    border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.82)),
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.18), transparent 34%);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    transform: translateY(-1px);
}

.chat-card.conversation-row-has-new-message {
    border-color: color-mix(in srgb, #f87171 48%, var(--border));
    box-shadow: inset 4px 0 0 rgba(248, 113, 113, 0.86), 0 18px 44px rgba(127, 29, 29, 0.16);
}

.chat-card-main {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 14px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.chat-card-avatar {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
    border-radius: 18px;
    background: color-mix(in srgb, var(--accent) 14%, var(--surface-soft));
    color: #bfdbfe;
    font-size: 20px;
    font-weight: 950;
    letter-spacing: 0.02em;
}

.chat-card-content {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.chat-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
}

.chat-card-title-row h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(18px, 2vw, 22px);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.chat-card-id {
    display: block;
    margin-top: 4px;
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 750;
    overflow-wrap: anywhere;
}

.chat-card-meta-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chat-card-time {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.chat-card-unread-count {
    display: inline-grid;
    min-width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 950;
}

.chat-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chat-card-source-livechat {
    border: 1px solid color-mix(in srgb, var(--success) 42%, transparent);
    background: color-mix(in srgb, var(--success) 14%, var(--surface-soft));
    color: var(--success);
}

.chat-card-source-webchat {
    border: 1px solid color-mix(in srgb, #60a5fa 46%, transparent);
    background: color-mix(in srgb, #60a5fa 14%, var(--surface-soft));
    color: #bfdbfe;
}

.chat-card-snippet {
    display: -webkit-box;
    min-height: 44px;
    margin: 0;
    color: var(--text);
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.chat-card-snippet strong {
    color: #bfdbfe;
    font-weight: 900;
}

.chat-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted-soft);
    font-size: 13px;
    font-weight: 760;
}

.chat-card-footer span {
    min-width: 0;
}

.chat-card-page {
    max-width: min(640px, 100%);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.chat-card-actions .compact-button {
    min-width: 104px;
}

@media (max-width: 980px) {
    .chat-list-filter-form {
        grid-template-columns: 1fr 1fr;
    }

    .chat-card {
        grid-template-columns: 1fr;
    }

    .chat-card-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 680px) {
    .chat-list-filter-form {
        grid-template-columns: 1fr;
    }

    .chat-card-main {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .chat-card-avatar {
        width: 42px;
        height: 42px;
        border-radius: 14px;
        font-size: 16px;
    }

    .chat-card-title-row {
        display: grid;
        gap: 8px;
    }

    .chat-card-meta-right {
        justify-content: flex-start;
    }

    .chat-card-time {
        white-space: normal;
    }
}


/* WhatsApp-like representative inbox for ChatAI domain isolation. */
.agent-inbox-page {
    min-height: calc(100dvh - 120px);
}

.agent-inbox-shell {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 16px;
    min-height: clamp(640px, 78dvh, 980px);
    margin-top: 18px;
}

.agent-inbox-sidebar {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 0;
    max-height: clamp(640px, 78dvh, 980px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(2, 6, 23, 0.58)),
        radial-gradient(circle at 0 0, rgba(37, 99, 235, 0.12), transparent 36%);
    padding: 10px;
}

.agent-inbox-item {
    grid-template-columns: minmax(0, 1fr);
    border-radius: 18px;
    padding: 8px;
}

.agent-inbox-item.active {
    border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.20), rgba(17, 24, 39, 0.82)),
        radial-gradient(circle at 0% 0%, rgba(34, 197, 94, 0.12), transparent 34%);
}

.agent-inbox-item .chat-card-main {
    gap: 10px;
}

.agent-inbox-item .chat-card-avatar {
    width: 42px;
    height: 42px;
    font-size: 15px;
}

.agent-inbox-item .chat-card-title-row h2 {
    font-size: 15px;
}

.agent-inbox-item .chat-card-id,
.agent-inbox-item .chat-card-footer,
.agent-inbox-item .chat-card-snippet {
    font-size: 12px;
}

.agent-inbox-thread {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(2, 6, 23, 0.62)),
        radial-gradient(circle at 100% 0, rgba(34, 197, 94, 0.10), transparent 36%);
    overflow: hidden;
}

.agent-inbox-empty-thread {
    height: 100%;
    align-content: center;
    justify-items: center;
    text-align: center;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.agent-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
}

.thread-contact-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.thread-contact-heading h2 {
    margin: 0;
    font-size: 18px;
}

.agent-thread-live-shell {
    height: calc(clamp(640px, 78dvh, 980px) - 74px);
    min-height: 560px;
    margin-top: 0;
    padding: 14px;
}

.agent-thread-live-shell .message-list {
    background:
        linear-gradient(135deg, rgba(2, 6, 23, 0.42), rgba(15, 23, 42, 0.78)),
        radial-gradient(circle at 50% 10%, rgba(148, 163, 184, 0.06), transparent 42%);
}

.agent-thread-live-shell .message-row {
    border-radius: 18px;
}

.single-representative-suggestion {
    padding: 8px 10px;
}

.representative-suggestions {
    grid-template-columns: auto minmax(220px, 1fr) auto;
    grid-template-areas: "title replies actions";
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
}

.representative-suggestions:has([data-ai-suggest-status]:not([hidden])) {
    grid-template-columns: auto minmax(180px, 1fr) minmax(120px, 0.45fr) auto;
    grid-template-areas: "title replies status actions";
}

.representative-suggestions-head {
    display: contents;
}

.representative-suggestions-head > strong {
    grid-area: title;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1;
}

.representative-suggestions .quick-reply-list,
.single-quick-reply-list {
    grid-area: replies;
    display: flex;
    flex-wrap: nowrap;
    min-width: 0;
    gap: 6px;
    overflow: hidden;
}

.representative-suggestions .quick-reply-chip {
    width: 100%;
    min-height: 32px;
    padding: 7px 10px;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
    border-radius: 999px;
}

.representative-suggestions > [data-ai-suggest-status] {
    grid-area: status;
    justify-self: end;
    max-width: 280px;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.representative-suggestions > [data-ai-suggest-status][hidden] {
    display: none;
}

.agent-suggestion-actions,
.agent-composer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.agent-suggestion-actions {
    grid-area: actions;
    flex-wrap: nowrap;
    gap: 6px;
}

.ai-suggest-primary,
.suggestion-tool-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-suggest-primary {
    min-width: 136px;
}

.ai-suggest-primary.compact-button {
    min-height: 34px;
    padding: 7px 11px;
}

.agent-suggestion-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    padding: 3px;
}

.suggestion-tool-button.compact-button {
    min-width: 0;
    min-height: 30px;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 11.5px;
}

.suggestion-action-icon {
    display: inline-grid;
    width: 17px;
    height: 17px;
    place-items: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.suggestion-tool-button .suggestion-action-icon {
    width: 18px;
    height: 18px;
}

.suggestion-tool-button:disabled .suggestion-action-icon,
.ai-suggest-primary:disabled .suggestion-action-icon {
    opacity: 0.55;
}

@media (max-width: 980px) {
    .representative-suggestions,
    .representative-suggestions:has([data-ai-suggest-status]:not([hidden])) {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "title actions"
            "replies replies"
            "status status";
    }

    .representative-suggestions > [data-ai-suggest-status] {
        justify-self: start;
        max-width: 100%;
        text-align: left;
    }
}

@media (max-width: 760px) {
    .agent-suggestion-actions {
        justify-content: stretch;
    }

    .ai-suggest-primary,
    .agent-suggestion-toolbar {
        width: 100%;
    }

    .agent-suggestion-toolbar {
        justify-content: space-between;
    }

    .suggestion-tool-button.compact-button {
        flex: 1 1 0;
    }
}

@media (max-width: 520px) {
    .suggestion-tool-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .suggestion-tool-button.compact-button {
        flex: 0 0 auto;
        width: 42px;
        padding-inline: 0;
    }

    .agent-suggestion-toolbar {
        justify-content: center;
    }
}

.agent-composer-actions {
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 1080px) {
    .agent-inbox-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .agent-inbox-sidebar {
        max-height: 360px;
    }

    .agent-thread-live-shell {
        height: 70dvh;
    }
}

.domain-access-list {
    display: grid;
    gap: 0.75rem;
}

.compact-panel {
    box-shadow: none;
}

.callout.subtle {
    display: grid;
    gap: 0.25rem;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.04);
}


/* Inbox layout polish: fixed composer, no page scroll, wider canvas, readable message box. */
body.agent-inbox-body {
    overflow: hidden;
}

body.agent-inbox-body .admin-main-shell,
body.agent-inbox-body .admin-content {
    min-height: 100dvh;
    overflow: hidden;
}

body.agent-inbox-body .admin-content {
    width: 100%;
    max-width: none;
    padding: 18px 20px 18px 12px;
}

@supports selector(.admin-content:has(.agent-inbox-page)) {
    .admin-content:has(.agent-inbox-page) {
        width: 100%;
        max-width: none;
        padding: 18px 20px 18px 12px;
    }
}

body.agent-inbox-body .agent-inbox-page {
    display: grid;
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    gap: 12px;
    height: calc(100dvh - 126px);
    min-height: 0;
    margin-bottom: 0;
    padding: 18px;
    overflow: hidden;
}

body.agent-inbox-body .agent-inbox-page > * {
    min-height: 0;
}

body.agent-inbox-body .agent-inbox-page .panel-heading,
body.agent-inbox-body .agent-inbox-page .admin-filter-form,
body.agent-inbox-body .agent-inbox-page .chat-list-summary,
body.agent-inbox-body .agent-inbox-page .chat-list-refresh-notice {
    margin-bottom: 0;
}

body.agent-inbox-body .agent-inbox-shell {
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 18px;
    min-height: 0;
    height: 100%;
    margin-top: 0;
}

body.agent-inbox-body .agent-inbox-sidebar,
body.agent-inbox-body .agent-inbox-thread {
    height: 100%;
    min-height: 0;
}

body.agent-inbox-body .agent-inbox-thread {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

body.agent-inbox-body .agent-thread-live-shell {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100%;
    min-height: 0;
    padding: 14px;
}

body.agent-inbox-body .agent-thread-live-shell .conversation-flow {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-height: 0;
}

body.agent-inbox-body .agent-thread-live-shell .message-list {
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
}

body.agent-inbox-body .agent-thread-live-shell .representative-composer-panel {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--border));
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.96));
    backdrop-filter: blur(10px);
}

body.agent-inbox-body .agent-thread-live-shell .representative-reply-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

body.agent-inbox-body .agent-thread-live-shell .representative-reply-form .representative-suggestions,
body.agent-inbox-body .agent-thread-live-shell .representative-submit-status,
body.agent-inbox-body .agent-thread-live-shell .agent-composer-actions,
body.agent-inbox-body .agent-thread-live-shell .representative-body-field {
    grid-column: 1 / -1;
}

body.agent-inbox-body .agent-thread-live-shell .representative-reply-form > label:not(.representative-body-field) {
    max-width: 320px;
}

body.agent-inbox-body .agent-thread-live-shell .representative-body-field textarea {
    width: 100%;
    min-height: 112px;
    max-height: 220px;
    resize: vertical;
    line-height: 1.55;
    background: rgba(2, 6, 23, 0.86);
    color: #f8fafc;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-strong);
}

body.agent-inbox-body .agent-thread-live-shell .representative-body-field textarea:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.9);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

body.agent-inbox-body .agent-thread-live-shell .representative-reply-form input {
    min-height: 46px;
}

body.agent-inbox-body .agent-thread-live-shell .agent-composer-actions {
    justify-content: space-between;
    align-items: center;
}

body.agent-inbox-body .agent-thread-live-shell .agent-composer-actions .primary-button,
body.agent-inbox-body .agent-thread-live-shell .agent-composer-actions .secondary-link-button {
    min-height: 44px;
}

@media (max-width: 1280px) {
    body.agent-inbox-body .admin-content {
        padding-inline: 14px;
    }

    body.agent-inbox-body .agent-inbox-shell {
        grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    }
}

@media (max-width: 1080px) {
    body.agent-inbox-body {
        overflow: auto;
    }

    body.agent-inbox-body .admin-content {
        overflow: visible;
        min-height: auto;
    }

    body.agent-inbox-body .agent-inbox-page {
        height: auto;
        overflow: visible;
    }

    body.agent-inbox-body .agent-inbox-shell {
        grid-template-columns: 1fr;
        height: auto;
    }

    body.agent-inbox-body .agent-inbox-sidebar {
        max-height: 320px;
    }

    body.agent-inbox-body .agent-inbox-thread {
        min-height: 70dvh;
    }
}


/* Inbox filter compaction: single-row primary filters and collapsible date filters. */
body.agent-inbox-body .agent-inbox-page {
    gap: 10px;
    height: calc(100dvh - 112px);
    padding: 14px 16px 16px;
}

body.agent-inbox-body .chat-list-filter-form {
    display: block;
}

body.agent-inbox-body .chat-list-filter-panel {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface-soft) 84%, transparent);
    overflow: hidden;
}

body.agent-inbox-body .chat-list-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    list-style: none;
    padding: 10px 14px;
    user-select: none;
}

body.agent-inbox-body .chat-list-filter-toggle::-webkit-details-marker {
    display: none;
}

body.agent-inbox-body .chat-list-filter-toggle strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
}

body.agent-inbox-body .chat-list-filter-toggle small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    margin-top: 2px;
}

body.agent-inbox-body .chat-list-filter-toggle::after {
    content: "▾";
    color: var(--muted-soft);
    font-size: 14px;
    font-weight: 900;
}

body.agent-inbox-body .chat-list-filter-panel[open] .chat-list-filter-toggle {
    border-bottom: 1px solid var(--border);
}

body.agent-inbox-body .chat-list-filter-panel[open] .chat-list-filter-toggle::after {
    content: "▴";
}

body.agent-inbox-body .chat-list-filter-toggle-state {
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 850;
    margin-left: auto;
}

body.agent-inbox-body .chat-list-filter-content {
    padding: 12px 14px 14px;
}

body.agent-inbox-body .chat-list-filter-row {
    display: grid;
    grid-template-columns:
        minmax(280px, 1.6fr)
        minmax(190px, 0.85fr)
        minmax(160px, 0.7fr)
        minmax(138px, 0.55fr)
        minmax(138px, 0.55fr)
        auto;
    gap: 12px;
    align-items: end;
}

body.agent-inbox-body .chat-list-filter-search-field,
body.agent-inbox-body .chat-list-date-field {
    min-width: 0;
}

body.agent-inbox-body .chat-list-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

body.agent-inbox-body .agent-inbox-shell {
    height: 100%;
}

body.agent-inbox-body .agent-thread-live-shell {
    padding: 12px 14px 14px;
}

body.agent-inbox-body .agent-thread-live-shell .conversation-flow {
    grid-template-rows: auto auto minmax(0, 1fr);
}

body.agent-inbox-body .agent-thread-live-shell .message-list {
    padding: 14px;
}

@media (max-width: 1280px) {
    body.agent-inbox-body .chat-list-filter-row {
        grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.8fr) minmax(150px, 0.7fr);
    }

    body.agent-inbox-body .chat-list-filter-row .compact-button {
        width: fit-content;
    }
}

@media (max-width: 980px) {
    body.agent-inbox-body .chat-list-filter-row {
        grid-template-columns: 1fr;
    }

    body.agent-inbox-body .chat-list-filter-toggle {
        align-items: flex-start;
    }

    body.agent-inbox-body .chat-list-filter-toggle-state {
        display: none;
    }

    body.agent-inbox-body .chat-list-filter-row .compact-button {
        width: 100%;
    }
}

/* Inbox composer simplification: sender name is internal; keep only message input visible. */
body.agent-inbox-body .agent-thread-live-shell .representative-reply-form input[type="hidden"] {
    display: none;
}

body.agent-inbox-body .agent-thread-live-shell .representative-reply-form > label:not(.representative-body-field) {
    display: none;
}

body.agent-inbox-body .agent-thread-live-shell .message-meta strong {
    min-width: 64px;
    color: #e0f2fe;
}

/* Inbox sidebar compaction: show more conversations without reducing thread space. */
body.agent-inbox-body .agent-inbox-sidebar {
    gap: 8px;
    padding: 8px;
}

body.agent-inbox-body .agent-inbox-item {
    padding: 7px;
    border-radius: 16px;
}

body.agent-inbox-body .agent-inbox-item .chat-card-main {
    gap: 8px;
}

body.agent-inbox-body .agent-inbox-item .chat-card-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 13px;
}

body.agent-inbox-body .agent-inbox-item .chat-card-title-row {
    gap: 8px;
}

body.agent-inbox-body .agent-inbox-item .chat-card-title-row h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.15;
}

body.agent-inbox-body .agent-inbox-item .chat-card-id {
    font-size: 11px;
    line-height: 1.2;
}

body.agent-inbox-body .agent-inbox-item .chat-card-badges {
    gap: 5px;
    margin-top: 5px;
}

body.agent-inbox-body .agent-inbox-item .status-pill {
    padding: 3px 7px;
    font-size: 10.5px;
    line-height: 1.2;
}

body.agent-inbox-body .agent-inbox-item .chat-card-snippet {
    display: -webkit-box;
    margin: 7px 0 0;
    max-height: 34px;
    overflow: hidden;
    font-size: 11.5px;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

body.agent-inbox-body .agent-inbox-item .chat-card-footer {
    margin-top: 7px;
    font-size: 10.5px;
    line-height: 1.2;
}

body.agent-inbox-body .agent-inbox-item .chat-card-page {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.agent-inbox-body .agent-inbox-item .chat-card-time {
    font-size: 10.5px;
    line-height: 1.2;
}

body.agent-inbox-body .agent-inbox-item .chat-card-unread-count {
    min-width: 20px;
    height: 20px;
    font-size: 10px;
}

@media (min-width: 1081px) {
    body.agent-inbox-body .agent-inbox-shell {
        grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    }
}


/* Inbox actor icon + typing polish */
.message-actor-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.84);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    user-select: none;
}

.message-actor-icon.actor-ai {
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(30, 41, 59, 0.9);
}

.message-actor-icon.actor-representative {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.28);
    background: rgba(20, 83, 45, 0.35);
}

.message-actor-icon.actor-visitor {
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.26);
    background: rgba(30, 41, 59, 0.85);
}

.message-actor-icon.actor-system {
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.28);
    background: rgba(120, 53, 15, 0.3);
}

body.agent-inbox-body .agent-thread-live-shell .message-meta {
    align-items: center;
}

body.agent-inbox-body .agent-thread-live-shell .message-row.ai .message-body,
body.agent-inbox-body .agent-thread-live-shell .message-row.representative .message-body,
body.agent-inbox-body .agent-thread-live-shell .message-row.system .message-body,
body.agent-inbox-body .agent-thread-live-shell .message-row.visitor .message-body {
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
}

.admin-visitor-typing {
    align-items: center;
    gap: 10px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.88);
    border-color: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
    padding: 10px 14px;
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.24);
}

.admin-typing-dots span {
    width: 6px;
    height: 6px;
}

.webchat-representative-typing {
    border-radius: 18px;
    background: var(--webchat-ai-bg);
    border: 1px solid var(--webchat-border);
    padding: 9px 13px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.12);
}


/* V51 Light theme contrast hardening: project-wide admin + inbox. */
html[data-admin-theme="light"] body.admin-shell {
    background:
        radial-gradient(circle at 14% -4%, rgba(29, 78, 216, 0.08), transparent 30%),
        linear-gradient(180deg, #f8fafc 0%, #e9eef6 100%);
}

html[data-admin-theme="light"] .admin-content-topbar {
    background: rgba(248, 250, 252, 0.92);
    border-color: var(--border);
}

html[data-admin-theme="light"] .admin-sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.98));
    box-shadow: 18px 0 60px rgba(15, 23, 42, 0.08);
}

html[data-admin-theme="light"] .admin-sidebar-link:hover,
html[data-admin-theme="light"] .admin-sidebar-link.active {
    background: #eff6ff;
}

html[data-admin-theme="light"] .admin-theme-toggle,
html[data-admin-theme="light"] .admin-time-toggle,
html[data-admin-theme="light"] .admin-logout-button,
html[data-admin-theme="light"] .secondary-action-button,
html[data-admin-theme="light"] .secondary-link-button,
html[data-admin-theme="light"] .quick-reply-chip {
    background: #ffffff;
    color: #1e40af;
    border-color: #bfdbfe;
}

html[data-admin-theme="light"] .admin-theme-toggle:hover,
html[data-admin-theme="light"] .admin-time-toggle:hover,
html[data-admin-theme="light"] .secondary-action-button:hover,
html[data-admin-theme="light"] .secondary-link-button:hover,
html[data-admin-theme="light"] .quick-reply-chip:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #60a5fa;
}

html[data-admin-theme="light"] .admin-logout-button {
    color: #334155;
    border-color: var(--border);
}

html[data-admin-theme="light"] .agent-suggestion-toolbar {
    background: #f8fafc;
    border-color: #bfdbfe;
}

html[data-admin-theme="light"] .suggestion-action-icon {
    background: #dbeafe;
    color: #1e40af;
}


html[data-admin-theme="light"] .admin-filter-form input[type="date"],
html[data-admin-theme="light"] .admin-filter-form input[type="search"],
html[data-admin-theme="light"] .admin-filter-form select,
html[data-admin-theme="light"] .representative-reply-form input,
html[data-admin-theme="light"] .representative-reply-form textarea {
    background: #ffffff;
    color: #0f172a;
    border-color: var(--border-strong);
}

html[data-admin-theme="light"] .admin-filter-form input[type="date"]:focus,
html[data-admin-theme="light"] .admin-filter-form input[type="search"]:focus,
html[data-admin-theme="light"] .admin-filter-form select:focus,
html[data-admin-theme="light"] .representative-reply-form input:focus,
html[data-admin-theme="light"] .representative-reply-form textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

html[data-admin-theme="light"] .status-pill.success {
    border-color: #86efac;
    background: #ecfdf5;
    color: #047857;
}

html[data-admin-theme="light"] .status-pill.danger {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

html[data-admin-theme="light"] .status-pill-channel {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

html[data-admin-theme="light"] .status-pill-open {
    border-color: #86efac;
    background: #ecfdf5;
    color: #047857;
}

html[data-admin-theme="light"] .status-pill-closed {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #334155;
}

html[data-admin-theme="light"] .status-pill-archived,
html[data-admin-theme="light"] .status-pill-representative {
    border-color: #fbbf24;
    background: #fffbeb;
    color: #92400e;
}

html[data-admin-theme="light"] .chat-list-summary span,
html[data-admin-theme="light"] .chat-list-refresh-notice {
    background: #ffffff;
    color: #334155;
    border-color: var(--border);
}

html[data-admin-theme="light"] .chat-list-summary strong {
    color: #0f172a;
}

html[data-admin-theme="light"] .chat-list-refresh-notice {
    background: #fffbeb;
    color: #92400e;
    border-color: #fbbf24;
}

html[data-admin-theme="light"] .empty-state-card {
    background: #f8fafc;
    color: #334155;
    border-color: var(--border-strong);
}

html[data-admin-theme="light"] .empty-state-card strong {
    color: #0f172a;
}

html[data-admin-theme="light"] .chat-card {
    background:
        linear-gradient(135deg, #ffffff, #f8fafc),
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.08), transparent 32%);
    color: #0f172a;
    border-color: var(--border);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

html[data-admin-theme="light"] .chat-card:hover {
    background:
        linear-gradient(135deg, #ffffff, #eef6ff),
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.10), transparent 34%);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

html[data-admin-theme="light"] .chat-card.conversation-row-has-new-message {
    border-color: #dc2626;
    background:
        linear-gradient(135deg, #fff7ed, #ffffff),
        radial-gradient(circle at 0% 0%, rgba(220, 38, 38, 0.08), transparent 34%);
    box-shadow: inset 4px 0 0 #dc2626, 0 16px 36px rgba(127, 29, 29, 0.12);
}

html[data-admin-theme="light"] .chat-card-avatar {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

html[data-admin-theme="light"] .chat-card-id,
html[data-admin-theme="light"] .chat-card-footer,
html[data-admin-theme="light"] .chat-card-time {
    color: #475569;
}

html[data-admin-theme="light"] .chat-card-snippet {
    color: #0f172a;
}

html[data-admin-theme="light"] .chat-card-snippet strong {
    color: #1e40af;
}

html[data-admin-theme="light"] .chat-card-source-webchat {
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1e40af;
}

html[data-admin-theme="light"] .chat-card-source-livechat {
    border-color: #86efac;
    background: #ecfdf5;
    color: #047857;
}

html[data-admin-theme="light"] body.agent-inbox-body .chat-list-filter-panel {
    background: #ffffff;
    border-color: var(--border);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

html[data-admin-theme="light"] body.agent-inbox-body .chat-list-filter-panel[open] .chat-list-filter-toggle {
    border-color: var(--border);
}

html[data-admin-theme="light"] body.agent-inbox-body .chat-list-filter-toggle small,
html[data-admin-theme="light"] body.agent-inbox-body .chat-list-filter-toggle-state,
html[data-admin-theme="light"] body.agent-inbox-body .chat-list-filter-toggle::after {
    color: #475569;
}

html[data-admin-theme="light"] body.agent-inbox-body .agent-inbox-page {
    background: rgba(255, 255, 255, 0.94);
}

html[data-admin-theme="light"] .agent-inbox-sidebar,
html[data-admin-theme="light"] .agent-inbox-thread {
    background:
        linear-gradient(180deg, #ffffff, #f8fafc),
        radial-gradient(circle at 0 0, rgba(29, 78, 216, 0.06), transparent 36%);
    border-color: var(--border);
    box-shadow: 0 16px 46px rgba(15, 23, 42, 0.08);
}

html[data-admin-theme="light"] .agent-inbox-item.active {
    border-color: #2563eb;
    background:
        linear-gradient(135deg, #eff6ff, #ffffff),
        radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.10), transparent 34%);
    box-shadow: inset 4px 0 0 #2563eb;
}

html[data-admin-theme="light"] .agent-thread-header {
    background: #ffffff;
    border-color: var(--border);
}

html[data-admin-theme="light"] .agent-thread-live-shell .message-list {
    background:
        linear-gradient(135deg, #f8fafc, #eef2f7),
        radial-gradient(circle at 50% 10%, rgba(29, 78, 216, 0.04), transparent 42%);
    border: 1px solid var(--border);
    border-radius: 18px;
}

html[data-admin-theme="light"] .message-row {
    color: #0f172a;
    border-color: var(--border);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
}

html[data-admin-theme="light"] .message-row.ai {
    background: #eff6ff;
    border-color: #bfdbfe;
}

html[data-admin-theme="light"] .message-row.visitor {
    background: #ffffff;
    border-color: #cbd5e1;
}

html[data-admin-theme="light"] .message-row.representative {
    background: #ecfdf5;
    border-color: #86efac;
}

html[data-admin-theme="light"] .message-row.system {
    background: #fffbeb;
    border-color: #fbbf24;
}

html[data-admin-theme="light"] .message-meta {
    color: #334155;
}

html[data-admin-theme="light"] .message-body {
    color: #0f172a;
}

html[data-admin-theme="light"] body.agent-inbox-body .agent-thread-live-shell .message-meta strong {
    color: #1e40af;
}

html[data-admin-theme="light"] .message-actor-icon {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

html[data-admin-theme="light"] .message-actor-icon.actor-ai {
    color: #1e40af;
    border-color: #93c5fd;
    background: #dbeafe;
}

html[data-admin-theme="light"] .message-actor-icon.actor-representative {
    color: #047857;
    border-color: #86efac;
    background: #dcfce7;
}

html[data-admin-theme="light"] .message-actor-icon.actor-visitor {
    color: #334155;
    border-color: #cbd5e1;
    background: #f1f5f9;
}

html[data-admin-theme="light"] .message-actor-icon.actor-system {
    color: #92400e;
    border-color: #fbbf24;
    background: #fef3c7;
}

html[data-admin-theme="light"] .representative-panel,
html[data-admin-theme="light"] .representative-suggestions {
    background:
        radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08), transparent 34%),
        #eff6ff;
    border-color: #bfdbfe;
    color: #0f172a;
}

html[data-admin-theme="light"] body.agent-inbox-body .agent-thread-live-shell .representative-composer-panel {
    background: rgba(255, 255, 255, 0.96);
    border-color: var(--border);
    box-shadow: 0 -16px 40px rgba(15, 23, 42, 0.08);
}

html[data-admin-theme="light"] body.agent-inbox-body .agent-thread-live-shell .representative-body-field textarea {
    background: #ffffff;
    color: #0f172a;
    border-color: var(--border-strong);
}

html[data-admin-theme="light"] body.agent-inbox-body .agent-thread-live-shell .representative-body-field textarea::placeholder {
    color: #64748b;
}

html[data-admin-theme="light"] .admin-visitor-typing {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

html[data-admin-theme="light"] .admin-notification-toast {
    background: #ffffff;
    color: #0f172a;
    border-color: var(--border);
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.16);
}

html[data-admin-theme="light"] .admin-notification-toast-footer a {
    color: #1e40af;
}

html[data-admin-theme="light"] .admin-notification-toast-footer a:hover {
    color: #1d4ed8;
}

html[data-admin-theme="light"] .rule-test-details dd,
html[data-admin-theme="light"] .rule-response-box p {
    color: #0f172a;
}

html[data-admin-theme="light"] .rule-response-box {
    background: #ffffff;
    border-color: var(--border);
}

html[data-admin-theme="light"] .rule-response-box.warning {
    background: #fffbeb;
    border-color: #fbbf24;
}



/* V54 sidebar stability: open/close is transform-only and should not resize content. */
html[data-admin-theme] {
    scrollbar-gutter: stable;
}

.admin-dashboard-layout,
.admin-main-shell,
.admin-content {
    min-width: 0;
}

.admin-dashboard-layout {
    overflow-x: clip;
}

@media (max-width: 980px) {
    body.admin-sidebar-open {
        overflow: hidden;
    }

    .admin-sidebar {
        contain: layout paint;
        will-change: transform;
    }

    .admin-main-shell {
        width: 100%;
    }
}


/* V56 Dark theme contrast hardening: admin-wide + Inbox-first audit. */
html[data-admin-theme="dark"] {
    --bg: #030712;
    --surface: #0f172a;
    --surface-strong: #111c2f;
    --surface-soft: #0b1220;
    --border: rgba(148, 163, 184, 0.32);
    --border-strong: rgba(148, 163, 184, 0.48);
    --text: #f8fafc;
    --muted: #e2e8f0;
    --muted-soft: #a8b4c6;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --primary: #60a5fa;
    --primary-strong: #dbeafe;
    --danger: #fca5a5;
    --success: #86efac;
    --warning: #fbbf24;
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

html[data-admin-theme="dark"] body.admin-shell {
    background:
        radial-gradient(circle at 14% -4%, rgba(96, 165, 250, 0.18), transparent 30%),
        linear-gradient(180deg, #070b14 0%, #030712 100%);
}

html[data-admin-theme="dark"] .admin-content-topbar {
    background: rgba(3, 7, 18, 0.92);
    border-color: rgba(148, 163, 184, 0.28);
}

html[data-admin-theme="dark"] .admin-sidebar {
    border-color: rgba(148, 163, 184, 0.28);
    background:
        radial-gradient(circle at 10% 0%, rgba(96, 165, 250, 0.18), transparent 34%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
}

html[data-admin-theme="dark"] .admin-sidebar-link {
    color: #dbe4f0;
}

html[data-admin-theme="dark"] .admin-sidebar-link:hover {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(148, 163, 184, 0.36);
    color: #ffffff;
}

html[data-admin-theme="dark"] .admin-sidebar-link.active {
    background:
        linear-gradient(90deg, rgba(37, 99, 235, 0.28), rgba(15, 23, 42, 0.88));
    border-color: rgba(96, 165, 250, 0.58);
    color: #dbeafe;
    box-shadow: inset 3px 0 0 #60a5fa;
}

html[data-admin-theme="dark"] .admin-theme-toggle,
html[data-admin-theme="dark"] .admin-time-toggle,
html[data-admin-theme="dark"] .admin-logout-button,
html[data-admin-theme="dark"] .secondary-action-button,
html[data-admin-theme="dark"] .secondary-link-button,
html[data-admin-theme="dark"] .quick-reply-chip,
html[data-admin-theme="dark"] .compact-button:not(.primary-button) {
    background: #0b1220;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.34);
}

html[data-admin-theme="dark"] .admin-theme-toggle:hover,
html[data-admin-theme="dark"] .admin-time-toggle:hover,
html[data-admin-theme="dark"] .secondary-action-button:hover,
html[data-admin-theme="dark"] .secondary-link-button:hover,
html[data-admin-theme="dark"] .quick-reply-chip:hover,
html[data-admin-theme="dark"] .compact-button:not(.primary-button):hover {
    background: #111c2f;
    color: #dbeafe;
    border-color: rgba(96, 165, 250, 0.64);
}

html[data-admin-theme="dark"] .admin-logout-button:hover,
html[data-admin-theme="dark"] .danger-outline-button,
html[data-admin-theme="dark"] .danger-outline-button:hover {
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.56);
}

html[data-admin-theme="dark"] .danger-outline-button:hover {
    background: rgba(127, 29, 29, 0.34);
}

html[data-admin-theme="dark"] .hero-panel,
html[data-admin-theme="dark"] .panel,
html[data-admin-theme="dark"] .stat-card,
html[data-admin-theme="dark"] .conversation-card,
html[data-admin-theme="dark"] .learning-card,
html[data-admin-theme="dark"] .learning-report-card,
html[data-admin-theme="dark"] .learning-candidate-card,
html[data-admin-theme="dark"] .ai-task-card,
html[data-admin-theme="dark"] .check-card {
    background: rgba(15, 23, 42, 0.96);
    border-color: rgba(148, 163, 184, 0.30);
}

html[data-admin-theme="dark"] .admin-filter-form input[type="date"],
html[data-admin-theme="dark"] .admin-filter-form input[type="search"],
html[data-admin-theme="dark"] .admin-filter-form select,
html[data-admin-theme="dark"] .form-stack input,
html[data-admin-theme="dark"] .form-stack textarea,
html[data-admin-theme="dark"] .form-stack select,
html[data-admin-theme="dark"] .representative-reply-form input,
html[data-admin-theme="dark"] .representative-reply-form textarea,
html[data-admin-theme="dark"] .learning-action-box input,
html[data-admin-theme="dark"] .learning-action-box textarea,
html[data-admin-theme="dark"] .learning-action-box select {
    background: #020617;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.44);
}

html[data-admin-theme="dark"] input::placeholder,
html[data-admin-theme="dark"] textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

html[data-admin-theme="dark"] .admin-filter-form input[type="date"]:focus,
html[data-admin-theme="dark"] .admin-filter-form input[type="search"]:focus,
html[data-admin-theme="dark"] .admin-filter-form select:focus,
html[data-admin-theme="dark"] .representative-reply-form input:focus,
html[data-admin-theme="dark"] .representative-reply-form textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

html[data-admin-theme="dark"] .notice,
html[data-admin-theme="dark"] .callout.subtle {
    background: rgba(30, 64, 175, 0.18);
    border-color: rgba(96, 165, 250, 0.42);
    color: #eff6ff;
}

html[data-admin-theme="dark"] .filter-summary span,
html[data-admin-theme="dark"] .chat-list-summary span,
html[data-admin-theme="dark"] .learning-report-summary-pills span {
    background: #0b1220;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.34);
}

html[data-admin-theme="dark"] .filter-summary strong,
html[data-admin-theme="dark"] .chat-list-summary strong {
    color: #ffffff;
}

html[data-admin-theme="dark"] .status-pill.success,
html[data-admin-theme="dark"] .status-pill-open {
    background: rgba(20, 83, 45, 0.34);
    border-color: rgba(134, 239, 172, 0.48);
    color: #bbf7d0;
}

html[data-admin-theme="dark"] .status-pill.danger,
html[data-admin-theme="dark"] .status-pill-new-message {
    background: rgba(127, 29, 29, 0.38);
    border-color: rgba(252, 165, 165, 0.56);
    color: #fecaca;
}

html[data-admin-theme="dark"] .status-pill-closed {
    background: rgba(51, 65, 85, 0.42);
    border-color: rgba(203, 213, 225, 0.38);
    color: #e2e8f0;
}

html[data-admin-theme="dark"] .status-pill-archived,
html[data-admin-theme="dark"] .status-pill-representative,
html[data-admin-theme="dark"] .status-pill-ai-unsure {
    background: rgba(120, 53, 15, 0.36);
    border-color: rgba(251, 191, 36, 0.54);
    color: #fde68a;
}

html[data-admin-theme="dark"] .status-pill-channel {
    background: rgba(30, 64, 175, 0.28);
    border-color: rgba(96, 165, 250, 0.52);
    color: #dbeafe;
}

html[data-admin-theme="dark"] .chat-card {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(11, 18, 32, 0.94)),
        radial-gradient(circle at 0% 0%, rgba(96, 165, 250, 0.12), transparent 32%);
    border-color: rgba(148, 163, 184, 0.30);
    color: #f8fafc;
}

html[data-admin-theme="dark"] .chat-card:hover {
    background:
        linear-gradient(135deg, rgba(17, 28, 47, 0.98), rgba(15, 23, 42, 0.96)),
        radial-gradient(circle at 0% 0%, rgba(96, 165, 250, 0.18), transparent 34%);
    border-color: rgba(96, 165, 250, 0.56);
}

html[data-admin-theme="dark"] .chat-card-id,
html[data-admin-theme="dark"] .chat-card-footer,
html[data-admin-theme="dark"] .chat-card-time {
    color: #cbd5e1;
}

html[data-admin-theme="dark"] .chat-card-snippet {
    color: #f1f5f9;
}

html[data-admin-theme="dark"] .chat-card-snippet strong,
html[data-admin-theme="dark"] .conversation-search-footer a {
    color: #bfdbfe;
}

html[data-admin-theme="dark"] .chat-card-avatar {
    background: rgba(30, 64, 175, 0.30);
    color: #dbeafe;
    border-color: rgba(96, 165, 250, 0.50);
}

html[data-admin-theme="dark"] .chat-card-source-webchat {
    background: rgba(30, 64, 175, 0.32);
    border-color: rgba(96, 165, 250, 0.56);
    color: #dbeafe;
}

html[data-admin-theme="dark"] .chat-card-source-livechat {
    background: rgba(20, 83, 45, 0.36);
    border-color: rgba(134, 239, 172, 0.48);
    color: #bbf7d0;
}

/* Inbox: highest contrast path because it is the densest screen. */
html[data-admin-theme="dark"] body.agent-inbox-body .agent-inbox-page {
    background:
        radial-gradient(circle at 85% 0%, rgba(96, 165, 250, 0.10), transparent 30%),
        #030712;
}

html[data-admin-theme="dark"] body.agent-inbox-body .chat-list-filter-panel {
    background: #0b1220;
    border-color: rgba(148, 163, 184, 0.34);
}

html[data-admin-theme="dark"] body.agent-inbox-body .chat-list-filter-panel[open] .chat-list-filter-toggle {
    border-color: rgba(148, 163, 184, 0.32);
}

html[data-admin-theme="dark"] body.agent-inbox-body .chat-list-filter-toggle strong {
    color: #ffffff;
}

html[data-admin-theme="dark"] body.agent-inbox-body .chat-list-filter-toggle small,
html[data-admin-theme="dark"] body.agent-inbox-body .chat-list-filter-toggle-state,
html[data-admin-theme="dark"] body.agent-inbox-body .chat-list-filter-toggle::after {
    color: #cbd5e1;
}

html[data-admin-theme="dark"] .agent-inbox-sidebar,
html[data-admin-theme="dark"] .agent-inbox-thread {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.94)),
        radial-gradient(circle at 0 0, rgba(96, 165, 250, 0.12), transparent 36%);
    border-color: rgba(148, 163, 184, 0.32);
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
}

html[data-admin-theme="dark"] .agent-inbox-item.active {
    border-color: rgba(96, 165, 250, 0.72);
    background:
        linear-gradient(135deg, rgba(30, 64, 175, 0.38), rgba(15, 23, 42, 0.95)),
        radial-gradient(circle at 0% 0%, rgba(34, 197, 94, 0.14), transparent 34%);
    box-shadow: inset 4px 0 0 #60a5fa;
}

html[data-admin-theme="dark"] .agent-thread-header {
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(148, 163, 184, 0.30);
}

html[data-admin-theme="dark"] .agent-thread-live-shell .message-list {
    background:
        linear-gradient(135deg, #030712, #0b1220),
        radial-gradient(circle at 50% 10%, rgba(96, 165, 250, 0.08), transparent 42%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 18px;
}

html[data-admin-theme="dark"] .message-row {
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.30);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

html[data-admin-theme="dark"] .message-row.ai {
    background: #101b2f;
    border-color: rgba(96, 165, 250, 0.34);
}

html[data-admin-theme="dark"] .message-row.visitor {
    background: #07111f;
    border-color: rgba(203, 213, 225, 0.28);
}

html[data-admin-theme="dark"] .message-row.representative {
    background: #062814;
    border-color: rgba(134, 239, 172, 0.34);
}

html[data-admin-theme="dark"] .message-row.system {
    background: #2b1d0b;
    border-color: rgba(251, 191, 36, 0.42);
}

html[data-admin-theme="dark"] .message-meta {
    color: #cbd5e1;
}

html[data-admin-theme="dark"] .message-body {
    color: #f8fafc;
}

html[data-admin-theme="dark"] body.agent-inbox-body .agent-thread-live-shell .message-meta strong {
    color: #dbeafe;
}

html[data-admin-theme="dark"] .message-row.representative .message-meta strong {
    color: #bbf7d0;
}

html[data-admin-theme="dark"] .message-row.visitor .message-meta strong {
    color: #f8fafc;
}

html[data-admin-theme="dark"] .message-row.system .message-meta strong {
    color: #fde68a;
}

html[data-admin-theme="dark"] .message-actor-icon.actor-ai {
    color: #dbeafe;
    border-color: rgba(96, 165, 250, 0.56);
    background: rgba(30, 64, 175, 0.34);
}

html[data-admin-theme="dark"] .message-actor-icon.actor-representative {
    color: #bbf7d0;
    border-color: rgba(134, 239, 172, 0.48);
    background: rgba(20, 83, 45, 0.42);
}

html[data-admin-theme="dark"] .message-actor-icon.actor-visitor {
    color: #f8fafc;
    border-color: rgba(203, 213, 225, 0.38);
    background: rgba(51, 65, 85, 0.48);
}

html[data-admin-theme="dark"] .message-actor-icon.actor-system {
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.48);
    background: rgba(120, 53, 15, 0.42);
}

html[data-admin-theme="dark"] .representative-panel,
html[data-admin-theme="dark"] .representative-suggestions {
    background:
        radial-gradient(circle at 100% 0%, rgba(96, 165, 250, 0.14), transparent 34%),
        #0b1220;
    border-color: rgba(96, 165, 250, 0.38);
    color: #f8fafc;
}

html[data-admin-theme="dark"] body.agent-inbox-body .agent-thread-live-shell .representative-composer-panel {
    background: rgba(3, 7, 18, 0.96);
    border-color: rgba(96, 165, 250, 0.32);
    box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.34);
}

html[data-admin-theme="dark"] body.agent-inbox-body .agent-thread-live-shell .representative-body-field textarea {
    background: #020617;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.46);
}

html[data-admin-theme="dark"] .agent-suggestion-toolbar {
    background: #020617;
    border-color: rgba(96, 165, 250, 0.38);
}

html[data-admin-theme="dark"] .suggestion-action-icon {
    background: rgba(96, 165, 250, 0.18);
    color: #bfdbfe;
}

html[data-admin-theme="dark"] .suggestion-tool-button:disabled,
html[data-admin-theme="dark"] .ai-suggest-primary:disabled {
    opacity: 0.58;
}

html[data-admin-theme="dark"] .admin-visitor-typing {
    background: #0b1220;
    border-color: rgba(96, 165, 250, 0.36);
    color: #dbeafe;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.30);
}

html[data-admin-theme="dark"] .admin-notification-toast {
    background: #0b1220;
    color: #f8fafc;
    border-color: rgba(148, 163, 184, 0.36);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
}

html[data-admin-theme="dark"] .admin-notification-toast-head button {
    background: #020617;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.34);
}

html[data-admin-theme="dark"] .admin-notification-toast-visitor {
    color: #cbd5e1;
}

html[data-admin-theme="dark"] .admin-notification-toast-footer a {
    color: #bfdbfe;
}

html[data-admin-theme="dark"] .webchat-live-card,
html[data-admin-theme="dark"] .ai-representative-suggestion-card,
html[data-admin-theme="dark"] .livechat-widget-code-card,
html[data-admin-theme="dark"] .livechat-scope-guide,
html[data-admin-theme="dark"] .livechat-connection-alert.info {
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(96, 165, 250, 0.34);
}

html[data-admin-theme="dark"] .webchat-live-card:hover,
html[data-admin-theme="dark"] .webchat-live-card.active,
html[data-admin-theme="dark"] .webchat-live-tabs a.active {
    background: rgba(30, 64, 175, 0.24);
    border-color: rgba(96, 165, 250, 0.58);
    color: #dbeafe;
}

html[data-admin-theme="dark"] .widget-preview-root[data-theme="dark"] {
    --preview-panel: #0f172a;
    --preview-panel-soft: #0b1220;
    --preview-panel-strong: #020617;
    --preview-border: rgba(148, 163, 184, 0.30);
    --preview-border-strong: rgba(148, 163, 184, 0.46);
    --preview-muted: #e2e8f0;
    --preview-muted-soft: #a8b4c6;
    --preview-ai-bg: #101b2f;
    --preview-ai-text: #f8fafc;
    --preview-input-bg: #020617;
    --preview-input-text: #f8fafc;
    --preview-notice-bg: rgba(30, 64, 175, 0.26);
    --preview-notice-text: #dbeafe;
}

html[data-admin-theme="dark"] .preview-composer input::placeholder,
html[data-admin-theme="dark"] .preview-email input::placeholder {
    color: #94a3b8;
}
