:root {
    --bg: #0b0d12;
    --bg-2: #0f131a;
    --panel: #141820;
    --panel-2: #0f141c;
    --stroke: #202531;
    --text: #e7ecf4;
    --muted: #9aa4b2;
    --accent: #25d366;
    --accent-2: #18a957;
    --bubble-in: #1a2331;
    --bubble-out: #1c3a2b;
    --danger: #ff5c5c;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text);
    background: radial-gradient(circle at 15% 20%, rgba(37, 211, 102, 0.12), transparent 55%),
        radial-gradient(circle at 85% 10%, rgba(69, 129, 255, 0.12), transparent 50%),
        linear-gradient(180deg, #0b0d12 0%, #0c111a 50%, #0a0e14 100%);
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 120px 120px;
    opacity: 0.35;
    pointer-events: none;
}

/* Dark scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(120, 130, 150, 0.35) rgba(9, 12, 18, 0.6);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: rgba(9, 12, 18, 0.6);
}

*::-webkit-scrollbar-thumb {
    background: rgba(120, 130, 150, 0.35);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 130, 150, 0.6);
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: inherit;
}

.text-muted {
    color: var(--muted) !important;
}

.app-shell {
    display: grid;
    grid-template-columns: 520px 1fr;
    height: 100vh;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.6s ease;
}

.sidebar {
    background: var(--panel);
    border-right: 1px solid var(--stroke);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 16px 16px;
    box-shadow: var(--shadow);
    min-height: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.sidebar-header .title {
    font-size: 1.15rem;
    font-weight: 600;
}

.sidebar-header .subtitle {
    font-size: 0.85rem;
    color: var(--muted);
}

.sidebar-actions {
    display: flex;
    gap: 8px;
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--stroke);
    background: var(--panel-2);
}

.sidebar-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    width: 100%;
}

/* Clear (x) button inside search */
.sidebar-search .search-clear {
    background: transparent;
    border: none;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
}
.sidebar-search .search-clear:hover {
    color: var(--text);
    background: rgba(255,255,255,0.03);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    min-height: 0;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid transparent;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    background: rgba(9, 13, 20, 0.4);
    position: relative;
    width: 100%;
    text-align: left;
    cursor: pointer;
    appearance: none;
    color: var(--text);
    font: inherit;
}

.conversation-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.conversation-item:focus-visible {
    outline: 2px solid rgba(37, 211, 102, 0.45);
    outline-offset: 2px;
}

.conversation-item.active {
    border-color: rgba(37, 211, 102, 0.5);
    background: rgba(37, 211, 102, 0.12);
}

.conv-body {
    flex: 1;
    padding-right: 0;
    min-width: 0;
}

.conv-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conv-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.conv-name {
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-name-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.conv-tag {
    font-size: 0.62rem;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.conv-tag.tag-follow {
    background: rgba(245, 158, 11, 0.18);
    color: #f5c267;
    border-color: rgba(245, 158, 11, 0.4);
}

.conv-tag.tag-unread {
    background: rgba(59, 130, 246, 0.18);
    color: #8bbcff;
    border-color: rgba(59, 130, 246, 0.45);
}

.conv-tag.tag-done {
    background: rgba(37, 211, 102, 0.2);
    color: var(--accent);
    border-color: rgba(37, 211, 102, 0.45);
}

.conv-time {
    font-size: 0.75rem;
    color: var(--muted);
    font-family: 'DM Mono', monospace;
}

.conv-badge {
    position: absolute;
    right: 16px;
    bottom: 14px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #04160b;
}

.conv-badge.has-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
}

.conversation-item.unread {
    border-color: rgba(37, 211, 102, 0.4);
    background: rgba(37, 211, 102, 0.08);
}

.conversation-item.unread .conv-badge {
    opacity: 1;
    transform: scale(1);
}

.conv-preview {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 4px;
    padding-right: 42px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.conv-preview-icon {
    width: 14px;
    min-width: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(201, 214, 255, 0.65);
    font-size: 0.78rem;
}

.conv-preview-icon.is-out {
    color: rgba(120, 214, 170, 0.95);
}

.conv-preview-icon.is-in {
    color: rgba(201, 214, 255, 0.75);
}

.conv-preview-icon.is-none {
    visibility: hidden;
}

.conv-preview-text {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.9), rgba(8, 175, 220, 0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #071312;
    font-weight: 700;
}

.avatar.lg {
    width: 56px;
    height: 56px;
    border-radius: 18px;
}

.chat-pane {
    display: flex;
    flex-direction: column;
    background: var(--bg-2);
    min-height: 0;
    overflow: hidden;
}

.chat-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.chat-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--stroke);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(10, 14, 20, 0.85);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.contact-panel {
    border-left: 1px solid var(--stroke);
    background: var(--panel);
    padding: 20px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.contact-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.contact-panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.contact-panel-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.contact-panel-edit {
    border: none;
    background: transparent;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 4px 8px;
    cursor: pointer;
}

.contact-panel-edit:hover {
    color: var(--accent-2);
}

.contact-panel-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-panel-sep {
    height: 1px;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    margin: 4px 0;
}

.contact-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-status-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.contact-status-options {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
}

.contact-status-options::-webkit-scrollbar {
    display: none;
}

.status-chip {
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-chip:hover {
    filter: brightness(1.05);
}

.status-chip[data-status="follow"] {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: #f5c267;
}

.status-chip[data-status="unread"] {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.4);
    color: #8bbcff;
}

.status-chip[data-status="done"] {
    background: rgba(37, 211, 102, 0.14);
    border-color: rgba(37, 211, 102, 0.4);
    color: var(--accent);
}

.status-chip.is-active[data-status="follow"] {
    background: rgba(245, 158, 11, 0.3);
    border-color: rgba(245, 158, 11, 0.55);
    color: #ffd08a;
}

.status-chip.is-active[data-status="unread"] {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.55);
    color: #b3d1ff;
}

.status-chip.is-active[data-status="done"] {
    background: rgba(37, 211, 102, 0.3);
    border-color: rgba(37, 211, 102, 0.55);
    color: #7ff0ac;
}

.contact-notes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.contact-notes-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.notes-link {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
}

.notes-link:hover {
    color: var(--accent-2);
}

.contact-notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.contact-notes-list--modal {
    max-height: 60vh;
}

.contact-calls-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 4px;
}

.call-item {
    background: rgba(9, 13, 20, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--muted);
}

.call-direction {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
}

.call-direction.call-in {
    color: #8bbcff;
}

.call-direction.call-out {
    color: #f5c267;
}

.call-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.call-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.call-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.75rem;
    color: var(--muted);
}

