/* Ownership: desktop dashboard shell, desktop feature variants, and root auth pages. */

:root {
    --ehly-function-workspace-gutter: 0.5rem;
}

/* Base elements */
body {
    font-size: 0.99rem;
}

h5 {
    font-size: 1.375rem;
}

h6 {
    font-size: 1.1rem;
}

/* Desktop-only shared component sizing */
.form-label {
    margin-bottom: 0.22rem;
    font-size: 0.99rem;
}

.form-control,
.form-select {
    font-size: 0.99rem;
    border-radius: 0.4125rem;
}

.form-control {
    padding: 0.4125rem 0.825rem;
}

.form-select {
    padding: 0.4125rem 2.475rem 0.4125rem 0.825rem;
    background-position: right 0.825rem center;
    background-size: 18px 13px;
}

.form-control-sm {
    padding: 0.275rem 0.55rem;
    border-radius: 0.275rem;
}

.form-select-sm {
    padding: 0.275rem 2.475rem 0.275rem 0.55rem;
    border-radius: 0.275rem;
}

.focus-ring-gutter {
    padding: 0.275rem;
}

.btn {
    padding: 0.275rem 0.825rem;
    font-size: 1.1rem;
    border-radius: 0.4125rem;
}

.btn-sm {
    font-size: 0.88rem;
    border-radius: 0.275rem;
}

.btn-xs {
    font-size: 0.66rem;
}

.composer-attachment-status {
    gap: 0.275rem;
    font-size: 0.825rem;
}

.settings-reset-btn {
    max-height: 1.65rem;
}

.assistant-danger-zone h5,
.assistant-danger-zone h6 {
    font-size: 0.935rem;
}

.assistant-danger-zone p,
.assistant-danger-zone .btn {
    font-size: 0.88rem;
}

.thread-list-toolbar.focus-ring-gutter .thread-list-toolbar-row {
    gap: 0.275rem;
}

.thread-btn {
    padding: 0.55rem 0.275rem;
    font-size: 0.99rem;
}

.thread-timestamp,
.thread-reply-mode {
    font-size: 0.66rem;
    line-height: 0.66rem;
}

.msg {
    max-width: calc(100% - 0.55rem);
    margin-block: 0.275rem;
    padding: 0.55rem 1.1rem;
    border-radius: 0.55rem;
}

.assistant-msg,
.human_assistant-msg,
.human_assistant_image-msg,
.human_assistant_audio-msg,
.human_assistant_video-msg,
.human_assistant_document-msg {
    margin-right: auto;
    margin-left: 0.275rem;
}

.user-msg,
.user_image-msg,
.user_audio-msg,
.user_document-msg,
.user_video-msg,
.user_sticker-msg,
.user_contact-msg,
.user_whatsapp_own_contact-msg {
    margin-right: 0.275rem;
    margin-left: auto;
}

.msg-timestamp {
    font-size: 0.55rem;
    line-height: 0.55rem;
    transform: translate(0.825rem, 0.275rem);
}

.msg-img,
#imgModalImg {
    border-radius: 0.275rem;
}

.audio-message-label,
.video-message-label {
    margin-bottom: 0.275rem;
    font-size: 0.825rem;
}

.audio-transcription {
    margin-bottom: 0.55rem;
}

.audio-player,
.audio-player::-webkit-media-controls-enclosure,
.video-player {
    border-radius: 0.275rem;
}

.chat-placeholder-icon {
    width: 4.4rem;
}

.form-info {
    font-size: 1.1rem;
}

.progress {
    height: 1.1rem;
    border-radius: 0.4125rem;
}

.modal-content {
    border-radius: 0.55rem;
}

.modal-header .btn-close {
    width: 1.1em;
    height: 1.1em;
    padding: 0.55em;
}

.modal .table > :not(caption) > * > * {
    padding: 0.55rem;
}

.select2-container .select2-selection--single {
    min-height: calc(1.5em + 0.825rem + calc(var(--bs-border-width) * 2));
    border-radius: 0.4125rem;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    padding-right: 2.475rem;
    padding-left: 0.825rem;
    line-height: calc(1.5em + 0.825rem);
}

.select2-container .select2-selection--single .select2-selection__arrow {
    right: 0.825rem;
}

.select2-dropdown {
    border-radius: 0.4125rem;
}

.select2-dropdown .select2-search--dropdown {
    padding: 0.55rem 0.825rem;
}

.select2-dropdown .select2-results__option {
    padding: 0.4125rem;
}

.select2-dropdown.select2-dropdown--below {
    border-radius: 0 0 0.4125rem 0.4125rem;
}

.select2-dropdown.select2-dropdown--above {
    border-radius: 0.4125rem 0.4125rem 0 0;
}

.unread-divider {
    padding: 0.55rem 0;
}

