:root {
    --bg: #f3f5f8;
    --card: #ffffff;
    --line: #dde3ea;
    --text: #1f2937;
    --muted: #6b7280;
    --brand: #00B1DB;
    --inbound: #f1f5f9;
    --outbound: #dcfce7;
}

.form-check-input:checked {
    background-color: #00B1DB;
    border-color: #00B1DB;
}


.btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: #00B1DB;
    --bs-btn-border-color: #00B1DB;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #00afdba2;
    --bs-btn-hover-border-color: #00afdba2;
    --bs-btn-focus-shadow-rgb: 60, 153, 110;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #00afdba2;
    --bs-btn-active-border-color: #00B1DB;
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #00B1DB;
    --bs-btn-disabled-border-color: #00B1DB;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #eef2f7 0%, #f7fafc 100%);
}

.topbar {
    height: 72px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-left {
    justify-self: start;
}

.topbar-menu {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #00B1DB;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
}

.brand-logo-image {
    width: 84px;
}

.brand-text {
    font-size: 14px;
    font-weight: 700;
}

.topbar-link {
    text-decoration: none;
    color: #00B1DB;
    padding: 3px 18px;
    font-size: 14px;
    font-weight: 600;
}

.topbar-link.active{

    
    color: #036f88;
    border-radius: 0;
}
.topbar-link:hover {
    color: #00B1DB;
    border-bottom: 2px solid #00B1DB;
    border-radius: 0;
   
}

.topbar-dropdown {
       position: relative;
    text-decoration: none;
    color: #00B1DB;
    padding: 3px 18px;
    font-size: 14px;
    font-weight: 600;
}

.topbar-dropdown summary {
    list-style: none;
    cursor: pointer;
}

.topbar-dropdown summary::-webkit-details-marker {
    display: none;
}

.topbar-dropdown-menu {
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    min-width: 170px;
    background: #ffffff;
    border: 1px solid #d9e0e7;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    padding: 6px;
    z-index: 30;
}

.topbar-dropdown-link {
    display: block;
    text-decoration: none;
    color: #00B1DB;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.topbar-dropdown-link:hover,
.topbar-dropdown-link.active {
       background: #00B1DB;
    color: #ffffff;
    border-radius: 0px 10px 0 10px;
}

.topbar-subdropdown {
    position: relative;
}

.topbar-subdropdown .topbar-subdropdown-toggle::after {
    content: "›";
    float: right;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1;
}

.topbar-dropdown-submenu {
    top: -7px !important;
    left: calc(100% - 2px) !important;
}

@media (min-width: 992px) {
    .topbar-dropdown:hover > .topbar-dropdown-menu {
        display: block;
        margin-top: 0;
    }

    .topbar-subdropdown:hover > .topbar-dropdown-submenu {
        display: block;
        margin-top: 0;
    }
}

.topbar-user {
    font-size: 12px;
    color: var(--muted);
}

.topbar-user-dropdown {
    padding: 0;
}

.topbar-user-menu-btn {
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topbar-user-menu-btn:hover {
    color: #00b1db;
}

.topbar-user-dropdown-menu {
    left: auto;
    right: 0;
    min-width: 150px;
}

.topbar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #d5dde4;
}

.topbar-user-avatar-fallback {
       display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #00B1DB;
    font-size: 26px;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    border-radius: 30px;
    width: 35px;
    left: 50px;
    box-shadow: 0px 0px 5px;
}

.topbar-user-dropdown-name {
        padding: 6px 10px 13px;
    font-size: 12px;
    color: #00B1DB;
    border-bottom: 2px solid #00b1db63;
    margin-bottom: 16px;
}

.logout-link {
    text-decoration: none;
    color: #fff;
    background: #334155;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
}

.page-shell {
    min-height: calc(100vh - 72px);
}

.page-empty {
    padding: 0;
}

.settings-page {
    padding: 20px;
}

.settings-card {
    background: #fff;
    border: 1px solid #dce3ea;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.settings-card-head {
    padding: 18px 20px;
    border-bottom: 1px solid #e6ebf0;
}

.settings-card-head h1 {
    margin: 0;
    font-size: 24px;
}

.settings-card-head p {
    margin: 6px 0 0;
    color: #6b7280;
}

.settings-tabs {
    display: flex;
    gap: 8px;
    padding: 14px 16px 0;
}

.settings-tab-btn {
    border: 1px solid #dbe3ea;
    background: #f8fafc;
    color: #334155;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.settings-tab-btn.active {
    background: #00B1DB;
    border-color: #00B1DB;
    color: #ffffff;
}

.settings-tab-panels {
    padding: 16px;
}

.settings-tab-panel {
    display: none;
}

.settings-tab-panel.active {
    display: block;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 16px;
}

.settings-item {
    border: 1px solid #e5eaf0;
    border-radius: 12px;
    background: #f9fbfd;
    padding: 14px;
}

.settings-item h2 {
    margin: 0 0 10px;
    font-size: 16px;
}

.settings-item p {
    margin: 6px 0;
    color: #475569;
    font-size: 14px;
}

.sector-picker {
    border: 1px solid #dce3ea;
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px;
}

.sector-picker-toolbar {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    margin-bottom: 10px;
}

.sector-picker-options {
    max-height: 210px;
    overflow: auto;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}

.sector-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 7px;
    margin-bottom: 2px;
}

.sector-option:hover {
    background: #f1f5f9;
}

.sector-picker-selected {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.settings-log-pre {
    margin: 0;
    min-height: 420px;
    max-height: calc(100vh - 250px);
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    border: 1px solid #1e293b;
    font-size: 12px;
    line-height: 1.45;
}

.module-card {
    border: 1px solid #dce3ea;
    border-radius: 12px;
    background: #f8fafc;
    padding: 14px;
    height: 100%;
}

.module-card-title {
    font-size: 18px;
    font-weight: 700;
}

.module-card-text {
    margin: 0;
    color: #5f6f80;
    font-size: 14px;
}

.module-offline-icon {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    background: #ecfeff;
    border: 1px solid #cdeff4;
}

.media-gallery-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 8px;
}

.media-card {
    position: relative;
    border: 1px solid #dde4ec;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.media-thumb-link {
    display: block;
    background: #f8fafc;
    border-bottom: 1px solid #e5ebf2;
}

.media-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.media-card-body {
    padding: 6px;
}

.media-title {
    margin: 0 0 6px;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: #64748b;
}

.media-actions-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 46px;
    display: flex;
    justify-content: center;
    gap: 6px;
    pointer-events: none;
}