.call-status {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.68rem;
}

.call-status.status-answered {
    background: rgba(37, 211, 102, 0.18);
    border-color: rgba(37, 211, 102, 0.45);
    color: var(--accent);
}

.call-status.status-no-answer {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(245, 158, 11, 0.4);
    color: #f5c267;
}

.call-status.status-failed {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.call-status.status-busy {
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.4);
    color: #cbd5f5;
}

.call-status.status-other {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.4);
    color: #8bbcff;
}

.call-duration {
    font-weight: 600;
}

.call-audio audio {
    width: 100%;
}

.call-modal .modal-body {
    padding: 0;
}

.call-modal .modal-dialog {
    max-width: 260px;
    margin: 0 auto;
}

.call-modal .modal-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.webphone-frame {
    width: 100%;
    border: 0;
    height: min(40vh, 200px);
    border-radius: 16px;
}

.webphone-frame--hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    left: -9999px;
    top: 0;
}

.contact-note {
    background: rgba(9, 13, 20, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 10px 12px;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.note-author {
    font-weight: 600;
    color: var(--text);
}

.note-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text);
    white-space: pre-wrap;
}

.notes-empty {
    color: var(--muted);
    font-size: 0.85rem;
    padding: 8px 4px;
}

.contact-notes-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.contact-notes-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 70px;
    background: var(--panel-2);
    border: 1px solid var(--stroke);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
}

.notes-actions {
    display: flex;
    justify-content: flex-end;
}