.unread-divider span {
    font-size: 0.88rem;
}

.unread-divider hr {
    margin: 0 0.55rem;
}

.gap-1 {
    gap: 0.275rem !important;
}

.gap-2 {
    gap: 0.55rem !important;
}

.mt-2 {
    margin-top: 0.55rem !important;
}

.mt-3 {
    margin-top: 1.1rem !important;
}

.me-1 {
    margin-right: 0.275rem !important;
}

.me-2 {
    margin-right: 0.55rem !important;
}

.mb-1 {
    margin-bottom: 0.275rem !important;
}

.mb-2 {
    margin-bottom: 0.55rem !important;
}

.mb-3 {
    margin-bottom: 1.1rem !important;
}

.mb-4 {
    margin-bottom: 1.65rem !important;
}

.ms-1 {
    margin-left: 0.275rem !important;
}

.ms-2 {
    margin-left: 0.55rem !important;
}

.my-1 {
    margin-top: 0.275rem !important;
    margin-bottom: 0.275rem !important;
}

.my-2 {
    margin-top: 0.55rem !important;
    margin-bottom: 0.55rem !important;
}

.my-3 {
    margin-top: 1.1rem !important;
    margin-bottom: 1.1rem !important;
}

.pt-2 {
    padding-top: 0.55rem !important;
}

.pb-1 {
    padding-bottom: 0.275rem !important;
}

.p-2 {
    padding: 0.55rem !important;
}

.px-3 {
    padding-right: 1.1rem !important;
    padding-left: 1.1rem !important;
}

.py-1 {
    padding-top: 0.275rem !important;
    padding-bottom: 0.275rem !important;
}

.py-2 {
    padding-top: 0.55rem !important;
    padding-bottom: 0.55rem !important;
}

.rounded,
.rounded-2 {
    border-radius: 0.4125rem !important;
}

.rounded-4 {
    border-radius: 1.1rem !important;
}

#alert {
    padding: 0.55rem 1.1rem;
}

/* Desktop workspaces and messaging */
.workspace-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: transparent;
}

.workspace-tab {
    flex: 0 0 auto;
    padding: 0.75rem 0;
    color: var(--bs-secondary-color);
    font: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
}

.workspace-tab:hover,
.workspace-tab:focus-visible {
    color: var(--bs-body-color);
}

.workspace-tab.active {
    color: var(--ehly-primary-control-text);
    border-bottom-color: var(--ehly-primary-selected-border);
}

.workspace-panel,
.workspace-heading,
.section-nav-layout,
.section-nav-panels {
    min-width: 0;
    min-height: 0;
}

.workspace-heading {
    flex: 0 0 auto;
    margin-bottom: 1rem;
}

.workspace-heading h1 {
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
}

.workspace-heading p {
    margin-bottom: 0;
    color: var(--bs-secondary-color);
}

.section-nav-layout {
    display: flex;
    gap: var(--ehly-function-workspace-gutter);
    width: 100%;
}

.section-nav {
    flex: 0 0 12rem;
    width: 12rem;
    border-right: 1px solid var(--bs-border-color);
}

.section-nav .list-group {
    border-radius: 0;
}

.section-nav-item {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    min-height: 2.475rem;
    padding: 0.385rem 0.5rem;
    color: var(--bs-body-color);
    font-size: 0.935rem;
    font-weight: 500;
    text-align: left;
    background: transparent;
    border: 0;
}

.section-nav-item .svg-icon,
.section-nav-item > i {
    flex: 0 0 auto;
    width: 1.375rem;
    height: 1.375rem;
    text-align: center;
}

.section-nav-item > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-nav-item.active {
    color: var(--ehly-primary-selected-text);
    background: var(--ehly-surface-selected);
}

html[data-ehly-theme="ehly"] .section-nav-item.active {
    background: #E9ECEF;
}

.section-nav-panels {
    flex: 1 1 auto;
}