.media-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 14px;
    pointer-events: auto;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.22);
}

.media-url-field {
    font-size: 11px;
}

@media (max-width: 1400px) {
    .media-gallery-grid {
        grid-template-columns: repeat(8, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .media-gallery-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    .media-gallery-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

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

.branding-preview-block {
    border: 1px solid #dce3ea;
    border-radius: 10px;
    padding: 10px;
    background: #f8fafc;
    display: inline-block;
}

.branding-preview-image {
    width: 180px;
    max-width: 100%;
    height: 72px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: 8px;
    padding: 6px;
}

.branding-preview-favicon {
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: 8px;
    padding: 6px;
}

.owner-form-card {
    border: 1px solid #dbe3ea;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.owner-form-card-head {
    padding: 12px 14px;
    border-bottom: 1px solid #e6edf3;
    background: linear-gradient(180deg, #f9fbfd 0%, #f4f8fc 100%);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.owner-form-card-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.owner-form-card-head p {
    margin: 4px 0 0;
    font-size: 12px;
    color: #64748b;
}

.owner-form-card-body {
    padding: 14px;
}

.owner-dropzone {
    border: 2px dashed #8f98a5;
    border-radius: 12px;
    background: #f4f6f9;
    min-height: 190px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 18px;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
    cursor: pointer;
}

.owner-dropzone.is-dragover {
    background: #ecfeff;
    border-color: #06b6d4;
    box-shadow: inset 0 0 0 1px #67e8f9;
}

.owner-dropzone.is-uploading {
    opacity: 0.75;
    pointer-events: none;
}

.owner-dropzone-title {
    font-size: 17px;
    font-weight: 500;
    color: #1f2937;
}

.owner-dropzone-button {
    min-width: 170px;
}

.owner-dropzone-preview-wrap {
    display: none;
}

.owner-dropzone.has-uploaded .owner-dropzone-preview-wrap {
    display: block;
}

.owner-dropzone-preview {
    width: 220px;
    max-width: 100%;
    height: 76px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: 10px;
    padding: 6px;
}

.owner-dropzone-preview.is-favicon {
    width: 56px;
    height: 56px;
}

.owner-dropzone-remove {
    display: none;
}

.owner-dropzone.has-uploaded .owner-dropzone-remove {
    display: inline-block;
}

.owner-dropzone.has-uploaded .owner-dropzone-title,
.owner-dropzone.has-uploaded .owner-dropzone-button,
.owner-dropzone.has-uploaded .owner-dropzone-file {
    display: none;
}

.owner-dropzone-file {
    font-size: 12px;
    color: #64748b;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.owner-dropzone-input {
    display: none;
}

.auth-page {
    min-height: calc(100vh - 72px);
    display: grid;
    place-items: center;
    padding: 16px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .08);
}

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 24px;
}

.auth-card p {
    margin: 0 0 18px;
    color: var(--muted);
}

.auth-card label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.auth-card input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 14px;
}

.auth-card .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-card input.form-check-input,
.auth-card input[type="checkbox"].form-check-input {
    width: 16px;
    min-width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border-radius: 4px;
}

.auth-card .form-check-label {
    display: inline;
    margin: 0;
    font-weight: 500;
}

.auth-card button {
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 11px 14px;
    font-weight: 700;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
}

.auth-error {
    margin-bottom: 14px;
    color: #dc2626;
    font-size: 14px;
    font-weight: 600;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.login-brand-image {
    width: 144px;
    margin-bottom: 30px;
}

.login-brand .brand-logo {
    width: 68px;
    height: 68px;
    border-radius: 14px;
    font-size: 28px;
}

.app-shell {
    display: grid;
    grid-template-columns: 340px 1fr;
    min-height: calc(100vh - 72px);
}

.sidebar {
    border-right: 1px solid var(--line);
    background: var(--card);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.sidebar-header h1 {
    margin: 0;
    font-size: 20px;
}

.sidebar-header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.conversation-list {
    overflow-y: auto;
    height: calc(100vh - 72px - 94px);
}

.conversation-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    background: transparent;
    text-align: left;
    padding: 12px 16px;
    cursor: pointer;
}

.conversation-item:hover,
.conversation-item.active {
    background: #ecfeff;
}

.conversation-item h3 {
    margin: 0;
    font-size: 15px;
}

.conversation-item p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-panel {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: calc(100vh - 72px);
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--card);
}

.chat-header h2 {
    margin: 0;
    font-size: 18px;
}

.chat-header small {
    color: var(--muted);
}

.message-list {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-item {
    max-width: 72%;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.35;
    border: 1px solid transparent;
}

.message-item.inbound {
    background: var(--inbound);
    align-self: flex-start;
    border-color: #e2e8f0;
}

.message-item.outbound {
    background: var(--outbound);
    align-self: flex-end;
    border-color: #bbf7d0;
}

.message-meta {
    margin-top: 6px;
    color: #64748b;
    font-size: 11px;
}

.composer {
    background: var(--card);
    border-top: 1px solid var(--line);
    padding: 12px;
}

#send-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

#message-input {
    resize: vertical;
    min-height: 44px;
    max-height: 140px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
}

#send-form button {
    border: 0;
    border-radius: 10px;
    padding: 0 18px;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.empty-state {
    color: var(--muted);
    text-align: center;
    margin-top: 36px;
}

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
    }

    .brand-text,
    .topbar-user {
        display: none;
    }

    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 280px 1fr;
    }

    .conversation-list {
        height: auto;
        max-height: 185px;
    }

    .chat-panel {
        min-height: calc(100vh - 72px - 280px);
    }

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