.contact-panel-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(9, 13, 20, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.contact-panel-action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(9, 13, 20, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.contact-panel-action i {
    color: var(--accent);
    font-size: 1rem;
}

.contact-panel-action:hover {
    border-color: rgba(37, 211, 102, 0.35);
    background: rgba(37, 211, 102, 0.08);
    transform: translateY(-1px);
}

.contact-panel-item.is-clickable {
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.contact-panel-item.is-clickable:hover {
    border-color: rgba(37, 211, 102, 0.35);
    background: rgba(37, 211, 102, 0.08);
    transform: translateY(-1px);
}

.contact-panel-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 211, 102, 0.12);
    color: var(--accent);
    flex-shrink: 0;
}

.contact-panel-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.contact-panel-value {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}

.contact-panel-value.is-empty {
    color: var(--muted);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-contact {
    display: grid;
    gap: 2px;
    text-align: left;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    min-width: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
}

.chat-contact:hover h2 {
    color: var(--accent);
}

.chat-contact:focus-visible {
    outline: 2px solid rgba(37, 211, 102, 0.45);
    outline-offset: 4px;
    border-radius: 12px;
}

.chat-title h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.chat-title p {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.chat-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    font-size: 0.85rem;
}

.badge-status {
    background: rgba(37, 211, 102, 0.2);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 140px 140px;
    min-height: 0;
    scrollbar-gutter: stable;
    position: relative;
    z-index: 1;
}

.chat-messages:focus {
    outline: none;
}

.message {
    display: flex;
    min-width: 0;
}

.message-date {
    align-self: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(231, 236, 244, 0.7);
    font-size: 0.7rem;
    font-family: 'DM Mono', monospace;
    letter-spacing: 0.4px;
}

.chat-history-loader {
    align-self: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(231, 236, 244, 0.58);
    font-size: 0.68rem;
    font-family: 'DM Mono', monospace;
    letter-spacing: 0.3px;
}

.message-in {
    justify-content: flex-start;
}

.message-out {
    justify-content: flex-end;
}

.bubble {
    max-width: 70%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 18px;
    background: var(--bubble-in);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
    display: grid;
    gap: 8px;
    align-items: start;
    animation: popIn 0.35s ease;
    position: relative;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-out .bubble {
    background: var(--bubble-out);
}

.message-text {
    line-height: 1.5;
    font-size: 0.95rem;
    white-space: pre-wrap;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: left;
}

.message-link {
    color: #8ecbff;
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-link:hover {
    color: #b8dcff;
}

.message-sender {
    font-weight: 700;
    font-size: 0.85rem;
    color: rgba(231, 236, 244, 0.9);
}

.message-out .message-sender {
    color: rgba(37, 211, 102, 0.95);
}

.message-time {
    font-size: 0.7rem;
    color: var(--muted);
    text-align: right;
    font-family: 'DM Mono', monospace;
}

.message-origin {
    font-size: 0.65rem;
    color: rgba(231, 236, 244, 0.6);
    font-family: 'DM Mono', monospace;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.message-in .message-actions {
    justify-content: flex-start;
}

.message-out .message-actions {
    justify-content: flex-end;
}

.message-action-btn {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 999px;
    padding: 3px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    line-height: 1;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.message-action-btn:hover {
    background: rgba(37, 211, 102, 0.14);
    border-color: rgba(37, 211, 102, 0.5);
    color: #dfffe9;
}

.message-action-btn i {
    font-size: 0.76rem;
}

.message.is-reply-target .bubble {
    outline: 1px solid rgba(37, 211, 102, 0.6);
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.12), 0 14px 30px rgba(0, 0, 0, 0.2);
}

.message-status {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
}

.message-status i {
    font-size: 0.85rem;
}

.message-status.status-read {
    color: var(--accent);
}

.message-status.status-delivered {
    color: rgba(231, 236, 244, 0.75);
}

.message-status.status-failed {
    color: var(--danger);
}

.message-reply-ref {
    border-left: 3px solid rgba(37, 211, 102, 0.65);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 6px 8px;
    display: grid;
    gap: 2px;
}

.message-reply-ref-title {
    font-size: 0.7rem;
    color: #b8f1cc;
    font-weight: 600;
}

.message-reply-ref-text {
    font-size: 0.78rem;
    color: rgba(231, 236, 244, 0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-replied-flag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(37, 211, 102, 0.45);
    background: rgba(37, 211, 102, 0.14);
    color: #c7f5d8;
    font-size: 0.64rem;
    font-weight: 600;
    line-height: 1;
}

.message-image {
    width: 260px;
    max-width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: zoom-in;
}

.message-sticker {
    width: 150px;
    max-width: 55vw;
    background: transparent;
    border: none;
    box-shadow: none;
}

.message-video {
    width: 220px;
    max-width: min(70vw, 240px);
    max-height: 190px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.28);
    display: block;
    object-fit: contain;
    cursor: pointer;
}

.image-preview-modal .modal-content {
    background: rgba(13, 16, 22, 0.98);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
}

.image-preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--bg);
    overflow: auto;
    max-height: 80vh;
}

.image-preview-body img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    cursor: zoom-in;
    transition: width 0.15s ease, height 0.15s ease;
}

.video-preview-modal .modal-content {
    background: rgba(13, 16, 22, 0.98);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
}

.video-preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--bg);
}

.video-preview-player {
    width: min(100%, 980px);
    max-height: 78vh;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #000;
}

/* Internal chat message media styles */
.msg-image {
    max-width: 160px;
    max-height: 140px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    cursor: zoom-in;
    display: block;
}

.message-attachment {
    margin-top: 8px;
}

.message-attachment img.msg-image {
    display: block;
}

.msg-file-link {
    display: inline-block;
    color: var(--text);
    background: rgba(255,255,255,0.03);
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
}

.attach-audio-player, .message-attachment audio {
    width: 220px;
    max-width: 70vw;
    border-radius: 8px;
    background: rgba(0,0,0,0.06);
}