.contacts-section-panels {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.contacts-section-panels > .section-nav-panel {
    flex: 1 1 auto;
}

.function-content {
    min-height: 0;
    flex: 1;
    overflow: auto;
    padding: 1rem 1.25rem;
}

.messaging-account-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.messaging-provider-section {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
}

.messaging-account-identity-summary {
    display: flex;
    flex-direction: column;
}

.messaging-account-details-toggle {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    padding-right: 0 !important;
    padding-left: 0 !important;
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.messaging-account-details-toggle:hover,
.messaging-account-details-toggle:focus-visible {
    color: var(--bs-body-color);
}

.messaging-account-details-toggle i {
    width: 0.8rem;
    font-size: 0.7rem;
}

.broadcast-list-toolbar {
    display: flex;
    max-width: 15rem;
}

.broadcast-list-grid {
    display: grid;
    grid-template-columns: minmax(8rem, 0.9fr) minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(6rem, 0.7fr) minmax(0, 1.4fr);
    gap: 0.75rem;
    align-items: center;
}

.broadcast-list-heading {
    padding: 0.55rem 0.75rem;
    color: var(--bs-secondary-color);
    font-size: 0.78rem;
    font-weight: 600;
    border-bottom: 1px solid var(--bs-border-color);
}

.broadcast-row {
    width: 100%;
    padding: 0.7rem 0.75rem;
    color: var(--bs-body-color);
    text-align: left;
    background: var(--bs-body-bg);
    border: 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.broadcast-row > span,
.broadcast-list-primary,
.broadcast-list-secondary {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.broadcast-list-primary,
.broadcast-list-secondary {
    display: block;
}

.broadcast-row:hover,
.broadcast-row:focus-visible,
.broadcast-row.active {
    background: rgba(var(--bs-primary-rgb), 0.07);
}

.broadcast-row:focus-visible {
    outline: 2px solid rgba(var(--ehly-focus-rgb), 0.35);
    outline-offset: -2px;
}

.broadcast-cell-label {
    display: none;
    color: var(--bs-secondary-color);
    font-size: 0.72rem;
    font-weight: 600;
}

.broadcast-page-status,
.broadcast-page-pager {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.broadcast-page-status {
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
}

.broadcast-page-pager {
    flex: 0 0 auto;
}

.broadcast-audience-summary {
    font-weight: 600;
}

.broadcast-details-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--bs-border-color);
}

.broadcast-detail-item {
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.broadcast-detail-item dt {
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    font-weight: 500;
}

.broadcast-detail-item dd {
    min-width: 0;
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.broadcast-template-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.broadcast-result-heading,
.broadcast-result-row {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(7rem, 0.5fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
}

.broadcast-result-heading {
    padding: 0.45rem 0.75rem;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    font-weight: 600;
    border-bottom: 1px solid var(--bs-border-color);
}

.broadcast-result-row {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.broadcast-preview-selected {
    background: var(--bs-tertiary-bg);
}

.broadcast-result-cell {
    min-width: 0;
    overflow-wrap: anywhere;
}

.broadcast-result-label {
    display: none;
    margin-bottom: 0.1rem;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    font-weight: 500;
}

.broadcast-message-preview {
    max-width: 42rem;
    min-height: 0;
    padding: 0.85rem;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
}

.messaging-account-summary,
.messaging-account-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    min-width: 0;
}

.messaging-account-summary > div {
    min-width: 0;
}

.messaging-account-actions {
    flex: 0 0 auto;
}

.floating-chatbot-icon-preview {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.integration-tab-layout {
    height: 100%;
    overflow: hidden;
}

.integration-tab-panels {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.integration-tab-content {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.integration-settings-section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.integration-settings-section:first-child {
    padding-top: 0;
}

.floating-chatbot-css-row {
    min-width: 0;
    margin-bottom: 0.5rem;
}

.floating-chatbot-css-row .form-label {
    margin-bottom: 0.25rem;
}

/* Layout */
.mid-width-container {
    width: 100%;
    max-width: 720px;
    padding: 0 0.5rem;
}

.topbar {
    /* Keep global navigation above feature overlays, below modal backdrops. */
    position: relative;
    z-index: 1020;
    height: 3rem;
    padding: 0.55rem 0 0;
}

.topbar > a {
    margin-left: 0.33rem;
}

.topbar img {
    height: 100%;
}

#usernameDisplayContainer {
    margin-right: 1rem;
}

.main-container {
    display: flex;
    flex-direction: row;
    height: 90vh;
    border-radius: 0.5rem;
}

.main-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 90vh;
    padding: 0.5rem 0.5rem 0.5rem 0;
}

#editAssistantContainer {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
}

.desktop-edit-assistant-page {
    height: 100vh;
    overflow: hidden;
}

.desktop-edit-assistant-page .tab-content {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
}

.desktop-edit-assistant-page .tab-content[data-assistant-tab="testRun"],
.desktop-edit-assistant-page .tab-content[data-assistant-tab="integrations"] {
    overflow: hidden;
}

.assistant-tab-maxheight {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow-y: auto;
}

.assistant-tab-padding {
    padding: 0.55rem;
}

/* Topbar and assistant navigation */
#usernameDisplayBtn {
    padding: 0.275rem;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
}

#usernameDisplayBtn svg {
    width: 1.32rem;
    height: 1.32rem;
}

.inbox-thread-row.active .inbox-thread-unread,
.inbox-thread-row.active.unread .inbox-thread-name {
    color: var(--ehly-on-primary);
}

.topbar .dropdown-menu,
#testRunOptionsDropdown .dropdown-menu,
#inboxOptionsDropdown .dropdown-menu {
    min-width: min(16.5rem, calc(100vw - 1rem));
    padding: 0;
    border-radius: 0.4125rem;
}

.topbar .dropdown-menu li,
#testRunOptionsDropdown .dropdown-menu li,
#inboxOptionsDropdown .dropdown-menu li {
    padding: 0.55rem;
    border-bottom: 1px solid var(--bs-gray-500);
}

.topbar .dropdown-menu i,
#testRunOptionsDropdown .dropdown-menu i,
#inboxOptionsDropdown .dropdown-menu i {
    margin: 0 0.55rem;
}

.topbar .dropdown-item,
#testRunOptionsDropdown .dropdown-item,
#inboxOptionsDropdown .dropdown-item {
    padding: 0 0.55rem;
    font-size: 0.99rem;
}


#trainAssistantBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.925rem;
    padding: 0.1375rem 0.55rem;
    font-size: 0.88rem;
    line-height: 1.25;
}

/* Sources and integrations navigation */
.sources-tab-content > h5 {
    font-size: 1.2375rem;
    line-height: 1.25;
}

#sourcesTextSaveBtn,
#sourcesFileUploadBtn,
#sourcesWebsiteCrawlBtn,
#sourcesWebsiteLoadUrlsBtn,
#sourceUrlDeleteAllFrontBtn {
    min-height: 2.2rem;
    font-size: 0.9625rem;
    line-height: 1.25;
}

#sourceFileList > .d-flex .form-control,
#sourceUrlList > .d-flex .form-control {
    font-size: 0.9625rem;
}

#sourceFileList > .d-flex .btn,
#sourceUrlList > .d-flex .btn {
    min-width: 2.2rem;
    min-height: 2.2rem;
    padding: 0.275rem 0.55rem;
    font-size: 0.9625rem;
}

/* Test Run */
#testRunSearchBox {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

#msgBoxContainer,
#testRunOptionsDropdown {
    align-items: flex-end;
}

#testRunOptionsDropdown {
    display: flex;
}

#threadListContainer {
    z-index: 8;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 275px;
    max-width: calc(100% - 12rem);
    min-height: 0;
    overflow-y: hidden;
    background-color: var(--bs-body-bg);
}

#msgListContainer {
    min-width: 0;
}

.thread-btn {
    padding: 0.4125rem 0.275rem;
    font-size: 0.935rem;
}

.msg {
    padding: 0.4125rem 0.825rem;
}

.msg-timestamp {
    display: block;
    margin-top: 0.275rem;
    font-size: 0.65rem;
    line-height: 0.65rem;
    white-space: nowrap;
    transform: none;
}

.chat-placeholder-icon {
    width: 3.3rem;
}

.chat-placeholder-title {
    font-size: 1.375rem;
    line-height: 1.25;
}

#threadListContainer.ui-resizable .ui-resizable-e {
    right: 0;
    width: 7px;
}

#threadListContainer.ui-resizable .ui-resizable-w {
    left: 0;
    width: 7px;
}

/* Floating chatbot and WhatsApp integration */
.code-snippet {
    padding: 0.55rem;
    background-color: rgba(var(--bs-warning-rgb), 0.2);
    border-radius: 0.825rem 0.55rem;
}

.code-snippet code {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    word-break: break-word;
}

.floating-chatbot-css-row {
    display: grid;
    grid-template-columns: 14.3rem minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
}

.floating-chatbot-css-row .form-label {
    margin: 0;
}

.floating-chatbot-css-row-textarea {
    align-items: start;
}

.integration-tab-content .form-label,
.integration-tab-content .form-check-label {
    font-size: 0.935rem;
}

.integration-tab-content .btn {
    min-height: 2.2rem;
    font-size: 0.9625rem;
    line-height: 1.25;
}

.integration-tab-content .btn-xs {
    min-height: 1.925rem;
    padding: 0.1375rem 0.55rem;
    font-size: 0.825rem;
}

/* Custom API */
.custom-api-prop {
    display: flex;
    margin-bottom: 0.22rem;
    font-size: 0.9625rem;
}

.custom-api-card {
    margin-bottom: 0.4125rem;
    padding: 0.4125rem;
}

.custom-api-prop div:first-child {
    width: 25%;
    font-weight: bold;
}

.custom-api-prop div:last-child {
    width: 75%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.custom-api-variable-prop,
.custom-api-secret-prop,
.custom-api-post-process-param-prop,
.custom-api-pre-process-param-prop {
    display: flex;
    margin-bottom: 0.275rem;
}

.custom-api-variable-prop div:first-child,
.custom-api-secret-prop div:first-child,
.custom-api-post-process-param-prop div:first-child,
.custom-api-pre-process-param-prop div:first-child {
    display: flex;
    align-items: center;
    width: 20%;
}

.custom-api-variable-prop div:last-child,
.custom-api-secret-prop div:last-child,
.custom-api-post-process-param-prop div:last-child,
.custom-api-pre-process-param-prop div:last-child {
    width: 80%;
}

#customAPIModal .modal-dialog {
    max-width: 768px;
}

