/* Enhanced Form Styling for Bootstrap 5 Admin Pages
 * Fixes visibility issues with form controls on white backgrounds
 * and provides modern card-based form layouts
 */

/* ==========================================================================
   Form Control Visibility Fixes
   ========================================================================== */

/* Light mode - enhance borders for better visibility */
.form-control,
.form-select {
    border: 1px solid #ced4da !important;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
    background-color: #e9ecef;
    border-color: #ced4da !important;
}

/* Dark mode - enhance borders for visibility */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    border: 1px solid #495057 !important;
    background-color: #2b2f33;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #86b7fe !important;
    background-color: #2b2f33;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-select:disabled,
[data-bs-theme="dark"] .form-control[readonly] {
    background-color: #1e2124;
    border-color: #495057 !important;
}

/* Textarea specific styling */
textarea.form-control {
    min-height: 100px;
}

/* Input group enhancements */
.input-group-text {
    border: 1px solid #ced4da;
    background-color: #f8f9fa;
}

[data-bs-theme="dark"] .input-group-text {
    border: 1px solid #495057;
    background-color: #343a40;
    color: #e9ecef;
}

/* ==========================================================================
   Modern Form Card Layout
   ========================================================================== */

.form-card {
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #adb5bd;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.form-card .card-header {
    background: linear-gradient(135deg, #1a73e8 0%, #0d9488 100%);
    color: #fff;
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 0.65rem 1rem;
    border-bottom: none;
}

.form-card:has(> .collapse:not(.show)) > .card-header {
    border-radius: 0.5rem;
}

.form-card:has(> .collapse.show) > .card-header {
    border-radius: 0.5rem 0.5rem 0 0;
}

.form-card .card-header h2,
.form-card .card-header h3,
.form-card .card-header h4,
.form-card .card-header h5,
.form-card .card-header h6 {
    margin: 0;
    font-weight: 600;
    color: #fff;
}

/* Collapsible card-header chevron indicator */
.form-card .card-header[data-bs-toggle="collapse"] {
    cursor: pointer;
}

.form-card .card-header .collapse-chevron {
    transition: transform 0.3s ease;
    font-size: 0.85rem;
    opacity: 0.8;
}

.form-card .card-header.collapsed .collapse-chevron {
    transform: rotate(-90deg);
}

.form-card .card-body {
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 0 0 0.5rem 0.5rem;
}

.card.form-card > .card-header + .card-body {
    padding: 1.5rem;
}

/* Light mode page background contrast */
#main-content {
    background-color: #f5f7fa;
}

[data-bs-theme="dark"] .form-card {
    background: #2d3238;
    border: 1px solid #5c6370;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.4);
}

html[data-bs-theme="dark"] .form-card {
    background: #2d3238;
    border: 1px solid #5c6370;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.4);
    margin-bottom: 1.5rem;
}

[data-bs-theme="dark"] .form-card .card-body {
    background-color: #2d3238;
    border-radius: 0 0 0.5rem 0.5rem;
}

html[data-bs-theme="dark"] .form-card .card-header + .card-body {
    padding: 1.5rem;
}

html[data-bs-theme="dark"] .form-card .card-header + .card-body.pt-3 {
    padding-top: 1rem !important;
}

html[data-bs-theme="dark"] .form-card .card-header + .card-body.p-0 {
    padding: 0 !important;
}

[data-bs-theme="dark"] .form-card .card-header {
    background: linear-gradient(135deg, #1565c0 0%, #0b7a72 100%);
    color: #fff;
    padding: 0.65rem 1rem;
}

[data-bs-theme="dark"] .form-card .card-header h2,
[data-bs-theme="dark"] .form-card .card-header h3,
[data-bs-theme="dark"] .form-card .card-header h4,
[data-bs-theme="dark"] .form-card .card-header h5,
[data-bs-theme="dark"] .form-card .card-header h6 {
    color: #fff;
}

[data-bs-theme="dark"] #main-content {
    background-color: #1e2227;
}

