:root {
    --ct-admin-primary: #1b6ec2;
    --ct-admin-primary-dark: #155aa0;
    --ct-admin-primary-soft: rgba(27, 110, 194, 0.12);
    --ct-admin-bg: #f3f7fb;
    --ct-admin-card: #ffffff;
    --ct-admin-text: #162235;
    --ct-admin-muted: #667085;
    --ct-admin-line: #e2e8f0;
    --ct-admin-line-strong: #d4dde8;
    --ct-admin-success: #12a46f;
    --ct-admin-danger: #d92d20;
    --ct-admin-warning: #b54708;
    --ct-admin-shadow: 0 20px 55px rgba(27, 54, 93, 0.12);
    --ct-admin-shadow-sm: 0 10px 28px rgba(27, 54, 93, 0.08);
    --ct-page-gutter: 1.5rem;
}

html,
body {
    background:
        radial-gradient(circle at 18% 0%, rgba(27, 110, 194, 0.09), transparent 30rem),
        linear-gradient(180deg, #f7fbff 0%, var(--ct-admin-bg) 100%);
    color: var(--ct-admin-text);
    font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
    min-height: 100%;
}

a,
.btn-link {
    color: var(--ct-admin-primary);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ct-admin-text);
    font-weight: 800;
    letter-spacing: 0;
}

.text-muted {
    color: var(--ct-admin-muted) !important;
}

.content {
    padding-bottom: var(--ct-page-gutter);
    padding-top: 1.75rem;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    color-scheme: light only;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.btn {
    align-items: center;
    border-radius: 10px;
    display: inline-flex;
    font-weight: 760;
    gap: 0.5rem;
    justify-content: center;
    min-height: 2.55rem;
    transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.btn-sm {
    border-radius: 9px;
    min-height: 2.15rem;
}

.btn-primary {
    background: var(--ct-admin-primary);
    border-color: var(--ct-admin-primary);
    box-shadow: 0 12px 24px rgba(27, 110, 194, 0.18);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--ct-admin-primary-dark);
    border-color: var(--ct-admin-primary-dark);
    color: #fff;
}

.btn-outline-primary {
    border-color: rgba(27, 110, 194, 0.35);
    color: var(--ct-admin-primary);
}

.btn-outline-primary:hover {
    background: var(--ct-admin-primary);
    border-color: var(--ct-admin-primary);
}

.btn-outline-secondary {
    border-color: var(--ct-admin-line-strong);
    color: #4b5565;
}

.btn-outline-secondary:hover {
    background: #f8fafc;
    border-color: #b9c5d4;
    color: var(--ct-admin-text);
}

.translate-draft-action {
    cursor: pointer;
    user-select: none;
}

.translate-draft-action.disabled {
    cursor: not-allowed;
    opacity: 0.65;
    pointer-events: none;
}

.language-switch {
    min-width: 8.5rem;
}

.language-switch .form-select {
    min-height: 2.15rem;
}

.btn-outline-danger {
    border-color: rgba(217, 45, 32, 0.34);
    color: var(--ct-admin-danger);
}

.btn-outline-danger:hover {
    background: var(--ct-admin-danger);
    border-color: var(--ct-admin-danger);
}

.btn:disabled,
.btn.disabled {
    cursor: wait;
}

.btn-is-loading {
    pointer-events: none;
}

.form-control,
.form-select {
    background-color: #fff;
    border-color: var(--ct-admin-line-strong);
    border-radius: 10px;
    color: var(--ct-admin-text);
    min-height: 2.55rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus {
    border-color: var(--ct-admin-primary);
    box-shadow: 0 0 0 4px var(--ct-admin-primary-soft);
}

.form-label {
    color: #344054;
    font-size: 0.92rem;
    font-weight: 760;
}

.form-text {
    color: var(--ct-admin-muted);
}

.form-check-input {
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--ct-admin-primary);
    border-color: var(--ct-admin-primary);
}

.panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(210, 221, 234, 0.9);
    border-radius: 16px;
    box-shadow: var(--ct-admin-shadow-sm);
    padding: 1.25rem;
}

