﻿.crm-webrtc-phone {
    bottom: 88px;
    pointer-events: none;
    position: fixed;
    right: 22px;
    touch-action: none;
    z-index: 1040;
}

.crm-webrtc-phone.is-dragging {
    user-select: none;
}

.crm-webrtc-hidden {
    display: none;
}

.crm-webrtc-header-slots {
    align-items: center;
    display: inline-flex;
    gap: 4px;
    padding: 0 6px;
}

.main-header .navbar-nav > .nav-item.crm-webrtc-header-slots > .crm-webrtc-header-button {
    color: #6c757d;
    margin: 0 1px;
    padding: 0 7px !important;
}

.main-header .navbar-nav > .nav-item.crm-webrtc-header-slots > .crm-webrtc-header-button.is-ready > i {
    color: #0d6efd;
}

.main-header .navbar-nav > .nav-item.crm-webrtc-header-slots > .crm-webrtc-header-button.is-registering > i {
    color: #f59e0b;
}

.main-header .navbar-nav > .nav-item.crm-webrtc-header-slots > .crm-webrtc-header-button.is-registered > i {
    color: #16a34a;
}

.main-header .navbar-nav > .nav-item.crm-webrtc-header-slots > .crm-webrtc-header-button.is-warning > i {
    color: #f59e0b;
}

.main-header .navbar-nav > .nav-item.crm-webrtc-header-slots > .crm-webrtc-header-button.is-failed > i {
    color: #dc3545;
}

.crm-webrtc-header-slot-no {
    align-items: center;
    background: #0f172a;
    border: 1px solid #fff;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 9px;
    font-weight: 700;
    height: 14px;
    justify-content: center;
    line-height: 1;
    min-width: 14px;
    padding: 1px 4px;
    position: absolute;
    right: 3px;
    top: 3px;
}

.crm-webrtc-header-button.is-registered .crm-webrtc-header-slot-no {
    background: #16a34a;
}

.crm-webrtc-header-button.is-registering .crm-webrtc-header-slot-no {
    background: #f59e0b;
}

.crm-webrtc-header-button.is-warning .crm-webrtc-header-slot-no {
    background: #f59e0b;
}

.crm-webrtc-header-button.is-failed .crm-webrtc-header-slot-no {
    background: #dc3545;
}