.audio-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Emoji button and picker */
.composer-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.15rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
    border: 1px solid rgba(255,255,255,0.04);
    color: var(--text);
}
.btn-emoji i {
    font-size: 1.1rem;
}
.btn-emoji:hover { background: rgba(255,255,255,0.03); }
.emoji-picker {
    position: absolute;
    background: var(--panel);
    border: 1px solid var(--stroke);
    padding: 8px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 1200;
    min-width: 280px;
}
.emoji-picker .emoji-search {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.emoji-picker .emoji-search input {
    flex: 1;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--stroke);
    background: transparent;
    color: var(--text);
}
.emoji-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.emoji-tab {
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 0.9rem;
}
.emoji-tab.active { background: rgba(255,255,255,0.03); color: var(--text); border-color: rgba(255,255,255,0.04); }
.emoji-skintones { display: flex; gap:6px; margin-bottom:8px; }
.emoji-skin { padding:4px 6px; border-radius:6px; cursor:pointer; border:1px solid transparent; }
.emoji-skin.active { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.04); }
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}
.emoji-btn {
    background: transparent;
    border: none;
    font-size: 1.05rem;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
}
.emoji-btn:hover { background: rgba(255,255,255,0.03); }
}

/* Attachment preview in composer */
.attach-preview-box {
    display: flex;
    align-items: center;
    gap: 8px;
}
.attach-preview-name {
    color: var(--text);
}


.image-preview-body.is-zoomed {
    align-items: flex-start;
    justify-content: flex-start;
    cursor: grab;
}

.image-preview-body.is-zoomed img {
    max-width: none;
    max-height: none;
    flex: 0 0 auto;
}

.image-preview-body.is-panning {
    cursor: grabbing;
}