/* Messages screen inspired layout */
.messages-viewport {
    height: 100vh;
    overflow: hidden;
}

.messages-viewport .page-shell.messages-page {
    height: calc(100vh - 72px);
    min-height: 0;
    overflow: hidden;
}

.messages-page {
    padding: 0;
}

.msgs-layout {
    display: grid;
    grid-template-columns: 405px 1fr;
    height: 100%;
    min-height: 0;
}

.msgs-sidebar {
    background: #f2f4f6;
    border-right: 1px solid #d9dee3;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: sticky;
    top: 72px;
}

.msgs-sidebar-head {
    padding: 14px;
    border-bottom: 1px solid #dfe4e8;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msgs-online {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    font-size: 14px;
    color: #2c3b43;
}

.msgs-online .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #43c15b;
}

.msgs-tab-btn {
    border: 0;
    background: #0f8ea2;
    color: #fff;
    border-radius: 18px;
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
}

.msgs-filters {
    display: grid;
    grid-template-columns: 1fr 1fr 1.8fr;
    gap: 8px;
}

.msgs-filters input {
    border: 1px solid #cfd6dc;
    border-radius: 14px;
    padding: 8px 10px;
    font-size: 13px;
    background: #f8fafb;
}

.msgs-conversation-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.messages-page .conversation-item {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 12px;
    border-bottom: 1px solid #e3e7eb;
    padding: 14px;
    background: transparent;
}