.custom-api-param-container {
    display: flex;
}

#customAPIPostProcessCode,
#customAPIPreProcessCode {
    font-family: monospace;
}

.desktop-edit-assistant-page .settings-reasoning-desktop {
    display: block;
}

.desktop-edit-assistant-page .settings-reasoning-range-container,
.desktop-edit-assistant-page #settingsAssistantReasoningRange {
    width: 100%;
}

.desktop-edit-assistant-page .settings-reasoning-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
    gap: 0.55rem;
}

.desktop-edit-assistant-page .tab-content[data-assistant-tab="settings"] .form-label {
    font-size: 0.935rem;
}

.desktop-edit-assistant-page #settingsTabSaveBtn {
    min-height: 2.2rem;
    font-size: 0.9625rem;
    line-height: 1.25;
}

.desktop-edit-assistant-page .settings-reset-btn {
    padding: 0.1375rem 0.55rem;
    font-size: 0.825rem;
    line-height: 1.25;
}

/* Authentication and reset pages */
.login-page,
.login-page * {
    box-sizing: border-box;
}

.login-page {
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.login-page-row {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: center;
    /* Keep the composition centered on wide screens without constraining the artwork. */
    gap: min(7vw, 6.3rem);
    padding: 4rem max(7.8vw, calc((100% - 76rem) / 2));
    /* Clip the artwork without making the form a nested scroll container. */
    overflow: clip;
    background:
        radial-gradient(ellipse at 15% 4%, #FFF9F2 0%, #FFF9F200 58%),
        radial-gradient(ellipse at 2% 100%, #F2B993 0%, #F5CEB555 38%, #F5CEB500 68%),
        radial-gradient(ellipse at 98% 12%, #FFFAF9 0%, #FFFAF900 58%),
        linear-gradient(112deg, #F8E2D3, #F8E9DE 48%, #F9F5EF);
}

/* Decorative public-auth colours stay independent of the shared control tokens. */
.login-page-row::before,
.login-page-row::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    transform: rotate(-30deg);
}

.login-page-row::before {
    z-index: -1;
    width: 1300px;
    height: 510px;
    left: -410px;
    bottom: -325px;
    background: linear-gradient(180deg, #FFF6ECAD, #F6B98852 54%);
    box-shadow: 0 -2px 3px #FFFAF5B3, 0 -26px 66px #B2694012, inset 0 8px 50px #FFFAF08C;
}

.login-page-row::after {
    z-index: -2;
    width: 1260px;
    height: 700px;
    left: -330px;
    bottom: -485px;
    background: linear-gradient(160deg, #FDF1E380, #EDB69400 55%);
    box-shadow: 0 -1px 3px #FFF9F0A3, 0 -20px 65px #AD633810;
}

.login-panel {
    justify-self: end;
    width: 100%;
    max-width: 30.5rem;
    padding: 3.25rem 2.6875rem 3.3125rem;
    background: var(--ehly-surface);
    border: 1px solid var(--ehly-surface);
    border-radius: 1.125rem;
    box-shadow: 0 27px 65px -31px #78473138, 0 2px 5px #2D1A1D03;
}

.login-panel > form {
    margin-top: 1.75rem;
}

.login-field + .login-field {
    margin-top: 1.25rem;
}

.login-forgot-password {
    margin-top: 0.75rem;
    margin-bottom: 1.5625rem;
    line-height: 1.5;
}

.login-panel a {
    font-size: 0.875rem;
    text-decoration: none;
}

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

.login-panel a:focus-visible {
    outline: 2px solid var(--ehly-focus);
    outline-offset: 4px;
}

.login-page .form-label {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.login-panel .form-label {
    font-weight: 400;
}

.login-page .form-control {
    min-height: 2.75rem;
    font-size: 1rem;
}

.login-panel .form-control {
    height: 2.875rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.375rem;
}

#loginBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.875rem;
    padding: 0.4125rem 0.825rem;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.25;
}

.public-auth-page .public-auth-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.65rem;
}

.public-auth-panel {
    width: 100%;
    max-width: 28rem;
}

.login-splash {
    padding-bottom: 1.375rem;
}

.login-splash-copy h2 {
    margin: 0;
    font-size: clamp(3.25rem, 4.2vw, 3.875rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.045em;
}

.login-hero-accent {
    color: var(--ehly-primary-control-text);
}

.login-splash-copy p {
    max-width: 27.375rem;
    margin: 1.6875rem 0 0;
    font-size: 1.0625rem;
    line-height: 1.7;
    /* The committed hero ink stays readable over the apricot artwork. */
    color: #66504B;
}

.public-auth-page .login-logo {
    width: 12rem;
    max-width: 100%;
    height: auto;
    margin-bottom: 2rem;
}

.login-page .login-logo {
    display: block;
    width: 10.5rem;
    margin-bottom: 2.25rem;
}

.login-greeting {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

@media (max-width: 1320px) {
    .login-page-row {
        gap: 6.4vw;
        padding-inline: 7vw;
    }

    .login-panel {
        padding-inline: 2.375rem;
    }
}

@media (min-width: 769px) and (max-height: 820px) {
    .login-panel {
        padding-top: 2.8125rem;
        padding-bottom: 2.875rem;
    }

    .login-page .login-logo {
        margin-bottom: 2rem;
    }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .login-page-row {
        gap: 4vw;
        padding-inline: 5vw;
    }

    .login-splash-copy h2 {
        font-size: clamp(2rem, 4.2vw, 3.25rem);
    }

    .login-panel {
        padding-inline: 1.75rem;
    }
}

@media (max-width: 768px) {
    .login-page-row {
        display: flex;
        justify-content: center;
        padding: max(1.5rem, env(safe-area-inset-top, 0px)) clamp(1rem, 5vw, 1.5rem) max(1.5rem, env(safe-area-inset-bottom, 0px));
    }

    .login-page-row::before {
        width: 760px;
        height: 380px;
        left: calc(50% - 550px);
        bottom: -190px;
    }

    .login-page-row::after {
        width: 720px;
        height: 460px;
        left: calc(50% - 500px);
        bottom: -300px;
    }

    .login-splash {
        display: none;
    }

    .login-panel {
        max-width: 28rem;
        padding: clamp(1.5rem, 6vw, 2rem);
    }

    .login-page .login-logo {
        width: 8.75rem;
        margin-bottom: 1.75rem;
    }

    .login-panel > form {
        margin-top: 1.5rem;
    }

    .login-greeting {
        font-size: 1.25rem;
    }

    .login-panel .form-label,
    .login-panel a,
    #loginBtn {
        font-size: 0.8rem;
    }
}

/* Vendor overrides */
body:not(.login-page):not(.desktop-edit-assistant-page) .modal-title.fs-5 {
    font-size: 1.375rem !important;
}

.login-page .modal-title.fs-5 {
    font-size: 1.375rem !important;
}

.desktop-edit-assistant-page .modal-title {
    font-size: 1.2375rem;
}

.desktop-edit-assistant-page .modal-title.fs-5 {
    font-size: 1.2375rem !important;
}

body:not(.login-page):not(.desktop-edit-assistant-page) .modal-header,
body:not(.login-page):not(.desktop-edit-assistant-page) .modal-body,
body:not(.login-page):not(.desktop-edit-assistant-page) .modal-footer {
    padding: 1.1rem;
}

.desktop-edit-assistant-page .modal-header,
.desktop-edit-assistant-page .modal-body,
.desktop-edit-assistant-page .modal-footer {
    padding: 0.825rem 1.1rem;
}

.login-page .modal-header,
.login-page .modal-body,
.login-page .modal-footer {
    padding: 1.1rem;
}

.desktop-edit-assistant-page .modal .form-label {
    font-size: 0.935rem;
}

.desktop-edit-assistant-page .modal .btn:not(.btn-close) {
    min-height: 2.2rem;
    padding: 0.275rem 0.825rem;
    font-size: 0.9625rem;
    line-height: 1.25;
}

/* Behavioral and state selectors */
/* Shared state selectors live in shared.css. */

/* Messaging responsive adjustments */
@media (max-width: 991.98px) {
    .broadcast-details-summary {
        grid-template-columns: 1fr;
    }

    .broadcast-template-name {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 767.98px) {
    .broadcast-list-heading,
    .broadcast-result-heading {
        display: none;
    }

    .broadcast-result-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .broadcast-result-label {
        display: block;
    }

    .broadcast-list-grid {
        grid-template-columns: 1fr auto;
    }

    .broadcast-row > span {
        min-width: 0;
    }

    .broadcast-row > span:not(:first-child):not(:last-child) {
        grid-column: 1 / 3;
    }

    .broadcast-cell-label {
        display: inline;
    }
}

/* Responsive adjustments: root auth pages only. */
@media (max-width: 768px) {
    body {
        font-size: 0.88rem;
    }

    h5 {
        font-size: 1.21rem;
    }

    h6 {
        font-size: 0.99rem;
    }

    .form-label,
    .form-control,
    .form-select,
    .btn {
        font-size: 0.88rem;
    }

    .container-fluid {
        padding: 0 0.25rem;
    }

    .topbar {
        height: 3rem;
    }

    #usernameDisplayBtn svg {
        width: 1.1rem;
        height: 1.1rem;
    }

    .main-container {
        flex-direction: column;
    }

    .main-content {
        padding: 0 0.25rem;
    }

    .mid-width-container {
        padding: 0.25rem 0;
    }

    .login-page .modal-title.fs-5 {
        font-size: 1.1rem !important;
        font-weight: 600;
        line-height: 1.25;
    }
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.global-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex: 0 0 13.5rem;
    flex-direction: column;
    width: 13.5rem;
    height: 100vh;
    padding: 1rem 0.75rem;
    overflow: hidden;
    background: var(--bs-body-bg);
    border-right: 1px solid var(--bs-border-color);
    transition: width 0.18s ease, flex-basis 0.18s ease, padding 0.18s ease;
}

.global-sidebar-header {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    min-width: 0;
}

.global-sidebar-brand {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    min-width: 0;
    height: 2.4rem;
}

.global-sidebar-brand img {
    object-fit: contain;
}

.global-sidebar-logo-full {
    width: 8.5rem;
    max-height: 2.4rem;
}

.global-sidebar-logo-mark {
    display: none;
    width: 2rem;
    height: 2rem;
}

.global-sidebar-toggle {
    display: inline-flex;
    flex: 0 0 1.8rem;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    color: var(--bs-secondary-color);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
}

.global-sidebar-toggle:hover {
    color: var(--ehly-primary-selected-text);
    background: rgba(var(--bs-primary-rgb), 0.08);
}

.global-sidebar-toggle:focus-visible {
    outline: 2px solid rgba(var(--ehly-focus-rgb), 0.4);
    outline-offset: 2px;
}

.global-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 1.5rem;
}

.global-sidebar-link {
    position: relative;
    display: flex;
    gap: 0.7rem;
    align-items: center;
    min-width: 0;
    padding: 0.7rem;
    color: var(--bs-body-color);
    text-decoration: none;
    border-radius: var(--bs-border-radius);
}

.global-sidebar-icon {
    display: inline-flex;
    flex: 0 0 1.25rem;
}

.global-sidebar-link svg {
    width: 1.25rem;
    height: 1.25rem;
}

.global-sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-sidebar-link.active,
.global-sidebar-link:hover {
    color: var(--ehly-primary-selected-text);
    background: rgba(var(--bs-primary-rgb), 0.1);
}

.global-sidebar-collapsed .global-sidebar {
    flex-basis: 4.25rem;
    width: 4.25rem;
    padding-right: 0.55rem;
    padding-left: 0.55rem;
}

.global-sidebar-collapsed .global-sidebar-header {
    flex-direction: column;
}

.global-sidebar-collapsed .global-sidebar-brand {
    flex: 0 0 auto;
    justify-content: center;
}

.global-sidebar-collapsed .global-sidebar-logo-full,
.global-sidebar-collapsed .global-sidebar-label {
    display: none;
}

.global-sidebar-collapsed .global-sidebar-logo-mark {
    display: block;
}

.global-sidebar-collapsed .global-sidebar-toggle {
    width: 100%;
}

.global-sidebar-collapsed .global-sidebar-link {
    justify-content: center;
    padding-right: 0.55rem;
    padding-left: 0.55rem;
}

.global-sidebar-collapsed #globalUnreadBadge {
    position: absolute;
    top: 0.15rem;
    right: 0.1rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.65rem;
}

@media (prefers-reduced-motion: reduce) {
    .global-sidebar {
        transition: none;
    }
}

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    height: 100vh;
}

.desktop-function-page .topbar {
    flex: 0 0 auto;
    padding: 0.5rem 1.25rem;
}

.desktop-function-page #editAssistantContainer {
    height: 100%;
}

.assistant-overview,
.organisation-settings-container {
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
}

.assistant-overview-toolbar {
    margin-bottom: 1rem;
}

.assistant-overview-toolbar .workspace-heading {
    margin-bottom: 0;
}

.assistant-overview-search {
    max-width: 30rem;
    margin-bottom: 1rem;
}

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

.assistant-overview-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.85rem 1rem;
    color: var(--bs-body-color);
    text-decoration: none;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: var(--ehly-shadow-soft);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.assistant-overview-card:hover,
.assistant-overview-card:focus-visible {
    color: var(--bs-body-color);
    border-color: var(--ehly-primary-selected-border);
    box-shadow: var(--ehly-shadow-hover);
}

.assistant-overview-card:focus-visible {
    outline: 2px solid rgba(var(--ehly-focus-rgb), 0.35);
    outline-offset: 2px;
}

.assistant-card-heading {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
}

.assistant-card-description,
.assistant-card-model {
    overflow: hidden;
    color: var(--bs-secondary-color);
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assistant-card-model {
    font-size: 0.75rem;
}

.assistant-overview-empty {
    max-width: 28rem;
    margin: 4rem auto;
}

.assistant-overview-empty-icon {
    margin-bottom: 0.5rem;
    color: var(--ehly-primary-control-text);
    font-size: 2.5rem;
}

.assistant-workspace {
    display: flex;
    overflow: hidden;
}

.assistant-workspace .assistant-tab-strip {
    width: calc(100% + 1rem);
    margin-right: -0.5rem;
    margin-left: -0.5rem;
    padding-right: 0.5rem;
    padding-left: 0.75rem;
}

.assistant-context-header {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.assistant-source-progress {
    flex: 1 1 14rem;
    max-width: 24rem;
    margin-left: 0.5rem;
}

.assistant-context-nav {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    min-width: 0;
}

.assistant-context-nav > a {
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.assistant-switcher-trigger {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    max-width: min(32rem, 55vw);
    padding: 0.2rem 0.45rem;
    overflow: hidden;
    color: var(--bs-body-color);
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
}

#assistantNameText {
    overflow: hidden;
    text-overflow: ellipsis;
}

.assistant-switcher-trigger > i {
    flex: 0 0 auto;
    font-size: 0.75rem;
}

.assistant-switcher-trigger:hover,
.assistant-switcher-trigger:focus-visible {
    background: var(--ehly-surface-hover);
    border-color: var(--bs-border-color);
}

.assistant-switcher-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.65rem;
    color: var(--bs-body-color);
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.assistant-switcher-row:hover,
.assistant-switcher-row:focus-visible,
.assistant-switcher-row.active {
    background: rgba(var(--bs-primary-rgb), 0.08);
}

.assistant-switcher-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.assistant-switcher-copy small {
    overflow: hidden;
    color: var(--bs-secondary-color);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assistant-switcher-meta {
    display: flex;
    flex: 0 0 auto;
    gap: 0.5rem;
    align-items: center;
}

.sources-tab-content {
    width: 100%;
    max-width: 64rem;
}

.assistant-settings-content {
    width: 100%;
}

.organisation-settings-form {
    width: 100%;
}

.desktop-edit-assistant-page .assistant-workspace,
.desktop-messaging-page .messaging-workspace {
    padding: var(--ehly-function-workspace-gutter);
}

.messaging-workspace {
    position: relative;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

.messaging-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
}

.desktop-messaging-page [data-messaging-panel="inbox"],
.desktop-messaging-page [data-messaging-panel="contacts"],
.desktop-messaging-page [data-messaging-panel="broadcasts"] {
    overflow: hidden;
}

.desktop-messaging-page [data-messaging-panel="inbox"] {
    display: flex;
}

.desktop-messaging-page #inboxChannelScopeFilter {
    margin-top: 0.5rem;
}

.desktop-messaging-page {
    --collection-focus-ring-gutter: 0.25rem;
}

.desktop-messaging-page .contacts-section {
    flex: 1 1 auto;
    align-items: stretch;
    overflow: hidden;
}

.desktop-messaging-page .broadcasts-section {
    flex: 1 1 auto;
}

.desktop-messaging-page .growing-collection-controls {
    padding-right: var(--collection-focus-ring-gutter);
    padding-left: var(--collection-focus-ring-gutter);
}

.desktop-messaging-page .contacts-section .growing-collection-controls > .pb-2.pe-2 {
    padding-right: 0 !important;
}

.desktop-messaging-page .growing-collection-scroll {
    margin-right: var(--collection-focus-ring-gutter);
    margin-left: var(--collection-focus-ring-gutter);
}

.desktop-messaging-page [data-messaging-panel="inbox"] > .inbox-layout {
    flex: 1 1 auto;
}

.desktop-edit-assistant-page .modal .btn:not(.btn-close) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.desktop-messaging-page .contacts-section .function-toolbar-search > .form-control {
    min-width: 0;
}

.desktop-function-page .compact-form .form-control,
.desktop-function-page .compact-form .form-select,
.desktop-function-page .function-toolbar .form-control,
.desktop-function-page .function-toolbar .form-select {
    min-height: 2.15rem;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 0.9rem;
}

.desktop-function-page .compact-form .btn:not(.btn-close),
.desktop-function-page .function-toolbar .btn {
    min-height: 2.15rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.9rem;
}

.desktop-messaging-page .inbox-transcript-header .btn.inbox-contact-action {
    min-height: 2.15rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.desktop-function-page .label-action-row .btn.label-action-btn {
    min-height: 1.65rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.2;
}

.desktop-function-page .compact-form .contact-tag-menu .contact-tag-option {
    min-height: 0;
    padding: 0.25rem 0.5rem;
}

#floatingChatbotCode {
    display: block;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    word-break: break-word;
}

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