.file-link {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.file-link.file-link-pdf {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: 0;
}

.file-link i {
    font-size: 1.2rem;
    color: var(--accent);
}

.file-name {
    font-weight: 600;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

.pdf-preview-card {
    display: block;
    width: min(340px, 72vw);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-pdf-preview {
    display: block;
    width: 100%;
    height: 220px;
    border: 0;
    background: #fff;
}

.chat-composer {
    padding: 16px 24px 22px;
    border-top: 1px solid var(--stroke);
    background: var(--panel);
    flex-shrink: 0;
}

.composer-alert {
    margin-bottom: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 92, 92, 0.35);
    background: rgba(255, 92, 92, 0.12);
    color: #ffd1d1;
}

.window-status-indicator {
    margin-bottom: 10px;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    padding: 8px 12px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-status-indicator i {
    font-size: 0.95rem;
}

.window-status-indicator.is-open {
    border-color: rgba(37, 211, 102, 0.35);
    background: rgba(37, 211, 102, 0.08);
    color: #c7f5d8;
}

.window-status-indicator.is-closed {
    border-color: rgba(244, 187, 57, 0.35);
    background: rgba(244, 187, 57, 0.08);
    color: #ffe3a0;
}

.composer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.composer-tools {
    display: flex;
    gap: 8px;
}

.chat-pane.is-dragover-files .chat-messages,
.chat-messages.is-dragover-files,
.composer.is-dragover-files .composer-input {
    outline: 2px dashed rgba(37, 211, 102, 0.6);
    outline-offset: -4px;
    background: rgba(37, 211, 102, 0.08);
}

.composer-input {
    flex: 1;
    background: var(--panel-2);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reply-preview {
    border: 1px solid rgba(37, 211, 102, 0.35);
    background: rgba(37, 211, 102, 0.08);
    border-radius: 10px;
    padding: 8px 10px;
    display: grid;
    gap: 6px;
}

.reply-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.reply-preview-title {
    font-size: 0.72rem;
    color: #c7f5d8;
    font-weight: 600;
}

.reply-preview-text {
    font-size: 0.8rem;
    color: rgba(231, 236, 244, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-preview-close {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: rgba(231, 236, 244, 0.8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.reply-preview-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.composer-input textarea {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    resize: none;
    min-height: 24px;
}

.composer-input textarea.is-window-locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.attach-preview {
    font-size: 0.8rem;
    color: var(--muted);
}

.forward-source {
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 12px;
    font-size: 0.84rem;
    color: rgba(231, 236, 244, 0.9);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.forward-target-list {
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 2px;
}

.forward-target-item {
    width: 100%;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 10px;
    text-align: left;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.forward-target-item:hover {
    border-color: rgba(37, 211, 102, 0.45);
    background: rgba(37, 211, 102, 0.08);
}

.forward-target-item.is-selected {
    border-color: rgba(37, 211, 102, 0.6);
    background: rgba(37, 211, 102, 0.14);
}

.forward-target-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: #0f1a2a;
    background: linear-gradient(135deg, #25d366, #22d3ee);
    flex-shrink: 0;
}

.forward-target-body {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.forward-target-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
}

.forward-target-preview {
    font-size: 0.74rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forward-empty {
    border: 1px dashed var(--stroke);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
}

.attach-audio-box {
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: rgba(9, 15, 24, 0.7);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attach-audio-box.is-recording {
    border-color: rgba(255, 176, 32, 0.45);
    background: rgba(255, 176, 32, 0.08);
}

.attach-audio-box.is-ready {
    border-color: rgba(37, 211, 102, 0.35);
    background: rgba(37, 211, 102, 0.08);
}

.attach-audio-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.attach-audio-status {
    font-size: 0.78rem;
    color: var(--text);
    font-weight: 600;
}

.attach-audio-timer,
.attach-audio-file {
    font-size: 0.74rem;
    color: var(--muted);
}

.attach-audio-file {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attach-audio-player {
    width: 100%;
    height: 32px;
}

.attach-audio-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attach-audio-action {
    border: 1px solid var(--stroke);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 0.72rem;
    line-height: 1.1;
    padding: 5px 9px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.attach-audio-action:hover {
    border-color: rgba(37, 211, 102, 0.5);
    color: var(--accent);
}

.attach-audio-action.is-primary {
    border-color: rgba(37, 211, 102, 0.45);
    color: #c7f5d8;
}

.attach-audio-action.is-primary:hover {
    background: rgba(37, 211, 102, 0.14);
}

.attach-audio-action.is-danger {
    border-color: rgba(255, 92, 92, 0.45);
    color: #ffb1b1;
}

.attach-audio-action.is-danger:hover {
    background: rgba(255, 92, 92, 0.14);
    color: #ffd1d1;
}

.paste-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.78rem;
}

.paste-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.paste-preview-open,
.paste-preview-clear {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 2px 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.paste-preview-open:hover {
    color: var(--text);
}

.paste-preview-clear:hover {
    color: var(--danger);
}

.paste-modal-body {
    padding: 18px;
}

.paste-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.paste-modal-item {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.paste-modal-item img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    border-radius: 12px;
    background: #0c1118;
}

.paste-modal-meta {
    font-size: 0.75rem;
    color: var(--muted);
    word-break: break-word;
}

.paste-modal-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    background: rgba(10, 12, 18, 0.7);
    color: var(--text);
    border-radius: 999px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.paste-modal-remove:hover {
    color: var(--danger);
}

.send-btn {
    min-width: 52px;
    height: 52px;
    border-radius: 16px;
}

.btn-sendable {
    position: relative;
}

.btn-sendable .send-icon {
    display: inline-flex;
    transition: opacity 0.2s ease;
}

.send-spinner {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid rgba(37, 211, 102, 0.35);
    border-top-color: var(--accent);
    opacity: 0;
    animation: spin 0.7s linear infinite;
    pointer-events: none;
}

.btn-sendable.is-loading .send-icon {
    opacity: 0;
}

.btn-sendable.is-loading .send-spinner {
    opacity: 1;
}

.btn-sendable.is-window-locked {
    opacity: 0.5;
}

.btn-icon.is-window-locked {
    opacity: 0.5;
}

.btn-template {
    min-width: 52px;
    height: 52px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: var(--panel-2);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-template:hover {
    border-color: rgba(37, 211, 102, 0.5);
    color: var(--accent);
}

.btn-accent {
    background: var(--accent);
    color: #06120b;
    border: none;
    font-weight: 600;
}

.btn-accent:hover {
    background: var(--accent-2);
    color: #06120b;
}

.btn-soft {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid transparent;
    font-weight: 500;
}

.btn-soft:hover {
    background: #1d2940;
    color: #f3f6fb;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    background: var(--panel-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.2s ease;
    position: relative;
}

.btn-icon:hover {
    border-color: rgba(37, 211, 102, 0.5);
    color: var(--accent);
}

.btn-icon.is-active {
    border-color: rgba(37, 211, 102, 0.55);
    background: rgba(37, 211, 102, 0.18);
    color: var(--accent);
}

.btn-icon.is-muted {
    border-color: rgba(255, 176, 32, 0.45);
    background: rgba(255, 176, 32, 0.12);
    color: #ffb020;
}

.btn-icon--call {
    border-color: rgba(37, 211, 102, 0.45);
    background: rgba(37, 211, 102, 0.16);
    color: var(--accent);
}

.btn-icon--call:hover {
    border-color: rgba(37, 211, 102, 0.6);
    background: rgba(37, 211, 102, 0.28);
    color: var(--accent);
}

.btn-icon--mic {
    border-color: rgba(37, 211, 102, 0.25);
    background: rgba(37, 211, 102, 0.08);
    color: var(--accent);
}

.btn-icon--mic:hover {
    border-color: rgba(37, 211, 102, 0.45);
    background: rgba(37, 211, 102, 0.16);
    color: var(--accent);
}

.btn-icon--mic-off {
    border-color: rgba(239, 83, 80, 0.45);
    background: rgba(239, 83, 80, 0.14);
    color: #ef5350;
}

.btn-icon--mic-off:hover {
    border-color: rgba(239, 83, 80, 0.65);
    background: rgba(239, 83, 80, 0.22);
    color: #ef5350;
}

.is-hidden {
    display: none !important;
}

.btn-icon .internal-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #04160b;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    box-shadow: 0 0 0 2px var(--panel);
    transition: all 0.2s ease;
    pointer-events: none;
}

.btn-icon.has-unread .internal-badge {
    opacity: 1;
    transform: scale(1);
}

.btn-icon .internal-badge.is-empty {
    opacity: 0;
    transform: scale(0.6);
}

.conversation-item.assigned-new {
    border-color: rgba(255, 176, 32, 0.5);
    background: rgba(255, 176, 32, 0.06);
}

.conversation-item.assigned-any {
    border-color: rgba(255, 176, 32, 0.45);
}

.conversation-item.assigned-me,
.conversation-item.active.assigned-any,
.conversation-item.active.assigned-me {
    border-color: rgba(255, 176, 32, 0.65);
    background: rgba(255, 176, 32, 0.12);
}

.chat-operator {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

#chatAssignedTo {
    color: #ffb020;
}

.sidebar-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 176, 32, 0.4);
    background: rgba(255, 176, 32, 0.08);
    color: #ffb020;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-alert .alert-text {
    flex: 1;
}

.sidebar-alert:hover {
    border-color: rgba(255, 176, 32, 0.6);
    background: rgba(255, 176, 32, 0.15);
}

.sidebar-alert.is-active {
    background: rgba(255, 176, 32, 0.2);
    box-shadow: 0 0 0 1px rgba(255, 176, 32, 0.35);
}

.sidebar-alert.is-disabled {
    opacity: 0.6;
}

.sidebar-alert .badge-count {
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ffb020;
    color: #1a0e02;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-alert .badge-count.is-empty {
    background: rgba(255, 176, 32, 0.35);
    color: rgba(255, 224, 161, 0.85);
}

.sidebar-alert--messages {
    border-color: rgba(37, 211, 102, 0.4);
    background: rgba(37, 211, 102, 0.08);
    color: var(--accent);
    cursor: default;
}

.sidebar-alert--messages:hover {
    border-color: rgba(37, 211, 102, 0.4);
    background: rgba(37, 211, 102, 0.08);
}

.sidebar-alert--messages .badge-count {
    background: rgba(37, 211, 102, 0.9);
    color: #02210e;
}

.sidebar-alert--messages .badge-count.is-empty {
    background: rgba(37, 211, 102, 0.28);
    color: rgba(199, 255, 221, 0.86);
}

.dropdown-menu {
    background: var(--panel-2);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
    border-radius: 14px;
    padding: 8px;
    z-index: 25;
}

.dropdown-item {
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.9rem;
}

.dropdown-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: rgba(37, 211, 102, 0.12);
    color: var(--accent);
}

.dropdown-item.text-danger {
    color: var(--danger);
}

.dropdown-item.text-danger:hover,
.dropdown-item.text-danger:focus {
    background: rgba(255, 92, 92, 0.15);
    color: var(--danger);
}

.modal-content {
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 22px;
    color: var(--text);
    box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
    border-color: var(--stroke);
}

.modal-title {
    font-weight: 600;
}

#deleteNumberModal .delete-number-logo {
    width: 72px !important;
    max-width: 72px !important;
    height: auto !important;
    object-fit: contain;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.contact-details {
    display: grid;
    gap: 12px;
}

.contact-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--stroke);
}

.contact-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.contact-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.contact-value {
    font-weight: 600;
    text-align: right;
}

.empty-state,
.chat-empty {
    padding: 24px;
    text-align: center;
    color: var(--muted);
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--accent);
}

.chat-empty {
    margin: auto;
}

.chat-placeholder {
    text-align: center;
    color: var(--muted);
}

.dashboard-view {
    display: grid;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 14px;
    padding: 16px 18px;
    height: 100%;
    overflow-y: auto;
}

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
    gap: 8px;
}

.dashboard-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #dbe2ea;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.1);
}

.dashboard-filter-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-filter-label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #3f5877;
}

.dashboard-filter-input {
    min-width: 148px;
    height: 32px;
    border: 1px solid #cad6e5;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.82rem;
    color: #0f172a;
    background: #ffffff;
}

.dashboard-filter-input:focus {
    outline: none;
    border-color: #8fb2da;
    box-shadow: 0 0 0 0.18rem rgba(13, 110, 253, 0.15);
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 7px;
    border-radius: 9px;
    border: 1px solid #d7e0ec;
    background: #edf1f7;
    padding: 7px 9px;
    color: #152c47;
    min-height: clamp(46px, 5vw, 56px);
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.1);
}

.kpi-card strong {
    display: block;
    font-size: clamp(0.95rem, 1.35vw, 1.15rem);
    line-height: 1;
}

.kpi-card small {
    display: block;
    color: #466286;
    font-size: clamp(0.60rem, 0.88vw, 0.68rem);
}

.kpi-icon {
    width: clamp(22px, 2.4vw, 26px);
    height: clamp(22px, 2.4vw, 26px);
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.64rem, 0.9vw, 0.76rem);
    color: #254c70;
    background: #d4e6fb;
    border: 1px solid #c2d9f3;
}

.kpi-card--primary {
    background: linear-gradient(135deg, #1f2d46, #15223a);
    border-color: #2d405f;
    color: #ffffff;
}

.kpi-card--primary .kpi-icon {
    background: #2b3f5f;
    border-color: #3a5377;
    color: #dbe7ff;
}

.kpi-card--primary small {
    color: rgba(219, 231, 255, 0.84);
}

.dashboard-hour-chart {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 14px;
    border: 1px solid #dbe2ea;
    padding: 10px 12px 10px;
    color: #0f172a;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.12);
}

.dashboard-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.dashboard-section-head h3 {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 700;
}

.dashboard-section-head span {
    font-size: 0.76rem;
    color: #64748b;
}

.dashboard-chart-wrapper {
    position: relative;
    width: 100%;
    height: 210px;
    background: #ffffff;
    border: 1px solid #e4e9f0;
    border-radius: 12px;
    padding: 6px;
}

.dashboard-user-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    align-items: stretch;
    grid-auto-rows: 1fr;
}

.dashboard-panel {
    border-radius: 14px;
    border: 1px solid #dbe2ea;
    background: rgba(255, 255, 255, 0.98);
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    color: #0f172a;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.12);
}

.dashboard-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
    text-align: left;
}

.dashboard-panel-head h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #102038;
}

.dashboard-table-wrap {
    overflow: auto;
    align-self: stretch;
    flex: 1 1 auto;
    min-height: 0;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.dashboard-table th,
.dashboard-table td {
    padding: 7px 6px;
    border-bottom: 1px solid #e5ecf4;
    font-size: 0.78rem;
}

.dashboard-table th {
    color: #5b6f8b;
    font-weight: 600;
    text-align: left;
    position: sticky;
    top: 0;
    background: #f3f6fb;
    z-index: 1;
}

.dashboard-table td {
    color: #1f344f;
}

.dashboard-empty {
    text-align: center;
    color: #6d819c;
}

.user-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    background: linear-gradient(135deg, #67e8f9, #22d3ee);
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 700;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 26px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.82rem;
}

.pill-green {
    background: rgba(34, 197, 94, 0.18);
    color: #0f7a3c;
}

.pill-blue {
    background: rgba(56, 189, 248, 0.2);
    color: #0f6c8b;
}

.dashboard-action-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.18);
    color: #0f7a3c;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.dashboard-drill-btn {
    border: 0;
    cursor: pointer;
}