.messages-page .conversation-item:hover,
.messages-page .conversation-item.active {
    background: #e9edf1;
}

.conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0d3442;
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.conv-main {
    min-width: 0;
}

.conv-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.conv-top h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.conv-top span {
    color: #8c98a3;
    font-size: 13px;
}

.messages-page .conversation-item p {
    margin: 6px 0 0;
    color: #455560;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msgs-main {
    background: #d9dde1;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.msgs-empty-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #00b1da;
    padding: 24px;
    z-index: 2;
}

.msgs-empty-center h3 {
    margin: 8px 0 6px;
    font-size: 30px;
    line-height: 1.05;
    font-weight: 800;
    color: #00B1DB;
}

.msgs-empty-center p {
    margin: 0;
    font-size: 16px;
    color: #93a8b5;
}

.msgs-empty-illustration {
    width: 120px;
    height: 120px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 56px;
    background: #00B1DB;
    border: 1px solid #00b1da;
    box-shadow: 2px 3px 8px 3px #c0c0c0;

}

.msgs-main.chat-empty .msgs-contact-head,
.msgs-main.chat-empty .msgs-thread,
.msgs-main.chat-empty .msgs-composer {
    visibility: hidden;
}

.msgs-contact-head {
    background: #e6eaee;
    border-bottom: 1px solid #cfd6dc;
    padding: 10px 18px 8px;
    display: grid;
    gap: 8px;
    transition: margin-right 0.28s ease;
}

.msgs-contact-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.msgs-contact-links {
    margin-top: 8px;
    display: flex;
    gap: 14px;
}

.msgs-link-btn {
    border: 0;
    background: transparent;
    color: #11879d;
    font-size: 14px;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.msgs-link-btn:hover {
    text-decoration: underline;
}

.msgs-link-btn-danger {
    color: #b42318;
}

.msgs-link-btn-danger:hover {
    color: #8e1b12;
}

.msgs-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0d3442;
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#chat-title {
    margin: 0;
    font-size: 28px;
    font-weight: 500;
}

#chat-subtitle {
    color: #85919d;
    font-size: 13px;
}

.msgs-actions,
.msgs-submenu {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.msgs-actions a,
.msgs-submenu a {
    color: #0888a0;
    font-size: 14px;
    text-decoration: none;
}

.msgs-thread {
    overflow-y: auto;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    transition: margin-right 0.28s ease;
}

.messages-page .message-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 78%;
}

.messages-page .message-item.inbound {
    align-self: flex-start;
    margin-right: auto;
    margin-left: 0;
}

.messages-page .message-item.outbound {
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
}

.message-bubble {
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #d7dde3;
    box-shadow: 0 2px 6px rgba(45, 55, 65, 0.06);
    padding: 12px 14px;
    font-size: 16px;
    line-height: 1.25;
}

.message-media-image,
.message-media-video {
    display: block;
    max-width: min(180px, 45vw);
    width: auto;
    height: auto;
    border-radius: 8px;
    border: 1px solid #d4dce3;
    background: #fff;
}

.message-media-image {
    cursor: zoom-in;
}

.message-media-sticker {
    display: block;
    width: min(220px, 44vw);
    height: auto;
    border: 0;
    background: transparent;
}

.message-media-audio {
    width: min(360px, 70vw);
}

.message-media-link {
    color: #0a6a89;
    font-weight: 600;
    text-decoration: underline;
}

.message-caption {
    margin-top: 8px;
    font-size: 14px;
    color: #2d3a45;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-reaction {
    font-size: 34px;
    line-height: 1;
    display: inline-block;
}

.messages-page .message-item.outbound .message-bubble {
    background: #bdeef3;
    border-color: #a5dee5;
    text-align: left;
}

.messages-page .message-meta {
    font-size: 12px;
    color: #83909b;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.messages-page .message-item.outbound .message-meta {
    justify-content: flex-end;
    text-align: right;
    align-self: flex-end;
    margin-left: auto;
}