.status-toast {
    align-items: center;
    animation: status-toast-in 0.18s ease-out;
    background: #ffffff;
    border: 1px solid #b7e4cf;
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(16, 24, 40, 0.18);
    color: #176b49;
    display: flex;
    font-size: 0.88rem;
    font-weight: 700;
    gap: 0.55rem;
    max-width: min(24rem, calc(100vw - 2rem));
    padding: 0.7rem 0.85rem;
    position: fixed;
    right: 1rem;
    top: 4.25rem;
    z-index: 1100;
}

.status-toast-mark {
    align-items: center;
    background: #e8f8ef;
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 1.45rem;
    height: 1.45rem;
    justify-content: center;
}

.status-toast-danger {
    border-color: #f1b8b2;
    color: #9f2d20;
}

.status-toast-danger .status-toast-mark {
    background: #fff0ed;
}

.status-toast-warning {
    border-color: #f2d09b;
    color: #8a4b08;
}

.status-toast-warning .status-toast-mark {
    background: #fff7e8;
}

.status-toast-info {
    border-color: #b6d2f2;
    color: #155aa0;
}

.status-toast-info .status-toast-mark {
    background: #edf5ff;
}

@keyframes status-toast-in {
    from {
        opacity: 0;
        transform: translateY(-0.35rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel.is-busy {
    cursor: wait;
    min-height: 10rem;
    overflow: hidden;
    position: relative;
}

.panel.is-busy::before {
    background: rgba(255, 255, 255, 0.76);
    content: "";
    inset: 0;
    pointer-events: auto;
    position: absolute;
    z-index: 8;
}

.panel.is-busy .loading-state,
.panel.is-busy .loading-inline {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(210, 221, 234, 0.95);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(27, 54, 93, 0.14);
    left: 50%;
    padding: 0.8rem 1rem;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    z-index: 9;
}

.panel:hover {
    box-shadow: var(--ct-admin-shadow);
}

.loading-state,
.loading-inline {
    align-items: center;
    color: var(--ct-admin-muted);
    display: flex;
    gap: 0.65rem;
}

.loading-state {
    justify-content: center;
    min-height: 8rem;
    text-align: center;
}

.page-is-loading::before {
    background: rgba(243, 247, 251, 0.82);
    content: "";
    inset: 0 0 0 250px;
    pointer-events: auto;
    position: fixed;
    z-index: 2147481000;
}

.page-loading-indicator {
    align-items: center;
    display: flex;
    inset: 0 0 0 250px;
    justify-content: center;
    pointer-events: none;
    position: fixed;
    z-index: 2147481001;
}

.page-loading-indicator .loading-state {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(210, 221, 234, 0.95);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(27, 54, 93, 0.16);
    min-height: auto;
    padding: 0.9rem 1.1rem;
}

@media (max-width: 640.98px) {
    .page-is-loading::before,
    .page-loading-indicator {
        inset: 0;
    }
}

.loading-inline {
    font-size: 0.92rem;
}

.loading-spinner {
    animation: loading-spin 0.8s linear infinite;
    border: 2px solid rgba(27, 110, 194, 0.22);
    border-radius: 999px;
    border-top-color: var(--ct-admin-primary);
    display: inline-block;
    flex: 0 0 auto;
    height: 1rem;
    width: 1rem;
}

.loading-spinner.sm {
    height: 0.85rem;
    width: 0.85rem;
}

.loading-text {
    min-width: 0;
}

@keyframes loading-spin {
    to {
        transform: rotate(360deg);
    }
}

.auth-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 8rem);
}

.auth-panel {
    max-width: 440px;
    width: 100%;
}

.metric {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(210, 221, 234, 0.9);
    border-radius: 16px;
    box-shadow: var(--ct-admin-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 7rem;
    padding: 1.2rem;
}

.metric span {
    color: var(--ct-admin-muted);
    font-size: 0.92rem;
}

.metric strong {
    color: var(--ct-admin-text);
    font-size: 1.55rem;
}

.install-code {
    background: #101828;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #edf2f7;
    font-size: 0.9rem;
    margin-bottom: 0;
    overflow-x: auto;
    padding: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.table {
    color: var(--ct-admin-text);
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--ct-admin-line);
    padding: 0.95rem 0.85rem;
}

.table thead th {
    background: #f8fafc;
    color: #526070;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.table tbody tr {
    transition: background-color 0.18s ease;
}

.table tbody tr:hover {
    background: #f8fbff;
}

.table code,
.install-code code {
    color: inherit;
}

.badge {
    border-radius: 999px;
    font-weight: 760;
    padding: 0.42rem 0.6rem;
}

.alert {
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(27, 54, 93, 0.08);
    margin-bottom: 0;
    padding: 0.9rem 1rem;
}

.modal-backdrop.show {
    background: rgba(15, 23, 42, 0.46);
    opacity: 1;
}

.modal-content {
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.25);
    overflow: hidden;
}

.modal-header,
.modal-footer {
    border-color: var(--ct-admin-line);
}

.modal-title {
    font-weight: 820;
}

.alert-success {
    background: #ecfdf5;
    border-color: rgba(18, 164, 111, 0.18);
    color: #047857;
}

.alert-danger {
    background: #fff1f0;
    border-color: rgba(217, 45, 32, 0.18);
    color: #b42318;
}

.alert-warning {
    background: #fffaeb;
    border-color: rgba(181, 71, 8, 0.18);
    color: var(--ct-admin-warning);
}

.alert-info {
    background: #eef6ff;
    border-color: rgba(27, 110, 194, 0.16);
    color: #155aa0;
}

.alert-info[role="status"] {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--ct-admin-line);
    border-radius: 16px;
    box-shadow: var(--ct-admin-shadow-sm);
    color: var(--ct-admin-muted);
    display: flex;
    gap: 0.65rem;
    justify-content: center;
    min-height: 11rem;
    padding: 1.5rem;
}