html:not([data-bs-theme="dark"]) .btn-warning,
html:not([data-bs-theme="dark"]) .btn-outline-warning {
    --bs-btn-color: #8a4b00;
    --bs-btn-border-color: #b45f00;
    --bs-btn-hover-color: #7a3f00;
    --bs-btn-hover-bg: #ffe08a;
    --bs-btn-hover-border-color: #9b5200;
    --bs-btn-active-color: #6f3900;
    --bs-btn-active-bg: #ffd36a;
    --bs-btn-active-border-color: #854700;
    color: #8a4b00;
    border-color: #b45f00;
    text-shadow: none;
    box-shadow: none;
}

html:not([data-bs-theme="dark"]) .btn-warning {
    --bs-btn-bg: #c86b00;
    --bs-btn-color: #fff;
    --bs-btn-border-color: #a85a00;
    color: #fff;
}

html:not([data-bs-theme="dark"]) .btn-warning .bi,
html:not([data-bs-theme="dark"]) .btn-outline-warning .bi {
    filter: none;
}

html:not([data-bs-theme="dark"]) .btn-info,
html:not([data-bs-theme="dark"]) .btn-outline-info {
    --bs-btn-color: #075985;
    --bs-btn-border-color: #0b6f9f;
    --bs-btn-hover-color: #075985;
    --bs-btn-hover-bg: #cfeeff;
    --bs-btn-hover-border-color: #095f88;
    --bs-btn-active-color: #064b72;
    --bs-btn-active-bg: #b9e3f8;
    --bs-btn-active-border-color: #074f72;
    color: #075985;
    border-color: #0b6f9f;
}

html:not([data-bs-theme="dark"]) .btn-info {
    --bs-btn-bg: #0b6f9f;
    --bs-btn-color: #fff;
    --bs-btn-border-color: #095f88;
    color: #fff;
}

html[data-bs-theme="dark"] .btn-secondary {
    --bs-btn-color: #111827;
    --bs-btn-bg: #b4bbc4;
    --bs-btn-border-color: #c2c8d0;
    --bs-btn-hover-color: #0f172a;
    --bs-btn-hover-bg: #c6ccd3;
    --bs-btn-hover-border-color: #d0d5dc;
    --bs-btn-active-color: #0f172a;
    --bs-btn-active-bg: #a7b0bb;
    --bs-btn-active-border-color: #c2c8d0;
    --bs-btn-disabled-color: #111827;
    --bs-btn-disabled-bg: #8f98a4;
    --bs-btn-disabled-border-color: #9aa3ae;
}

html[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #dbe1e8;
    --bs-btn-border-color: #aeb7c2;
    --bs-btn-hover-color: #111827;
    --bs-btn-hover-bg: #c1c8d0;
    --bs-btn-hover-border-color: #d0d6dd;
    --bs-btn-active-color: #111827;
    --bs-btn-active-bg: #aeb7c2;
    --bs-btn-active-border-color: #c1c8d0;
}

html[data-bs-theme="dark"] .btn-primary {
    --bs-btn-bg: #5f7cff;
    --bs-btn-border-color: #7891ff;
    --bs-btn-hover-bg: #728bff;
    --bs-btn-hover-border-color: #8da1ff;
    --bs-btn-active-bg: #536ee8;
    --bs-btn-active-border-color: #7088f0;
}

html[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: #9fb0ff;
    --bs-btn-border-color: #7f96ff;
    --bs-btn-hover-bg: #6f87ff;
    --bs-btn-hover-border-color: #91a4ff;
}

/* ==========================================================================
   Form Group Styling
   ========================================================================== */

.form-group {
    margin-bottom: 1rem;
}

.form-group label,
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

[data-bs-theme="dark"] .form-group label,
[data-bs-theme="dark"] .form-label {
    color: #adb5bd;
}

/* Required field indicator */
.form-label.required::after,
.form-group label.required::after {
    content: " *";
    color: #dc3545;
}