.messages-page .message-sender {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.messages-page .message-sender.sender-inbound {
    background: #e3f5ff;
    color: #0a5f85;
    border: 1px solid #c4e8fb;
}

.messages-page .message-sender.sender-outbound {
    background: #dcfce7;
    color: #0f5c2e;
    border: 1px solid #b9efcc;
}

.messages-page .message-sender-name {
    color: #4f6070;
}

.messages-page .message-time {
    color: #7e8c98;
}

.messages-page .message-status {
    color: #6e7f8d;
    text-transform: lowercase;
}

.messages-page .message-meta-sep {
    color: #97a4af;
}

.message-media-preview-image {
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    border-radius: 10px;
    border: 1px solid #dde4ec;
}

.contact-side-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(430px, 90vw);
    height: 100%;
    background: #ffffff;
    border-left: 1px solid #d8e0e7;
    box-shadow: -10px 0 28px rgba(15, 23, 42, 0.12);
    z-index: 12;
    display: grid;
    grid-template-rows: auto auto 1fr;
    transform: translateX(0);
    transition: transform 0.28s ease, opacity 0.2s ease;
}

.contact-side-panel.d-none {
    display: grid !important;
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
}

.msgs-main.side-open .msgs-contact-head,
.msgs-main.side-open .msgs-thread,
.msgs-main.side-open .msgs-composer {
    margin-right: min(430px, 90vw);
}

.contact-side-head {
    padding: 16px 18px 10px;
    border-bottom: 1px solid #e6edf3;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.contact-side-ident {
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-side-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #0d3442;
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.contact-side-ident h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.contact-side-ident small {
    color: #71808e;
    font-size: 14px;
}

.contact-side-close {
    border: 0;
    background: transparent;
    font-size: 34px;
    line-height: 1;
    color: #3b4650;
    cursor: pointer;
    padding: 0 2px;
}

.contact-side-tabs {
    display: flex;
    gap: 8px;
    padding: 8px 18px 10px;
    border-bottom: 1px solid #e8edf2;
}

.contact-side-tab {
    border: 0;
    background: transparent;
    color: #4e5f6f;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.contact-side-tab.active {
    color: #11879d;
    border-bottom-color: #11879d;
}

.contact-side-content {
    overflow-y: auto;
    padding: 14px 18px 18px;
}

.side-panel-view {
    display: none;
}

.side-panel-view.active {
    display: block;
}

.side-panel-view h4 {
    margin: 0 0 14px;
    font-size: 30px;
    font-weight: 600;
    color: #334150;
}

.side-field {
    margin-bottom: 14px;
}

.side-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #687786;
}

.side-field input {
    width: 100%;
    border: 1px solid #cfd7de;
    border-radius: 6px;
    background: #f8fbfc;
    color: #2e3a45;
    padding: 11px 12px;
    font-size: 14px;
}

.side-history-line {
    margin-bottom: 10px;
    font-size: 14px;
    color: #4d5c69;
}

.side-history-empty {
    margin-top: 22px;
    padding: 18px;
    border: 1px dashed #d5dde5;
    border-radius: 8px;
    color: #758392;
    text-align: center;
    font-size: 14px;
}

.msgs-composer {
    border-top: 1px solid #cfd6dc;
    background: #e6eaee;
    padding: 10px 12px;
    transition: margin-right 0.28s ease;
}

.messages-page #send-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.composer-tools {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.composer-tool-btn {
    border: 1px solid #b9c3cc;
    background: #fff;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.composer-tool-btn:hover {
    border-color: #8ea3b3;
}

.attachment-name {
    font-size: 12px;
    color: #5c6d7a;
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.emoji-panel {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #fff;
    border: 1px solid #cfd8df;
    border-radius: 8px;
    padding: 8px;
}

.emoji-btn {
    border: 1px solid #d9e1e7;
    background: #fff;
    border-radius: 6px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.emoji-btn:hover {
    background: #f3f7fa;
}

.messages-page #message-input {
    border-radius: 8px;
    border: 1px solid #b9c3cc;
    padding: 10px;
    font-size: 14px;
    min-height: 42px;
    max-height: 130px;
    resize: none;
}

.messages-page #send-form button {
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    background: #0f8ea2;
    color: #fff;
    font-weight: 700;
}

@media (max-width: 1080px) {
    .msgs-layout {
        grid-template-columns: 1fr;
    }

    .msgs-sidebar {
        border-right: 0;
        border-bottom: 1px solid #d9dee3;
    }

    .msgs-conversation-list {
        max-height: 260px;
    }

    #chat-title {
        font-size: 22px;
    }

    .message-bubble {
        font-size: 15px;
    }

    .contact-side-panel {
        width: 100%;
    }

    .msgs-main.side-open .msgs-contact-head,
    .msgs-main.side-open .msgs-thread,
    .msgs-main.side-open .msgs-composer {
        margin-right: 0;
    }

    .side-panel-view h4 {
        font-size: 22px;
    }
}

@media (max-width: 576px) {
    .sector-picker-toolbar {
        grid-template-columns: 1fr;
    }
}