.alert-info[role="status"]::before {
    animation: loading-spin 0.8s linear infinite;
    border: 2px solid rgba(27, 110, 194, 0.22);
    border-radius: 999px;
    border-top-color: var(--ct-admin-primary);
    content: "";
    flex: 0 0 auto;
    height: 1rem;
    width: 1rem;
}

.text-bg-success {
    background-color: rgba(18, 164, 111, 0.13) !important;
    color: #047857 !important;
}

.text-bg-secondary {
    background-color: #eef2f7 !important;
    color: #475467 !important;
}

.text-bg-warning {
    background-color: #fff4d6 !important;
    color: var(--ct-admin-warning) !important;
}

.text-bg-danger {
    background-color: #ffe4e2 !important;
    color: #b42318 !important;
}

.table-url {
    max-width: 20rem;
}

.site-detail-layout {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
}

.site-detail-main,
.site-detail-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.site-settings-panel,
.site-side-panel,
.quick-reply-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-section {
    border-bottom: 1px solid var(--ct-admin-line);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 1.25rem;
}

.settings-section:last-of-type {
    border-bottom: 0;
    padding-bottom: 0;
}

.settings-section-header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.site-form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-form-grid.compact {
    grid-template-columns: 1fr;
}

.site-form-full {
    grid-column: 1 / -1;
}

.knowledge-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    min-height: 220px;
}

.log-message-cell {
    max-width: 24rem;
    white-space: normal;
}