.dashboard-drill-btn:hover {
    filter: brightness(0.96);
}

.dashboard-drill-btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.6);
    outline-offset: 1px;
}

.pill-gray {
    background: rgba(148, 163, 184, 0.2);
    color: #4b607a;
}

.dashboard-panel--side {
    align-self: stretch;
}

.dashboard-donut-wrap {
    display: flex;
    justify-content: center;
}

.dashboard-donut {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.dashboard-donut-center {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #ffffff;
    color: #1f334d;
    display: grid;
    place-items: center;
    text-align: center;
    border: 1px solid #e1e7ef;
}

.dashboard-donut-center strong {
    display: block;
    font-size: 1.9rem;
    line-height: 1;
}

.dashboard-donut-center span {
    font-size: 0.8rem;
    color: #6e8098;
}

.dashboard-legend {
    display: grid;
    gap: 8px;
    max-height: 280px;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.legend-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 0.9rem;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.legend-name {
    color: #1f344f;
}

.legend-val {
    color: #4a5f79;
    font-family: 'DM Mono', monospace;
}

.dashboard-drill-modal .modal-body {
    min-height: 420px;
}

.dashboard-drill-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 12px;
    min-height: 360px;
}

.dashboard-drill-contacts,
.dashboard-drill-messages {
    background: rgba(15, 23, 42, 0.2);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dashboard-drill-subtitle {
    color: #8ba0be;
    font-size: 0.78rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.dashboard-drill-list {
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.dashboard-contact-row {
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(30, 41, 59, 0.55);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dashboard-contact-row.is-active {
    border-color: rgba(56, 189, 248, 0.8);
    background: rgba(8, 47, 73, 0.5);
}

.dashboard-contact-row:hover {
    border-color: rgba(56, 189, 248, 0.5);
}

.dashboard-contact-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.dashboard-contact-sub {
    color: #94a3b8;
    font-size: 0.78rem;
}

.dashboard-contact-meta {
    color: #cbd5e1;
    font-size: 0.74rem;
}

.dashboard-drill-list--messages {
    padding-right: 2px;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 140px 140px;
    border-radius: 10px;
    padding: 8px;
}

.dashboard-drill-list--messages .bubble {
    box-shadow: none;
}

.auth {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    overflow: auto;
}

.auth-shell {
    width: 100%;
    max-width: 520px;
}

.auth-shell.admin-shell {
    max-width: 1200px;
}

.auth-card {
    background: rgba(17, 21, 29, 0.92);
    border: 1px solid var(--stroke);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.auth-card.wide {
    max-width: 720px;
}

.auth-card.admin-card {
    max-width: 1200px;
    width: 100%;
}

.auth-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    margin-bottom: 24px;
}

.auth-logo {
    width: 240px;
    height: 240px;
    border-radius: 0;
    object-fit: contain;
    background: transparent;
    border: none;
    padding: 0;
}

.auth-card.admin-card .auth-logo {
    width: 200px;
    height: 200px;
}

.auth-card.admin-card .auth-brand {
    gap: 0px;
    margin-bottom: 16px;
}

.admin-hub-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.admin-hub-kpi {
    position: relative;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: rgba(15, 20, 28, 0.9);
    padding: 16px;
    overflow: hidden;
}

.admin-hub-kpi-label {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.admin-hub-kpi-value {
    font-size: 2rem;
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    line-height: 1.1;
}

.admin-hub-kpi-icon {
    position: absolute;
    right: 14px;
    top: 14px;
    color: rgba(37, 211, 102, 0.75);
    font-size: 1.25rem;
}

.admin-hub-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.admin-hub-action {
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: rgba(15, 20, 28, 0.9);
    padding: 16px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-hub-action:hover {
    border-color: rgba(37, 211, 102, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.admin-hub-action--primary {
    border-color: rgba(37, 211, 102, 0.45);
    background: linear-gradient(160deg, rgba(37, 211, 102, 0.15), rgba(15, 20, 28, 0.95));
}

.admin-hub-action-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.admin-hub-action-text {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.4;
    flex: 1;
}

.admin-hub-action-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--accent);
}

.admin-company-title {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (max-width: 992px) {
    .admin-hub-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .admin-hub-kpis,
    .admin-hub-actions {
        grid-template-columns: 1fr;
    }

    .admin-hub-action {
        min-height: 0;
    }
}

.auth-brand h1 {
    margin: 0 0 4px 0;
    font-size: 1.4rem;
}

.auth-brand p {
    margin: 0;
    color: var(--muted);
}

.brand-dot {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #10c7c7);
}

.form-control,
.form-select {
    background: var(--panel-2);
    border: 1px solid var(--stroke);
    color: var(--text);
}

.form-control.is-readonly,
.form-control[readonly] {
    opacity: 0.75;
    cursor: not-allowed;
}

.form-control::placeholder,
.composer-input textarea::placeholder,
.sidebar-search input::placeholder {
    color: rgba(231, 236, 244, 0.6);
    opacity: 1;
}

.input-group-text {
    background: var(--panel-2);
    border: 1px solid var(--stroke);
    color: var(--muted);
}

.input-group .form-control {
    border-left: none;
}

.input-group .form-control:focus {
    border-left: none;
}

.form-control:focus,
.form-select:focus {
    background: var(--panel-2);
    color: var(--text);
    border-color: rgba(37, 211, 102, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.15);
}

.form-label {
    color: var(--muted);
    font-weight: 500;
}

.auth-footer {
    margin-top: 18px;
    font-size: 0.85rem;
    color: var(--muted);
}

.mobile-only {
    display: none;
}

@media (max-width: 1200px) {
    .dashboard-kpis {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .dashboard-filter-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-filter-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .dashboard-user-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    body {
        overflow: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
    }

    .app-shell.chat-open .sidebar {
        display: none;
    }

    .app-shell.chat-open .chat-pane {
        display: flex;
        min-height: 100vh;
    }

    .app-shell.chat-closed .chat-pane {
        display: none;
    }

    .sidebar {
        height: 100vh;
    }

    .mobile-only {
        display: inline-flex;
    }

    .chat-messages {
        padding: 16px;
    }

    .bubble {
        max-width: 90%;
    }

    .chat-body {
        grid-template-columns: 1fr;
    }

    .contact-panel {
        display: none;
    }

    .dashboard-view {
        padding: 16px;
        gap: 14px;
    }

    .dashboard-kpis {
        grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    }

    .dashboard-filter-controls {
        gap: 6px;
    }

    .dashboard-filter-label {
        width: 100%;
    }

    .dashboard-chart-wrapper {
        height: 180px;
    }

    .dashboard-panel {
        padding: 12px;
    }

    .dashboard-table {
        min-width: 640px;
    }

    .dashboard-drill-layout {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .dashboard-drill-modal .modal-body {
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