.crm-webrtc-shell {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crm-webrtc-head button {
    align-items: center;
    border: 0;
    display: inline-flex;
    justify-content: center;
}

.crm-webrtc-body {
    background: #fff;
    border: 1px solid #dce7f5;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
    display: none;
    max-height: calc(100vh - 118px);
    max-width: calc(100vw - 28px);
    overflow-y: auto;
    padding: 12px;
    pointer-events: auto;
    scrollbar-gutter: stable;
    width: 330px;
}

.crm-webrtc-shell.is-open .crm-webrtc-body {
    display: block;
}

.crm-webrtc-head {
    align-items: flex-start;
    cursor: move;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.crm-webrtc-head strong {
    color: #172033;
    display: block;
    font-size: 15px;
}

.crm-webrtc-head span {
    color: #64748b;
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.crm-webrtc-head button {
    background: #f3f6fb;
    border-radius: 7px;
    color: #475569;
    cursor: pointer;
    height: 30px;
    width: 30px;
}

.crm-webrtc-slots {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 10px;
}

.crm-webrtc-slots button {
    background: #f8fafc;
    border: 1px solid #dbe5f1;
    border-radius: 8px;
    color: #27364f;
    min-height: 48px;
    padding: 7px 6px;
    text-align: left;
}

.crm-webrtc-slots button.active {
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, .12);
}

.crm-webrtc-slots button.ready {
    background: #f0fdf4;
}

.crm-webrtc-slots button.warning {
    background: #fffbeb;
}

.crm-webrtc-slots span,
.crm-webrtc-slots small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-webrtc-slots span {
    font-size: 12px;
    font-weight: 700;
}

.crm-webrtc-slots small {
    color: #64748b;
    font-size: 10px;
    margin-top: 2px;
}

.crm-webrtc-status {
    align-items: flex-start;
    border-radius: 8px;
    display: flex;
    font-size: 12px;
    gap: 8px;
    line-height: 1.35;
    margin-bottom: 10px;
    padding: 9px 10px;
}

.crm-webrtc-status.ready {
    background: #ecfdf5;
    color: #166534;
}

.crm-webrtc-status.warning {
    background: #fff7ed;
    color: #9a3412;
}

.crm-webrtc-register-status {
    align-items: flex-start;
    border-radius: 8px;
    display: flex;
    font-size: 12px;
    gap: 8px;
    line-height: 1.35;
    margin-bottom: 10px;
    padding: 9px 10px;
}

.crm-webrtc-register-status.idle {
    background: #f8fafc;
    color: #475569;
}

.crm-webrtc-register-status.info {
    background: #eff6ff;
    color: #1d4ed8;
}

.crm-webrtc-register-status.ready {
    background: #ecfdf5;
    color: #166534;
}

.crm-webrtc-register-status.warning {
    background: #fff7ed;
    color: #9a3412;
}

.crm-webrtc-details-toggle {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #dbe5f1;
    border-radius: 8px;
    color: #334155;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    margin-bottom: 10px;
    min-height: 38px;
    padding: 8px 10px;
    text-align: left;
    width: 100%;
}

.crm-webrtc-details-toggle span {
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-webrtc-details-toggle small {
    background: #eef4ff;
    border-radius: 999px;
    color: #2563eb;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    white-space: nowrap;
}

.crm-webrtc-details {
    display: none;
}

.crm-webrtc-details.is-open {
    display: block;
}

.crm-webrtc-incoming {
    align-items: center;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #7f1d1d;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 9px 10px;
}

.crm-webrtc-incoming span,
.crm-webrtc-incoming small {
    display: block;
    font-size: 11px;
}

.crm-webrtc-incoming strong {
    display: block;
    font-size: 13px;
    line-height: 1.25;
    margin: 2px 0;
}

.crm-webrtc-incoming button {
    align-items: center;
    background: #16a34a;
    border: 0;
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 12px;
    gap: 6px;
    min-height: 34px;
    padding: 0 10px;
}

.crm-webrtc-meta {
    border: 1px solid #edf2f7;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.crm-webrtc-meta div {
    display: grid;
    gap: 8px;
    grid-template-columns: 74px minmax(0, 1fr);
    padding: 7px 9px;
}

.crm-webrtc-meta div + div {
    border-top: 1px solid #edf2f7;
}

.crm-webrtc-meta span {
    color: #64748b;
    font-size: 11px;
}

.crm-webrtc-meta strong {
    color: #1f2937;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-webrtc-dialpad {
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px;
}

.crm-webrtc-dial-display {
    align-items: center;
    background: #fff;
    border: 1px solid #dbe5f1;
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 32px;
    margin-bottom: 10px;
    min-height: 40px;
    padding: 4px 4px 4px 12px;
}

.crm-webrtc-dial-display span {
    color: #111827;
    font-size: 18px;
    font-weight: 700;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-webrtc-dial-display button {
    align-items: center;
    background: #f1f5f9;
    border: 0;
    border-radius: 7px;
    color: #475569;
    display: inline-flex;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.crm-webrtc-dial-target {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #166534;
    margin-bottom: 10px;
    padding: 7px 9px;
}

.crm-webrtc-dial-target.is-pending-outbound {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.crm-webrtc-dial-target span,
.crm-webrtc-dial-target strong {
    display: block;
}

.crm-webrtc-dial-target span {
    font-size: 10px;
}

.crm-webrtc-dial-target strong {
    font-size: 12px;
    line-height: 1.25;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-webrtc-dial-keys {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crm-webrtc-dial-keys button {
    align-items: center;
    aspect-ratio: 1 / .72;
    background: #fff;
    border: 1px solid #dbe5f1;
    border-radius: 12px;
    color: #172033;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 46px;
}

.crm-webrtc-dial-keys strong {
    font-size: 20px;
    line-height: 1;
}

.crm-webrtc-dial-keys small {
    color: #64748b;
    font-size: 9px;
    height: 11px;
    letter-spacing: .04em;
    margin-top: 3px;
}

.crm-webrtc-dial-actions {
    display: grid;
    gap: 9px;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    margin-top: 10px;
}

.crm-webrtc-dial-actions button {
    align-items: center;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    height: 42px;
    justify-content: center;
}

.crm-webrtc-dial-actions .clear {
    background: #e2e8f0;
    color: #334155;
}

.crm-webrtc-dial-actions .call {
    background: #16a34a;
    color: #fff;
    font-size: 16px;
}

.crm-webrtc-dial-actions .call.answer {
    gap: 7px;
    padding: 0 18px;
}

.crm-webrtc-dial-actions .call.answer span {
    font-size: 13px;
    font-weight: 700;
}

.crm-webrtc-dial-actions .close-call {
    background: #fee2e2;
    color: #b91c1c;
}

.crm-webrtc-dial-actions button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.crm-webrtc-devices {
    border: 1px solid #edf2f7;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 9px;
}

.crm-webrtc-device-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.crm-webrtc-device-head strong {
    color: #1f2937;
    font-size: 12px;
}

.crm-webrtc-device-head button {
    background: #f8fafc;
    border: 1px solid #dbe5f1;
    border-radius: 7px;
    color: #334155;
    font-size: 11px;
    min-height: 28px;
    padding: 0 8px;
}

.crm-webrtc-devices label {
    color: #64748b;
    display: block;
    font-size: 11px;
    margin-bottom: 7px;
}

.crm-webrtc-devices select {
    background: #fff;
    border: 1px solid #dbe5f1;
    border-radius: 7px;
    color: #1f2937;
    display: block;
    font-size: 12px;
    margin-top: 3px;
    min-height: 30px;
    padding: 3px 7px;
    width: 100%;
}

.crm-webrtc-device-note {
    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
}

.crm-webrtc-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crm-webrtc-actions button {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #dbe5f1;
    border-radius: 8px;
    color: #64748b;
    display: inline-flex;
    font-size: 12px;
    gap: 6px;
    justify-content: center;
    min-height: 34px;
}

.crm-webrtc-note {
    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
    margin-top: 9px;
}

.dark-mode .crm-webrtc-body,
.dark .crm-webrtc-body {
    background: #1f2937;
    border-color: #334155;
}

.dark-mode .crm-webrtc-head strong,
.dark .crm-webrtc-head strong,
.dark-mode .crm-webrtc-meta strong,
.dark .crm-webrtc-meta strong {
    color: #e5e7eb;
}

.dark-mode .crm-webrtc-head span,
.dark .crm-webrtc-head span,
.dark-mode .crm-webrtc-note,
.dark .crm-webrtc-note,
.dark-mode .crm-webrtc-meta span,
.dark .crm-webrtc-meta span {
    color: #cbd5e1;
}

.dark-mode .crm-webrtc-head button,
.dark .crm-webrtc-head button,
.dark-mode .crm-webrtc-actions button,
.dark .crm-webrtc-actions button,
.dark-mode .crm-webrtc-details-toggle,
.dark .crm-webrtc-details-toggle,
.dark-mode .crm-webrtc-slots button,
.dark .crm-webrtc-slots button {
    background: #111827;
    border-color: #334155;
    color: #e5e7eb;
}

.dark-mode .crm-webrtc-meta,
.dark .crm-webrtc-meta,
.dark-mode .crm-webrtc-meta div + div,
.dark .crm-webrtc-meta div + div {
    border-color: #334155;
}

.dark-mode .crm-webrtc-devices,
.dark .crm-webrtc-devices,
.dark-mode .crm-webrtc-devices select,
.dark .crm-webrtc-devices select,
.dark-mode .crm-webrtc-device-head button,
.dark .crm-webrtc-device-head button,
.dark-mode .crm-webrtc-dialpad,
.dark .crm-webrtc-dialpad,
.dark-mode .crm-webrtc-dial-display,
.dark .crm-webrtc-dial-display,
.dark-mode .crm-webrtc-dial-keys button,
.dark .crm-webrtc-dial-keys button {
    background: #111827;
    border-color: #334155;
    color: #e5e7eb;
}

.dark-mode .crm-webrtc-dial-display span,
.dark .crm-webrtc-dial-display span,
.dark-mode .crm-webrtc-dial-keys strong,
.dark .crm-webrtc-dial-keys strong {
    color: #e5e7eb;
}

.dark-mode .crm-webrtc-device-head strong,
.dark .crm-webrtc-device-head strong {
    color: #e5e7eb;
}

.dark-mode .crm-webrtc-devices label,
.dark .crm-webrtc-devices label,
.dark-mode .crm-webrtc-device-note,
.dark .crm-webrtc-device-note {
    color: #cbd5e1;
}

.dark-mode .crm-webrtc-details-toggle small,
.dark .crm-webrtc-details-toggle small {
    background: #1e3a8a;
    color: #bfdbfe;
}

.dark-mode .crm-webrtc-incoming,
.dark .crm-webrtc-incoming {
    background: rgba(127, 29, 29, .35);
    border-color: rgba(248, 113, 113, .45);
    color: #fecaca;
}

@media (max-width: 576px) {
    .crm-webrtc-phone {
        bottom: 72px;
        right: 12px;
    }

    .crm-webrtc-body {
        max-height: calc(100vh - 104px);
        width: calc(100vw - 24px);
    }
}