.detail-label {
    color: var(--ct-admin-muted);
    font-size: 0.8rem;
    font-weight: 760;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.log-detail-block {
    border-top: 1px solid var(--ct-admin-line);
    padding: 1rem 0 0;
}

.log-detail-block + .log-detail-block {
    margin-top: 1rem;
}

.log-detail-block h3 {
    color: #344054;
    font-size: 0.92rem;
    font-weight: 760;
    margin-bottom: 0.5rem;
}

.log-detail-block pre {
    background: #0f172a;
    border-radius: 8px;
    color: #e5eefb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    margin: 0;
    max-height: 26rem;
    overflow: auto;
    padding: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.theme-color-control {
    align-items: center;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: auto minmax(0, 1fr);
}

.setting-switch-row {
    align-items: center;
    background: #f8fbff;
    border: 1px solid var(--ct-admin-line);
    border-radius: 12px;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-height: 4rem;
    padding: 0.75rem 0.9rem;
}

.setting-switch-row .form-check {
    margin-bottom: 0;
    white-space: nowrap;
}

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

.settings-actions .btn {
    min-width: 8rem;
}

.lead-field-heading {
    align-items: center;
    display: flex;
    font-weight: 780;
    gap: 0.75rem;
    justify-content: space-between;
}

.site-meta-list {
    display: grid;
    gap: 0.45rem 0.75rem;
    grid-template-columns: 6rem minmax(0, 1fr);
    margin-bottom: 0;
}

.site-meta-list dt,
.customer-mobile-detail dt,
.detail-list dt,
.sidebar-detail-list dt {
    color: var(--ct-admin-muted);
    font-weight: 760;
}

.site-meta-list dd,
.customer-mobile-detail dd,
.detail-list dd,
.sidebar-detail-list dd {
    margin-bottom: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.customer-card-list {
    display: none;
}

.customer-mobile-card {
    border-top: 1px solid var(--ct-admin-line);
    padding: 1rem 0;
}

.customer-mobile-card:first-child {
    border-top: 0;
    padding-top: 0;
}

.customer-mobile-card:last-child {
    padding-bottom: 0;
}

.customer-mobile-header {
    align-items: flex-start;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.customer-mobile-name,
.customer-mobile-contact {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.customer-mobile-detail {
    display: grid;
    gap: 0.45rem 0.75rem;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    margin: 0.8rem 0 0;
}

.customer-mobile-detail dt,
.sidebar-detail-list dt {
    font-size: 0.86rem;
}

.min-w-0 {
    min-width: 0;
}

.detail-list {
    display: grid;
    gap: 0.6rem 1rem;
    grid-template-columns: minmax(5rem, 7rem) 1fr;
}

.break-all {
    word-break: break-all;
}

.note-item,
.conversation-item {
    border-top: 1px solid var(--ct-admin-line);
    padding: 1rem 0;
}

.note-item:last-child,
.conversation-item:last-child {
    padding-bottom: 0;
}

.message-line {
    align-items: baseline;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 4rem 1fr auto;
    padding: 0.35rem 0;
}

.message-sender {
    color: #475467;
    font-size: 0.86rem;
    font-weight: 760;
}

.inbox-page {
    min-height: 0;
}

.inbox-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.55rem;
    justify-content: flex-start;
    min-height: 0;
}

.toolbar-group {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(210, 221, 234, 0.9);
    border-radius: 10px;
    box-shadow: var(--ct-admin-shadow-sm);
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0.45rem 0.55rem;
    min-height: 2.15rem;
    padding: 0.18rem 0.55rem;
}

.presence-panel {
    margin-left: auto;
}

.presence-meta,
.toolbar-kicker {
    color: var(--ct-admin-muted);
    font-size: 0.74rem;
    line-height: 1;
    white-space: nowrap;
}

.toolbar-kicker {
    font-weight: 760;
}

.inbox-toolbar .form-check {
    min-height: 0;
    padding-left: 2.1rem;
}

.inbox-toolbar .form-check-input {
    height: 1rem;
    margin-left: -2.1rem;
    margin-top: 0.12rem;
    width: 1.75rem;
}

.inbox-toolbar .form-check-label {
    font-size: 0.82rem;
    line-height: 1.1;
}

.inbox-toolbar .translation-language-select,
.inbox-toolbar .form-select-sm {
    font-size: 0.78rem;
    min-height: 1.7rem;
    min-width: 6.5rem;
    padding: 0.12rem 1.75rem 0.12rem 0.45rem;
}

.ai-status-badge {
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 760;
    line-height: 1;
    padding: 0.28rem 0.5rem;
    white-space: nowrap;
}

.ai-status-badge.is-on {
    background: #e8f8ef;
    color: #0f7a4c;
}

.ai-status-badge.is-off {
    background: #eef2f7;
    color: #667085;
}

.ai-status-badge.is-muted {
    background: #f5f7fa;
    color: #98a2b3;
}

.chat-workspace {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(18rem, 23rem) minmax(0, 1fr) minmax(18rem, 24rem);
    height: max(32rem, calc(100dvh - 3.5rem - 1.75rem - 2.5rem - var(--ct-page-gutter)));
    min-height: 0;
}

.conversation-list {
    max-height: 100%;
    overflow-y: auto;
}

.conversation-button {
    background: #fff;
    border: 1px solid var(--ct-admin-line);
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.85rem;
    text-align: left;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    width: 100%;
}

.conversation-title-row {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

.conversation-ai-flags {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ai-requirement-pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 760;
    line-height: 1;
    padding: 0.28rem 0.48rem;
    white-space: nowrap;
}

.ai-requirement-pill.lead {
    background: #fff4d6;
    color: #8a4b08;
}

.ai-requirement-pill.contact {
    background: #eaf2ff;
    color: #155aa0;
}

.conversation-button.active,
.conversation-button:hover {
    border-color: var(--ct-admin-primary);
    box-shadow: 0 0 0 4px var(--ct-admin-primary-soft), var(--ct-admin-shadow-sm);
    transform: translateY(-1px);
}

.conversation-meta {
    align-items: center;
    color: var(--ct-admin-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.8rem;
    gap: 0.5rem;
    justify-content: space-between;
}

.priority-pill {
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 760;
    line-height: 1;
    padding: 0.32rem 0.5rem;
    white-space: nowrap;
}

.priority-normal {
    background: #eef2f7;
    color: #475467;
}

.priority-high {
    background: #fff4d6;
    color: var(--ct-admin-warning);
}

.priority-urgent {
    background: #ffe4e6;
    color: #b42318;
}

.chat-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    overflow: hidden;
}

.customer-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 100%;
    overflow-y: auto;
}

.sidebar-section {
    border-bottom: 1px solid var(--ct-admin-line);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 1rem;
}

.sidebar-section:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.sidebar-detail-list {
    display: grid;
    gap: 0.45rem 0.8rem;
    grid-template-columns: 4.5rem 1fr;
    margin-bottom: 0;
}

.thread-header {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.translation-controls {
    align-items: center;
    display: flex;
    gap: 0.45rem;
}

.translation-language-select {
    min-width: 7rem;
    width: auto;
}

.message-compose {
    container-name: message-compose;
    container-type: inline-size;
    display: block;
}

.compose-shell {
    background: #ffffff;
    border: 1px solid var(--ct-admin-line-strong);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.compose-input {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    line-height: 1.55;
    min-height: 6rem;
    padding: 0.9rem 1rem;
    resize: vertical;
}

.compose-input:focus {
    box-shadow: inset 0 0 0 2px var(--ct-admin-primary-soft);
}

.compose-footer {
    align-items: center;
    background: #f8fafc;
    border-top: 1px solid var(--ct-admin-line);
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0.6rem 0.7rem;
}

.compose-tools {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem 0.75rem;
    min-width: 0;
}

.compose-action-group,
.compose-translation-tools {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.compose-action-group {
    border-right: 1px solid var(--ct-admin-line);
    padding-right: 0.75rem;
}

.compose-tool-label {
    color: var(--ct-admin-muted);
    font-size: 0.76rem;
    font-weight: 760;
    min-width: 3.5rem;
    white-space: nowrap;
}

.compose-utility-action,
.compose-translate-action,
.compose-translation-tools .form-select {
    min-height: 2.25rem;
}

.compose-utility-action {
    background: #ffffff;
}

.compose-utility-action:hover:not(:disabled) {
    background: #eef4f9;
    border-color: #aab8c8;
}

.compose-action-menu {
    position: relative;
}

.compose-menu-chevron {
    font-size: 0.95rem;
    line-height: 0.75;
    margin-left: 0.15rem;
}

.compose-action-menu-panel {
    background: #ffffff;
    border: 1px solid var(--ct-admin-line-strong);
    border-radius: 10px;
    bottom: calc(100% + 0.45rem);
    box-shadow: 0 14px 28px rgba(16, 24, 40, 0.16);
    display: grid;
    gap: 0.25rem;
    left: 0;
    min-width: 10.5rem;
    padding: 0.35rem;
    position: absolute;
    z-index: 20;
}

.compose-action-menu-item {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: var(--ct-admin-text);
    display: flex;
    font-size: 0.86rem;
    gap: 0.45rem;
    justify-content: flex-start;
    min-height: 2.25rem;
    padding: 0.45rem 0.6rem;
    text-align: left;
    white-space: nowrap;
    width: 100%;
}

.compose-action-menu-item:hover:not(:disabled),
.compose-action-menu-item:focus-visible {
    background: #eef4f9;
    color: var(--ct-admin-primary-dark);
}

.compose-action-menu-item:disabled {
    cursor: wait;
    opacity: 0.58;
}

.compose-send {
    align-items: center;
    align-self: stretch;
    display: inline-flex;
    gap: 0.4rem;
    justify-content: center;
    min-width: 5rem;
}

.compose-hint {
    color: var(--ct-admin-muted);
    font-size: 0.8rem;
    margin: 0.45rem 0 0;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-list.compact {
    gap: 0.3rem;
}

.tag-chip {
    align-items: center;
    background: #edf7f6;
    border: 1px solid #b8ddda;
    border-radius: 999px;
    color: #245c5a;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 760;
    gap: 0.25rem;
    min-height: 1.65rem;
    padding: 0.25rem 0.55rem;
}

.tag-chip.removable {
    cursor: pointer;
}

.tag-chip.removable:hover {
    background: #dff1ef;
}

.note-stack,
.assignment-log {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.note-entry,
.assignment-entry {
    background: #f8fbff;
    border: 1px solid var(--ct-admin-line);
    border-radius: 12px;
    padding: 0.7rem;
}

.message-feed {
    background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
    border: 1px solid var(--ct-admin-line);
    border-radius: 16px;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
}

.chat-bubble {
    border-radius: 16px;
    max-width: min(42rem, 88%);
    padding: 0.75rem 0.9rem;
}

.chat-bubble.agent {
    align-self: flex-end;
    background: var(--ct-admin-primary);
    color: #fff;
}

.chat-bubble.agent .message-translation {
    border-top-color: rgba(255, 255, 255, 0.28);
    color: rgba(255, 255, 255, 0.92);
}

.chat-bubble.agent .translation-label,
.chat-bubble.agent .translation-loading,
.chat-bubble.agent .message-translation .text-danger {
    color: rgba(255, 255, 255, 0.78) !important;
}

.chat-bubble.agent .message-translation .btn-link {
    color: #dbeafe;
}

.chat-bubble.customer {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--ct-admin-line);
    box-shadow: 0 8px 18px rgba(16, 24, 40, 0.05);
}

.chat-bubble.ai {
    align-self: flex-start;
    background: #ecfdf3;
}

.chat-bubble.system {
    align-self: center;
    background: #eef2f7;
    color: #475467;
}

.chat-bubble.agent .chat-bubble-meta {
    color: rgba(255, 255, 255, 0.72);
}

.chat-bubble-meta {
    color: var(--ct-admin-muted);
    font-size: 0.78rem;
    margin-bottom: 0.3rem;
}

.message-translation {
    border-top: 1px solid var(--ct-admin-line);
    color: #475467;
    font-size: 0.86rem;
    line-height: 1.45;
    margin-top: 0.65rem;
    padding-top: 0.55rem;
}

.translation-label {
    color: var(--ct-admin-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 0.2rem;
}

.translation-loading {
    align-items: center;
    color: var(--ct-admin-muted);
    display: inline-flex;
    gap: 0.4rem;
}

.empty-thread {
    align-items: center;
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.quick-reply-form {
    border-bottom: 1px solid var(--ct-admin-line);
    padding-bottom: 1rem;
}

.lead-field-settings {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.lead-field-row {
    align-items: center;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(8rem, 1fr) minmax(6rem, 8rem) auto auto;
}

.language-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.language-checkbox {
    align-items: center;
    background: #f8fbff;
    border: 1px solid var(--ct-admin-line);
    border-radius: 10px;
    display: inline-flex;
    gap: 0.45rem;
    margin: 0;
    min-height: 2.55rem;
    padding: 0.45rem 0.75rem;
}

.language-checkbox .form-check-input {
    margin: 0;
}

@container message-compose (max-width: 48rem) {
    .compose-footer {
        gap: 0.45rem;
        padding-left: 0.55rem;
        padding-right: 0.55rem;
    }

    .compose-tools {
        gap: 0.45rem;
    }

    .compose-action-group,
    .compose-translation-tools {
        flex-wrap: nowrap;
        gap: 0.3rem;
    }

    .compose-action-group {
        padding-right: 0.45rem;
    }

    .compose-tool-label {
        font-size: 0.7rem;
        min-width: auto;
    }

    .compose-translation-tools .translation-language-select {
        min-width: 0;
        width: 6.5rem;
    }
}

@container message-compose (max-width: 29rem) {
    .compose-footer {
        gap: 0.3rem;
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }

    .compose-tools {
        gap: 0.3rem;
    }

    .compose-tool-label {
        display: none;
    }

    .compose-action-group {
        padding-right: 0.3rem;
    }

    .compose-utility-action,
    .compose-translate-action,
    .compose-translation-tools .form-select {
        font-size: 0.76rem;
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }

    .compose-translation-tools .translation-language-select {
        width: 4.9rem;
    }

    .compose-send {
        min-width: 4.25rem;
    }
}

.chat-test-page {
    display: grid;
    gap: 1rem;
}

.chat-test-heading,
.chat-test-toolbar {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.chat-test-toolbar {
    background: #ffffff;
    border-bottom: 1px solid var(--ct-admin-line);
    border-top: 1px solid var(--ct-admin-line);
    padding: 0.75rem 0;
}

.chat-test-link-panel {
    background: #ffffff;
    border: 1px solid var(--ct-admin-line);
    border-radius: 12px;
    display: grid;
    gap: 0.8rem;
    padding: 1rem 1.1rem;
}

.chat-test-link-heading {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.chat-test-link-status {
    color: var(--ct-admin-success);
    font-size: 0.82rem;
    font-weight: 700;
    min-height: 1.25rem;
    white-space: nowrap;
}

.chat-test-link-row {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.chat-test-link-input {
    color: #475467;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    min-width: 0;
}

.chat-test-steps {
    color: var(--ct-admin-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.5rem;
    list-style-position: inside;
    margin: 0;
    padding: 0;
}

.chat-test-steps li {
    font-size: 0.82rem;
}

.chat-test-site-picker {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    min-width: 0;
}

.chat-test-site-picker .form-label {
    flex: 0 0 auto;
}

.chat-test-site-picker .form-select {
    min-width: min(28rem, 60vw);
}

.chat-test-stage {
    background: #eef3f6;
    border: 1px solid var(--ct-admin-line-strong);
    min-height: 36rem;
    overflow: hidden;
}

.chat-test-frame {
    display: block;
    height: calc(100vh - 15.5rem);
    min-height: 36rem;
    width: 100%;
}

.feedback-backdrop {
    animation: feedback-fade 0.18s ease both;
    background: rgba(15, 23, 42, 0.42);
    inset: 0;
    position: fixed;
    z-index: 2147482000;
}

.feedback-modal-shell {
    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
    position: fixed;
    z-index: 2147482001;
}

.feedback-modal {
    animation: feedback-pop 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.25);
    display: grid;
    gap: 1rem;
    max-width: 420px;
    padding: 1.35rem;
    pointer-events: auto;
    text-align: center;
    width: min(420px, 100%);
}

.feedback-icon {
    align-items: center;
    background: rgba(18, 164, 111, 0.12);
    border-radius: 999px;
    color: var(--ct-admin-success);
    display: inline-flex;
    font-size: 1.35rem;
    font-weight: 900;
    height: 3rem;
    justify-content: center;
    justify-self: center;
    width: 3rem;
}

.feedback-modal.danger .feedback-icon {
    background: rgba(217, 45, 32, 0.12);
    color: var(--ct-admin-danger);
}

.feedback-modal.warning .feedback-icon {
    background: rgba(181, 71, 8, 0.12);
    color: var(--ct-admin-warning);
}

.feedback-copy h2 {
    font-size: 1.15rem;
    margin: 0 0 0.35rem;
}

.feedback-copy p {
    color: var(--ct-admin-muted);
    margin: 0;
    overflow-wrap: anywhere;
}

@keyframes feedback-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes feedback-pop {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: #b32121;
    color: white;
    padding: 1rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

@media (prefers-reduced-motion: reduce) {
    .loading-spinner,
    .feedback-backdrop,
    .feedback-modal,
    .btn,
    .panel,
    .conversation-button {
        animation: none;
        transition: none;
    }
}

@media (max-width: 640px) {
    .content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .panel,
    .metric {
        padding: 1rem;
    }

    .customer-table-wrap {
        display: none;
    }

    .customer-card-list {
        display: block;
    }

    .detail-list,
    .message-line {
        grid-template-columns: 1fr;
    }

    .site-detail-layout,
    .site-form-grid,
    .site-meta-list {
        grid-template-columns: 1fr;
    }

    .setting-switch-row,
    .settings-actions,
    .lead-field-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .settings-actions .btn,
    .lead-field-heading .btn {
        width: 100%;
    }

    .chat-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }

    .conversation-list,
    .customer-sidebar {
        max-height: none;
    }

    .chat-thread {
        min-height: 70vh;
    }

    .message-feed {
        min-height: 20rem;
    }

    .thread-header {
        align-items: stretch;
        flex-direction: column;
    }

    .presence-panel {
        margin-left: 0;
    }

    .toolbar-group {
        width: 100%;
    }

    .language-switch,
    .language-switch .form-select,
    .language-checkbox {
        width: 100%;
    }

    .chat-test-heading,
    .chat-test-toolbar,
    .chat-test-site-picker {
        align-items: stretch;
        flex-direction: column;
    }

    .chat-test-heading .btn,
    .chat-test-site-picker,
    .chat-test-site-picker .form-select {
        min-width: 0;
        width: 100%;
    }

    .chat-test-link-heading,
    .chat-test-link-row {
        align-items: stretch;
        display: flex;
        flex-direction: column;
    }

    .chat-test-link-row .btn {
        width: 100%;
    }

    .chat-test-steps {
        display: grid;
        gap: 0.35rem;
    }

    .chat-test-frame {
        height: 72vh;
    }

    .chat-bubble {
        max-width: 100%;
    }

    .lead-field-row {
        align-items: stretch;
        grid-template-columns: 1fr;
    }
}