/* Form help text */
.form-text {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

[data-bs-theme="dark"] .form-text {
    color: #9ca3af;
}

/* ==========================================================================
   Radio and Checkbox Enhancements
   ========================================================================== */

.form-check {
    padding-left: 1.75em;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.125em;
    border: 2px solid #adb5bd;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

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

/* Theme toggle in sidebar/topbar — keep icon and switch aligned in both modes.
   Must override app-dark.css which uses html[data-bs-theme=dark] .form-check (specificity 0,2,1). */
.theme-toggle .form-check,
[data-bs-theme="dark"] .theme-toggle .form-check {
    margin-bottom: 0;
    min-height: auto;
    padding-left: 2.5em;
}

.theme-toggle .form-check-input,
[data-bs-theme="dark"] .theme-toggle .form-check-input {
    width: 2em;
    height: 1.2em;
    margin-left: -2.5em;
}

/* Inline radio/checkbox groups */
.form-check-inline {
    display: inline-flex;
    align-items: center;
    margin-right: 1.5rem;
}

/* Yes/No toggle styling */
.btn-group-toggle {
    display: inline-flex;
}

.btn-group-toggle .btn {
    border: 1px solid #ced4da;
}

.btn-group-toggle .btn-check:checked + .btn {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* ==========================================================================
   Form Actions / Button Bar
   ========================================================================== */

.form-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

[data-bs-theme="dark"] .form-actions {
    border-top-color: #495057;
}

.form-actions .btn {
    min-width: 120px;
}

/* Sticky action bar for long forms */
.form-actions-sticky {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 1rem 1.5rem;
    margin: 1.5rem -1.5rem -1.5rem;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

[data-bs-theme="dark"] .form-actions-sticky {
    background: #2b2f33;
    border-top-color: #495057;
}

/* ==========================================================================
   Legacy Table-Based Form Fixes
   ========================================================================== */

/* Improve visibility of form controls in table layouts */
.table .form-control,
.table .form-select,
.table-responsive .form-control,
.table-responsive .form-select {
    border: 1px solid #ced4da !important;
}

[data-bs-theme="dark"] .table .form-control,
[data-bs-theme="dark"] .table .form-select,
[data-bs-theme="dark"] .table-responsive .form-control,
[data-bs-theme="dark"] .table-responsive .form-select {
    border: 1px solid #495057 !important;
}

/* Fix label alignment in table forms */
.table td:first-child {
    font-weight: 500;
    vertical-align: middle;
    white-space: nowrap;
    padding-right: 1rem;
}

/* Validation message styling in tables */
.table .field-validation-error,
.table .text-danger {
    font-size: 0.875rem;
}

/* ==========================================================================
   Form Sections
   ========================================================================== */

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #0d6efd;
    display: inline-block;
}

[data-bs-theme="dark"] .form-section {
    border-bottom-color: #495057;
}

[data-bs-theme="dark"] .form-section-title {
    color: #e9ecef;
}

/* ==========================================================================
   Row/Grid Form Layouts
   ========================================================================== */

.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}

.form-row > .col,
.form-row > [class*="col-"] {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

/* Responsive form columns */
@media (min-width: 768px) {
    .form-col-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .form-col-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

/* ==========================================================================
   Container Fixes
   ========================================================================== */

/* Fix container width for form pages */
.container-formadmin {
    max-width: 1200px;
}

/* ==========================================================================
   Button Improvements
   ========================================================================== */

/* Nav pills as button stack */
.nav-pills.nav-stacked > li {
    margin-bottom: 0.5rem;
}

.nav-pills.nav-stacked > li > .btn,
.nav-pills.nav-stacked > li > button {
    width: 100%;
    text-align: left;
}

/* Fix button group in fixed position sidebar */
.fixedpos20 {
    position: sticky;
    top: 100px;
}

.fixedpos20 .nav-stacked {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fixedpos20 .nav-stacked li {
    list-style: none;
}

.fixedpos20 .nav-stacked .btn {
    display: block;
    width: 100%;
}

/* ==========================================================================
   Sidebar Card Styling
   ========================================================================== */

.col-lg-3 .card.position-sticky,
.col-md-4 .card.position-sticky {
    border: 1px solid #adb5bd;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
}

.col-lg-3 .card.position-sticky .card-header,
.col-md-4 .card.position-sticky .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #adb5bd;
}

.col-lg-3 .card.position-sticky .card-body,
.col-md-4 .card.position-sticky .card-body {
    padding-top: 1.25rem;
}

[data-bs-theme="dark"] .col-lg-3 .card.position-sticky,
[data-bs-theme="dark"] .col-md-4 .card.position-sticky {
    border: 1px solid #5c6370;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.4);
    background-color: #2d3238;
}

[data-bs-theme="dark"] .col-lg-3 .card.position-sticky .card-header,
[data-bs-theme="dark"] .col-md-4 .card.position-sticky .card-header {
    background-color: #3a4049;
    border-bottom: 1px solid #5c6370;
}

[data-bs-theme="dark"] .col-lg-3 .card.position-sticky .card-body,
[data-bs-theme="dark"] .col-md-4 .card.position-sticky .card-body {
    padding-top: 1.25rem;
}

/* ==========================================================================
   All Card Enhancements (applies to cards in admin pages)
   ========================================================================== */

.card {
    border: 1px solid #adb5bd;
}

[data-bs-theme="dark"] .card {
    border: 1px solid #5c6370;
}

/* ==========================================================================
   Status Indicator Cards
   ========================================================================== */

.form-card.status-danger {
    border-left: 4px solid #dc3545;
}

.form-card.status-danger .card-header {
    background: linear-gradient(135deg, #dc3545 0%, #c62828 100%);
}

.form-card.status-warning {
    border-left: 4px solid #f59e0b;
}

.form-card.status-warning .card-header {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.form-card.status-info {
    border-left: 4px solid #06b6d4;
}

.form-card.status-info .card-header {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

[data-bs-theme="dark"] .form-card.status-danger .card-header {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

[data-bs-theme="dark"] .form-card.status-warning .card-header {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

[data-bs-theme="dark"] .form-card.status-info .card-header {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

/* ==========================================================================
   Compact Form Card (for dense General Info panels)
   ========================================================================== */

.form-card-compact .card-header {
    padding: 0.6rem 1rem;
}

.form-card.form-card-compact {
    margin-bottom: 0.5rem;
}

.form-card-compact .card-header h5,
.form-card-compact .card-header h4 {
    font-size: 0.95rem;
}

.form-card-compact .card-body {
    padding: 0.75rem 1rem;
}

.card.form-card.form-card-compact > .card-header + .card-body {
    padding: 0.75rem 1rem;
}

.form-card-compact .table {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.form-card-compact .table td,
.form-card-compact .table th {
    padding: 0.35rem 0.5rem;
}

/* Dark mode: preserve compact sizing (override app-dark.css padding reset) */
[data-bs-theme="dark"] .form-card-compact .card-header {
    padding: 0.6rem 1rem;
}

[data-bs-theme="dark"] .form-card-compact .card-header h5,
[data-bs-theme="dark"] .form-card-compact .card-header h4 {
    font-size: 0.95rem;
}

[data-bs-theme="dark"] .form-card-compact .card-body {
    padding: 0.75rem 1rem;
}

html[data-bs-theme="dark"] .form-card.form-card-compact {
    margin-bottom: 0.5rem;
}

html[data-bs-theme="dark"] .card.form-card.form-card-compact .card-body {
    padding: 0.75rem 1rem;
}

html[data-bs-theme="dark"] .form-card.form-card-compact .card-header + .card-body {
    padding: 0.75rem 1rem;
}

html[data-bs-theme="dark"] .card.form-card.form-card-compact .table {
    font-size: 0.875rem;
    margin-bottom: 0;
}

html[data-bs-theme="dark"] .card.form-card.form-card-compact .table > :not(caption) > * > *,
html[data-bs-theme="dark"] .card.form-card.form-card-compact .table td,
html[data-bs-theme="dark"] .card.form-card.form-card-compact .table th {
    padding: 0.35rem 0.5rem;
}

/* ==========================================================================
   Call Events Detail Panel (sub-events expansion)
   ========================================================================== */

/* Unboxed on purpose (the indent carries the hierarchy) — and keep padding/margin
   OFF this element: it is the Bootstrap .collapse wrapper, whose height animation
   doesn't include either, so box spacing here snaps at the start/end of the slide. */
.call-events-detail {
    font-size: 0.875rem;
}

/* Call events table styling */
.ce-table th {
    font-size: 0.85rem;
    white-space: nowrap;
}
.ce-table td {
    font-size: 0.875rem;
    vertical-align: middle;
}

/* Icon pills (Recording, Block/Unblock) — stock Velzon rounded buttons sharing one
   size rule so the two controls cannot drift apart. Block is icon-only at rest (a
   circle, see below) with its label hover-revealed by .ce-reveal; Recording keeps its
   label always visible via the .ce-pill-labeled variant. */
.ce-icon-pill {
    display: inline-flex;
    align-items: center;
    /* min-width == height makes the icon-only state a circle rather than an oval,
       and centring keeps the glyph in the middle of it. Width grows past min-width
       on its own once the label reveals; the height never changes. */
    justify-content: center;
    min-width: 1.875rem;
    height: 1.875rem;
    /* Side padding sized so the resting width lands exactly on the 1.875rem height:
       1.25rem icon + 2 × .25rem padding + 2 × 1px border = 1.875rem — a true circle.
       (border-box min-width alone can't guarantee it: the content + padding sum was
       ~1px over, and the larger of the two wins.) */
    padding: 0 .25rem;
}

.ce-icon-pill > i {
    font-size: 1.25rem;
    line-height: 1;
}

/* Labeled variant (Recording): same 1.875rem pill height and icon sizing, but the
   text stays visible instead of hover-revealing, so it needs real side padding. */
.ce-icon-pill.ce-pill-labeled {
    padding: 0 .75rem 0 .5rem;
}

/* Muted-at-rest ghost pills (Call Events block toggle; Recordings download/delete):
   these sit on every row, so a colored icon there would be decoration — the icon
   rests secondary-grey and only takes its variant color (plus the ghost variant's
   soft background) on hover, to telegraph what the click does. The block toggle's
   blocked state is a solid danger pill, so its colors come from the button variant
   (a red icon on red would vanish). */
.ce-block-toggle:not(.is-blocked):not(:hover):not(:focus-visible),
.ce-rest-muted:not(:hover):not(:focus-visible) {
    color: var(--vz-secondary-color);
}

.ce-block-toggle:not(.is-blocked),
.ce-rest-muted {
    transition: color .15s ease, background-color .15s ease;
}

/* Label reveal (Block/Unblock): width animates from 0 so the text slides open.
   The spacing padding rides the hover rule, NOT the base state — padding is
   incompressible, so at max-width 0 it would still render and stretch the collapsed
   circle into an oval. */
.ce-reveal .ce-reveal-label {
    display: inline-block;
    max-width: 0;
    overflow: hidden;
    /* Without nowrap the label wraps one character per line while width-collapsed,
       which leaves the button clipped narrow but many lines TALL. */
    white-space: nowrap;
    transition: max-width .25s ease, padding-left .25s ease;
    vertical-align: middle;
}

.ce-reveal:hover .ce-reveal-label,
.ce-reveal:focus-visible .ce-reveal-label {
    max-width: 8rem;
    padding-left: .35rem;
}

@media (prefers-reduced-motion: reduce) {
    .ce-reveal .ce-reveal-label {
        transition: none;
    }
}

/* Purple utilities: Velzon defines --vz-purple (#6559cc) in the base palette but
   ships no text/bg utilities for it. These follow the stock naming and implementation
   (the .text-info / .bg-info-subtle pattern verbatim) so call sites read as native
   Bootstrap and stay drop-in compatible if Velzon ever ships its own. Light subtle is
   a 15% tint over white, dark subtle is rgba at .15 — the same recipe as the stock
   subtle colors. First use: voicemail badges (matching the workspace dialer). */
:root {
    --vz-purple-rgb: 101, 89, 204;
    --vz-purple-bg-subtle: #e8e6f7;
}

[data-bs-theme="dark"],
[data-layout-mode="dark"],
body[data-layout-mode="dark"] {
    --vz-purple-bg-subtle: rgba(101, 89, 204, 0.15);
}

.text-purple {
    --vz-text-opacity: 1;
    color: rgba(var(--vz-purple-rgb), var(--vz-text-opacity)) !important;
}

.bg-purple-subtle {
    background-color: var(--vz-purple-bg-subtle) !important;
}

/* Contact links in Call History rows: underline via the LONGHAND so the
   link-underline-opacity utilities keep control of the decoration color — the
   text-decoration shorthand utility would reset it to opaque currentcolor. */
.js-contact-link {
    text-decoration-line: underline;
}

/* Quick-range chips driven by btn-check radios (Recordings, Call History): Bootstrap
   deliberately neutralizes :hover on label-buttons paired with .btn-check so hover
   can't fight the checked face — which left these pages without the hover the
   button-driven chips (Call Events, CDR, Internal Calls) have. Restore the
   soft-secondary hover on unchecked chips only. */
.btn-check:not(:checked) + .qr-seg.btn-soft-secondary:hover {
    color: var(--vz-btn-hover-color, #fff);
    background-color: var(--vz-btn-hover-bg);
    border-color: var(--vz-btn-hover-border-color);
}

/* List-groups that fill a card (the results cards and the Groups panels): the active
   panel item's solid background, tinted rows (select-all), and the rows' hover
   brightness are all square-cornered — without clipping they paint over the card's
   rounded corners. Radius is inherited and the list clips to it. */
.card > .list-group:first-child:last-child {
    border-radius: inherit;
    overflow: hidden;
}

/* Panels put the list inside a padding-less body under the header — only the body's
   bottom corners meet the card's radius. */
.card > .card-body.p-0 {
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

/* No forced overflow here: the panel lists scroll internally (overflow-y: auto from
   their own classes), and a scroll container already clips its children to the
   rounded corners — `hidden` would silently cut off entries past the height cap. */
.card > .card-body.p-0 > .list-group {
    border-radius: inherit;
}

/* Group-panel legend avatars while their group is selected: the subtle-tinted square
   (primary-subtle especially) disappears against the solid primary active background,
   so flip it to a white-glass square with a white glyph. Shared by the Call Events,
   Recordings, and slc-group-panel (Internal Calls / CDR Lookup) panels; !important
   because the bg-*-subtle utilities carry it too. */
.ce-group-item.active .avatar-title,
.rec-group-item.active .avatar-title,
.slc-group-item.active .avatar-title {
    background-color: rgba(255, 255, 255, .18) !important;
    color: #fff !important;
}

/* Recordings delete: rows fade and collapse before the re-render drops them.
   The JS pins an inline max-height first, so the !important 0 here transitions
   from a real length. */
.rec-row.rec-row-removing {
    overflow: hidden;
    opacity: 0;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top-width: 0 !important;
    border-bottom-width: 0 !important;
    transition: opacity .2s ease, max-height .3s ease .05s, padding .3s ease .05s;
}

/* Hang-up icon: the bundled Remix set has no phone-off/phone-x glyph, so this is the
   universal "end call" rendering — a handset rotated 135° (like the red hang-up key). */
.ce-hangup-icon {
    display: inline-block;
    transform: rotate(135deg);
}

/* Accordion-style expand indicator at the row's far right (stock Velzon gesture):
   larger chevron, rotates 180° while the row's trail is open. */
.ce-row .ce-row-caret {
    display: inline-flex;
    align-items: center;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--vz-secondary-color);
    transition: transform .25s ease;
    flex-shrink: 0;
}

.ce-row.ce-expanded .ce-row-caret {
    transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
    .ce-row .ce-row-caret {
        transition: none;
    }
}

.ce-row:hover {
    filter: brightness(0.96);
}
[data-bs-theme="dark"] .ce-row:hover {
    filter: brightness(1.1);
}
.ce-detail-row td {
    padding: 0 !important;
    background: transparent !important;
}
.ce-sortable:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
[data-bs-theme="dark"] .ce-sortable:hover {
    background-color: rgba(255, 255, 255, 0.05);
}


.call-events-detail p {
    margin-bottom: 4px;
    padding: 2px 0;
}

.call-events-detail p:last-child {
    margin-bottom: 0;
}


/* Popover max-width for call records */
.popover {
    max-width: 360px;
}

/* Call record filter buttons */
.cdr-filter-group .btn.active {
    font-weight: 600;
}

/* ==========================================================================
   Sidebar Light-Mode Contrast
   ========================================================================== */

.sidebar-wrapper {
    background-color: #e8eaef !important;
    border-right: 1px solid #dee2e6;
}

[data-bs-theme="dark"] .sidebar-wrapper {
    background-color: #1e1e2d !important;
    border-right: 1px solid #2d2d3f;
}

/* ==========================================================================
   Sidebar Scroll Fix
   ========================================================================== */

/* Flex child needs min-height:0 to shrink below content and allow overflow */
.sidebar-wrapper .sidebar-menu {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative; /* required for PerfectScrollbar */
}

/* Hide PerfectScrollbar rails on the wrapper — scrolling is on .sidebar-menu */
.sidebar-wrapper > .ps__rail-x,
.sidebar-wrapper > .ps__rail-y {
    display: none !important;
}

/* Thin native scrollbar fallback for sidebar menu */
.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background-color: rgba(128, 128, 128, 0.3);
    border-radius: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background-color: rgba(128, 128, 128, 0.5);
}

/* ==========================================================================
   AG Grid: Column Resize Handle
   ========================================================================== */

/* Widen the hit area and show col-resize cursor */
.ag-header-cell-resize {
    width: 10px !important;
    cursor: col-resize !important;
    z-index: 1;
}

/* Visible drag indicator on hover */
.ag-header-cell-resize::after {
    content: '';
    position: absolute;
    top: 25%;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    border-radius: 1px;
    background-color: transparent;
    transition: background-color 0.15s;
}
.ag-header-cell-resize:hover::after {
    background-color: rgba(0, 0, 0, 0.3);
}
[data-bs-theme="dark"] .ag-header-cell-resize:hover::after {
    background-color: rgba(255, 255, 255, 0.4);
}

.slc-grid-icon-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    line-height: 1;
}

.slc-grid-icon-figure {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    line-height: 1;
    overflow: visible;
}

.slc-grid-icon-figure .bi {
    font-size: 0.95rem;
}

.slc-grid-icon-touch {
    overflow: visible;
}

.slc-touch-ray {
    position: absolute;
    display: block;
    width: 4px;
    height: 1px;
    left: calc(50% + 1px);
    top: -2px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.8;
    pointer-events: none;
    transform-origin: left center;
}

.slc-touch-ray-1 {
    transform: rotate(-62deg);
}

.slc-touch-ray-2 {
    left: calc(50% + 3px);
    top: -1px;
    transform: rotate(-18deg);
}

.slc-touch-ray-3 {
    left: calc(50% + 3px);
    top: 1px;
    transform: rotate(24deg);
}

.slc-grid-icon-text {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    margin-left: 0.25rem;
    white-space: nowrap;
}

#extensionsTable .ag-cell.slc-actions-cell {
    padding-left: 4px !important;
    padding-right: 4px !important;
}

#extensionsTable .ag-cell.slc-actions-cell .btn-group {
    gap: 2px;
}

#extensionsTable .ag-cell.slc-actions-cell .btn {
    padding: 0.15rem 0.35rem;
    line-height: 1.2;
}

.ag-tooltip,
.slc-global-tooltip {
    max-width: min(520px, calc(100vw - 48px));
    padding: 0.45rem 0.55rem;
    border: 1px solid rgba(33, 37, 41, 0.18);
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.98);
    color: #212529;
    box-shadow: 0 0.45rem 1.25rem rgba(33, 37, 41, 0.18);
    line-height: 1.2;
    pointer-events: none;
    white-space: normal;
}

html[data-bs-theme="dark"] .ag-tooltip,
html[data-bs-theme="dark"] .slc-global-tooltip {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(33, 37, 41, 0.98);
    color: #fff;
    box-shadow: 0 0.45rem 1.25rem rgba(0, 0, 0, 0.35);
}

.slc-global-tooltip {
    position: fixed;
    z-index: 1085;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-2px);
    transition: opacity 0.08s ease, transform 0.08s ease, visibility 0.08s ease;
}

.slc-global-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.slc-title-cell {
    display: block;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Prevent Safari's native ellipsis tooltip from stacking with the portal tooltip. */
.slc-title-cell::after {
    content: "";
    display: block;
    width: 0;
    height: 0;
    line-height: 0;
}

.slc-scroll-sticky-host {
    position: relative;
}

.slc-scroll-sticky-root {
    position: relative;
}

.slc-scroll-sticky-overlay {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
    display: none;
}

.slc-scroll-sticky-cell {
    position: absolute;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 0 var(--ag-cell-horizontal-padding, 8px);
    border-right: 1px solid var(--ag-border-color, #dde2eb);
    border-bottom: 1px solid var(--ag-row-border-color, #dde2eb);
    background: var(--slc-sticky-cell-bg, var(--ag-background-color, #fff));
    color: var(--slc-sticky-cell-color, var(--ag-data-color, #181d1f));
    overflow: hidden;
    pointer-events: auto;
}

.slc-scroll-sticky-cell:last-child {
    box-shadow: 0.35rem 0 0.55rem -0.45rem rgba(0, 0, 0, 0.45);
}

.slc-scroll-sticky-header {
    background: var(--slc-sticky-header-bg, var(--ag-header-background-color, #f8f9fa));
    color: var(--slc-sticky-header-color, var(--ag-header-foreground-color, #181d1f));
    font-weight: 600;
    border-bottom-color: var(--ag-border-color, #dde2eb);
}

html[data-bs-theme="dark"] .slc-scroll-sticky-cell {
    background: var(--slc-sticky-cell-bg, var(--ag-background-color, #181d1f));
    color: var(--slc-sticky-cell-color, var(--ag-data-color, #e9ecef));
}

html[data-bs-theme="dark"] .slc-scroll-sticky-header {
    background: var(--slc-sticky-header-bg, var(--ag-header-background-color, #252b33));
    color: var(--slc-sticky-header-color, var(--ag-header-foreground-color, #e9ecef));
}

.slc-global-tooltip-title {
    margin-bottom: 0.2rem;
    font-weight: 700;
    white-space: nowrap;
}

.slc-global-tooltip-line {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

#extensionsHiddenDisabledSummary.slc-hidden-disabled-summary-row {
    display: flex;
    align-items: center;
    min-height: 24px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    background-color: var(--vz-warning-bg-subtle, #fef4e4);
    color: var(--vz-warning-text-emphasis, #d29c40);
    border: 1px solid rgba(102, 77, 3, 0.25);
    border-top: 0;
    border-radius: 0 0 0.25rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

/* Customer menu audio picker compact mode */
html body .menu-current-audio-box {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

html body .form-card:has(.menu-audio-library-scroll) {
    overflow: visible !important;
}

html body .menu-audio-library-scroll {
    height: 210px;
    max-height: none !important;
    min-height: 96px !important;
    overflow: auto !important;
    resize: vertical !important;
}

html body .menu-audio-library-scroll table {
    border-collapse: collapse !important;
    margin-bottom: 0 !important;
}

html body .menu-audio-library-scroll tr {
    min-height: 32px !important;
}

html body .menu-audio-library-scroll .table > :not(caption) > * > *,
html body .menu-audio-library-scroll td,
html body .menu-audio-library-scroll th {
    min-height: 32px !important;
    padding: 5px 8px !important;
    vertical-align: middle !important;
    line-height: 1 !important;
    font-size: .82rem !important;
}

html body .menu-audio-library-scroll thead th {
    min-height: 30px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    font-size: .76rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
}

html body .menu-audio-library-scroll .btn,
html body .menu-audio-library-scroll .btn-sm {
    min-height: 26px !important;
    height: 26px !important;
    padding: 4px .42rem !important;
    line-height: 1 !important;
    font-size: .76rem !important;
}

html body .menu-audio-library-scroll .btn-group {
    align-items: center !important;
}

html body .menu-audio-library-scroll .badge {
    padding: .08rem .25rem !important;
    font-size: .66rem !important;
    vertical-align: baseline !important;
}

html body .menu-audio-library-scroll .form-check-input {
    width: .9rem !important;
    height: .9rem !important;
    min-width: .9rem !important;
    margin: 0 !important;
}

html body .menu-audio-library-scroll strong {
    font-size: inherit !important;
    font-weight: 600 !important;
}

html body #currentAudioActions {
    display: none !important;
}

/* Filters panel (all Calls/Analytics list pages): the active highlight fades over
   150 ms instead of snapping. Colour only — the panel rebuilds on every auto-refresh
   tick, so anything that moves or fades whole items would flicker. */
.ce-group-item,
.rec-group-item,
.slc-group-item,
.activity-group-item {
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

@media (prefers-reduced-motion: reduce) {
    .ce-group-item,
    .rec-group-item,
    .slc-group-item,
    .activity-group-item {
        transition: none;
    }
}
